Web::HTTP#_request: allow Rex opt level overrides

Allow overriding options at the Rex level when performing requests
via the Auxiliary::Web::HTTP wrapper.
bug/bundler_fix
Tasos Laskos 2013-02-06 01:02:46 +02:00
parent 80a8bab02f
commit b3e828359d
1 changed files with 9 additions and 6 deletions

View File

@ -266,10 +266,12 @@ class Auxiliary::Web::HTTP
end
def _request( url, opts = {} )
body = opts[:body]
body = opts[:body]
timeout = opts[:timeout] || 10
method = opts[:method].to_s.upcase || 'GET'
url = url.is_a?( URI ) ? url : URI( url.to_s )
method = opts[:method].to_s.upcase || 'GET'
url = url.is_a?( URI ) ? url : URI( url.to_s )
rex_overrides = opts.delete( :rex ) || {}
param_opts = {}
@ -285,10 +287,11 @@ class Auxiliary::Web::HTTP
end
opts = @request_opts.merge( param_opts ).merge(
'uri' => url.path || '/',
'method' => method,
'uri' => url.path || '/',
'method' => method,
'headers' => headers.merge( opts[:headers] || {} )
)
# Allow for direct rex overrides
).merge( rex_overrides )
opts['data'] = body if body