Skip to content

Commit d4ce2ec

Browse files
committed
Consistently use strings for HTTP request options
1 parent 704e00b commit d4ce2ec

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/msf/core/exploit/remote/http_client.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,17 @@ def cleanup
354354
end
355355

356356
#
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.
358362
#
359363
# Passes +opts+ through directly to Rex::Proto::Http::Client#request_raw.
360364
#
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
361368
def send_request_raw(opts = {}, timeout = 20, disconnect = false)
362369
if datastore['HttpClientTimeout'] && datastore['HttpClientTimeout'] > 0
363370
actual_timeout = datastore['HttpClientTimeout']
@@ -366,7 +373,7 @@ def send_request_raw(opts = {}, timeout = 20, disconnect = false)
366373
end
367374

368375
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)
370377

371378
res = c.send_recv(r, actual_timeout)
372379

@@ -410,7 +417,7 @@ def send_request_cgi(opts = {}, timeout = 20, disconnect = true)
410417
opts = opts.merge({ 'cookie' => cookie_jar.cookies.join('; ') })
411418
end
412419

413-
res = send_request_raw(opts.merge(cgi: true), timeout, disconnect)
420+
res = send_request_raw(opts.merge('cgi' => true), timeout, disconnect)
414421
return unless res
415422

416423
if opts['keep_cookies'] && res.headers['Set-Cookie'].present?

0 commit comments

Comments
 (0)