@@ -354,10 +354,17 @@ def cleanup
354
354
end
355
355
356
356
#
357
- # Connects to the server, creates a request, sends the request, reads the response
357
+ # Connects to the server, creates a request, sends the request, reads the response.
358
+ #
359
+ # In certain cases such as when the response is a 401 and the client is configured for authentication, more than one
360
+ # request may be sent to the server. A degree of control over disconnecting the client's underlying socket can be
361
+ # obtained by toggling the disconnect option.
358
362
#
359
363
# Passes +opts+ through directly to Rex::Proto::Http::Client#request_raw.
360
364
#
365
+ # @param [Hash] opts Options with which to make the HTTP request
366
+ # @param [Integer] timeout The timeout for requests and responses
367
+ # @param [Boolean] disconnect Whether to disconnect the client's socket after the last request has been made
361
368
def send_request_raw ( opts = { } , timeout = 20 , disconnect = false )
362
369
if datastore [ 'HttpClientTimeout' ] && datastore [ 'HttpClientTimeout' ] > 0
363
370
actual_timeout = datastore [ 'HttpClientTimeout' ]
@@ -366,7 +373,7 @@ def send_request_raw(opts = {}, timeout = 20, disconnect = false)
366
373
end
367
374
368
375
c = opts [ 'client' ] || connect ( opts )
369
- r = opts [ : cgi] ? c . request_cgi ( opts ) : c . request_raw ( opts )
376
+ r = opts [ ' cgi' ] ? c . request_cgi ( opts ) : c . request_raw ( opts )
370
377
371
378
res = c . send_recv ( r , actual_timeout )
372
379
@@ -410,7 +417,7 @@ def send_request_cgi(opts = {}, timeout = 20, disconnect = true)
410
417
opts = opts . merge ( { 'cookie' => cookie_jar . cookies . join ( '; ' ) } )
411
418
end
412
419
413
- res = send_request_raw ( opts . merge ( cgi : true ) , timeout , disconnect )
420
+ res = send_request_raw ( opts . merge ( ' cgi' => true ) , timeout , disconnect )
414
421
return unless res
415
422
416
423
if opts [ 'keep_cookies' ] && res . headers [ 'Set-Cookie' ] . present?
0 commit comments