mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 12:19:02 +00:00
Fixed a bug in http.lua where http.post() wouldn't work if the arguments were passed in as a string instead of a table (the documentation says it should work in both places)
This commit is contained in:
@@ -961,6 +961,7 @@ request = function(host, port, data, options)
|
||||
|
||||
method = string.match(data, "^(%S+)")
|
||||
|
||||
--io.write(data)
|
||||
socket, partial = comm.tryssl(host, port, data, { timeout = options.timeout })
|
||||
|
||||
if not socket then
|
||||
@@ -1087,10 +1088,16 @@ post = function( host, port, path, options, ignored, postdata )
|
||||
parts[#parts + 1] = url.escape(k) .. "=" .. url.escape(v)
|
||||
end
|
||||
postdata = table.concat(parts, "&")
|
||||
mod_options.header["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
mod_options.content = postdata
|
||||
else
|
||||
mod_options.content = postdata
|
||||
end
|
||||
|
||||
if(not(mod_options.header)) then
|
||||
mod_options.header = {}
|
||||
end
|
||||
mod_options.header["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
|
||||
table_augment(mod_options, options or {})
|
||||
|
||||
return generic_request(host, port, "POST", path, mod_options)
|
||||
|
||||
Reference in New Issue
Block a user