lib/http.rb in arachni-0.2.4 vs lib/http.rb in arachni-0.3
- old
+ new
@@ -32,11 +32,11 @@
# Point is, you don't need to worry about it.
#
# @author: Tasos "Zapotek" Laskos
# <tasos.laskos@gmail.com>
# <zapotek@segfault.gr>
-# @version: 0.2.5
+# @version: 0.2.6
#
class HTTP
include Arachni::UI::Output
include Singleton
@@ -127,11 +127,11 @@
@opts = {
:user_agent => opts.user_agent,
:follow_location => false,
:disable_ssl_peer_verification => true,
- :timeout => 10000
+ :timeout => 50000
}.merge( proxy_opts )
@request_count = 0
@response_count = 0
@time_out_count = 0
@@ -244,11 +244,11 @@
print_debug( 'Headers: ' + res.request.headers.to_s )
print_debug( 'Train?: ' + res.request.train?.to_s )
print_debug( '------------' )
if res.timed_out?
- print_error( 'Request timed-out! -- ID# ' + res.request.id.to_s )
+ # print_error( 'Request timed-out! -- ID# ' + res.request.id.to_s )
@time_out_count += 1
end
if( req.train? )
# handle redirections
@@ -318,10 +318,11 @@
def get( url, opts = { } )
params = opts[:params] || {}
remove_id = opts[:remove_id]
train = opts[:train]
+ timeout = opts[:timeout]
follow_location = opts[:follow_location] || false
async = opts[:async]
async = true if async == nil
@@ -361,13 +362,14 @@
opts = {
:headers => headers,
:params => cparams.empty? ? nil : cparams,
:follow_location => follow_location,
- :timeout => opts[:timeout]
}.merge( @opts )
+ opts[:timeout] = timeout if timeout
+
req = Typhoeus::Request.new( curl, opts )
req.train! if train
queue( req, async )
return req
@@ -389,10 +391,11 @@
#
def post( url, opts = { } )
params = opts[:params]
train = opts[:train]
+ timeout = opts[:timeout]
async = opts[:async]
async = true if async == nil
headers = opts[:headers] || {}
@@ -403,12 +406,12 @@
opts = {
:method => :post,
:headers => headers,
:params => params,
:follow_location => false,
- :timeout => opts[:timeout]
}.merge( @opts )
+ opts[:timeout] = timeout if timeout
req = Typhoeus::Request.new( normalize_url( url ), opts )
req.train! if train
queue( req, async )
@@ -472,11 +475,13 @@
def cookie( url, opts = { } )
cookies = opts[:params] || {}
# params = opts[:params]
train = opts[:train]
+ timeout = opts[:timeout]
+
async = opts[:async]
async = true if async == nil
headers = opts[:headers] || {}
@@ -490,9 +495,11 @@
:headers => headers,
:follow_location => false,
# :params => params
:timeout => opts[:timeout]
}.merge( @opts )
+ opts[:timeout] = timeout if timeout
+
req = Typhoeus::Request.new( normalize_url( url ), opts )
req.train! if train
queue( req, async )