Add invisible auth to Web::HTTP
add the invisible auth support to tasos' http classbug/bundler_fix
parent
0c57026065
commit
413c37e506
|
@ -70,6 +70,7 @@ class Auxiliary::Web::HTTP
|
||||||
attr_reader :framework
|
attr_reader :framework
|
||||||
|
|
||||||
attr_accessor :redirect_limit
|
attr_accessor :redirect_limit
|
||||||
|
attr_accessor :username , :password
|
||||||
|
|
||||||
def initialize( opts = {} )
|
def initialize( opts = {} )
|
||||||
@opts = opts.dup
|
@opts = opts.dup
|
||||||
|
@ -85,8 +86,8 @@ class Auxiliary::Web::HTTP
|
||||||
|
|
||||||
@request_opts = {}
|
@request_opts = {}
|
||||||
if opts[:auth].is_a? Hash
|
if opts[:auth].is_a? Hash
|
||||||
@request_opts['basic_auth'] = [ opts[:auth][:user].to_s + ':' +
|
@username = opts[:auth][:user].to_s
|
||||||
opts[:auth][:password] ]. pack( 'm*' ).gsub( /\s+/, '' )
|
@password = opts[:auth][:password].to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
self.redirect_limit = opts[:redirect_limit] || 20
|
self.redirect_limit = opts[:redirect_limit] || 20
|
||||||
|
@ -106,7 +107,9 @@ class Auxiliary::Web::HTTP
|
||||||
opts[:target].port,
|
opts[:target].port,
|
||||||
{},
|
{},
|
||||||
opts[:target].ssl,
|
opts[:target].ssl,
|
||||||
'SSLv23'
|
'SSLv23',
|
||||||
|
username,
|
||||||
|
password
|
||||||
)
|
)
|
||||||
|
|
||||||
c.set_config({
|
c.set_config({
|
||||||
|
@ -294,6 +297,10 @@ class Auxiliary::Web::HTTP
|
||||||
opts['data'] = body if body
|
opts['data'] = body if body
|
||||||
|
|
||||||
c = connect
|
c = connect
|
||||||
|
if opts['username'] and opts['username'] != ''
|
||||||
|
c.username = opts['username'].to_s
|
||||||
|
c.password = opts['password'].to_s
|
||||||
|
end
|
||||||
Response.from_rex_response c.send_recv( c.request_cgi( opts ), timeout )
|
Response.from_rex_response c.send_recv( c.request_cgi( opts ), timeout )
|
||||||
rescue ::Timeout::Error
|
rescue ::Timeout::Error
|
||||||
Response.timed_out
|
Response.timed_out
|
||||||
|
|
Loading…
Reference in New Issue