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

@ -271,6 +271,8 @@ class Auxiliary::Web::HTTP
method = opts[:method].to_s.upcase || 'GET' method = opts[:method].to_s.upcase || 'GET'
url = url.is_a?( URI ) ? url : URI( url.to_s ) url = url.is_a?( URI ) ? url : URI( url.to_s )
rex_overrides = opts.delete( :rex ) || {}
param_opts = {} param_opts = {}
if !(vars_get = Auxiliary::Web::Form.query_to_params( url.query )).empty? if !(vars_get = Auxiliary::Web::Form.query_to_params( url.query )).empty?
@ -288,7 +290,8 @@ class Auxiliary::Web::HTTP
'uri' => url.path || '/', 'uri' => url.path || '/',
'method' => method, 'method' => method,
'headers' => headers.merge( opts[:headers] || {} ) 'headers' => headers.merge( opts[:headers] || {} )
) # Allow for direct rex overrides
).merge( rex_overrides )
opts['data'] = body if body opts['data'] = body if body