mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 05:09:00 +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+)")
|
method = string.match(data, "^(%S+)")
|
||||||
|
|
||||||
|
--io.write(data)
|
||||||
socket, partial = comm.tryssl(host, port, data, { timeout = options.timeout })
|
socket, partial = comm.tryssl(host, port, data, { timeout = options.timeout })
|
||||||
|
|
||||||
if not socket then
|
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)
|
parts[#parts + 1] = url.escape(k) .. "=" .. url.escape(v)
|
||||||
end
|
end
|
||||||
postdata = table.concat(parts, "&")
|
postdata = table.concat(parts, "&")
|
||||||
mod_options.header["Content-Type"] = "application/x-www-form-urlencoded"
|
mod_options.content = postdata
|
||||||
|
else
|
||||||
mod_options.content = postdata
|
mod_options.content = postdata
|
||||||
end
|
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 {})
|
table_augment(mod_options, options or {})
|
||||||
|
|
||||||
return generic_request(host, port, "POST", path, mod_options)
|
return generic_request(host, port, "POST", path, mod_options)
|
||||||
|
|||||||
Reference in New Issue
Block a user