Skip to content

Commit b3e8283

Browse files
committed
Web::HTTP#_request: allow Rex opt level overrides
Allow overriding options at the Rex level when performing requests via the Auxiliary::Web::HTTP wrapper.
1 parent 80a8bab commit b3e8283

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/msf/core/auxiliary/web/http.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,12 @@ def queue( request )
266266
end
267267

268268
def _request( url, opts = {} )
269-
body = opts[:body]
269+
body = opts[:body]
270270
timeout = opts[:timeout] || 10
271-
method = opts[:method].to_s.upcase || 'GET'
272-
url = url.is_a?( URI ) ? url : URI( url.to_s )
271+
method = opts[:method].to_s.upcase || 'GET'
272+
url = url.is_a?( URI ) ? url : URI( url.to_s )
273+
274+
rex_overrides = opts.delete( :rex ) || {}
273275

274276
param_opts = {}
275277

@@ -285,10 +287,11 @@ def _request( url, opts = {} )
285287
end
286288

287289
opts = @request_opts.merge( param_opts ).merge(
288-
'uri' => url.path || '/',
289-
'method' => method,
290+
'uri' => url.path || '/',
291+
'method' => method,
290292
'headers' => headers.merge( opts[:headers] || {} )
291-
)
293+
# Allow for direct rex overrides
294+
).merge( rex_overrides )
292295

293296
opts['data'] = body if body
294297

0 commit comments

Comments
 (0)