1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 00:49:01 +00:00

Fix an error with http.request: If there was a parsing error or a

network error, it was returning nil instead of a table as documented.
This commit is contained in:
david
2010-01-21 00:23:56 +00:00
parent a105f13975
commit 8a895ff0d9

View File

@@ -1231,8 +1231,7 @@ request = function(host, port, data)
end
end
local response = {}
local result = {status=nil,["status-line"]=nil,header={},body=""}
local error_response = {status=nil,["status-line"]=nil,header={},body=""}
local socket
method = string.match(data, "^(%S+)")
@@ -1240,13 +1239,13 @@ request = function(host, port, data)
socket, partial = comm.tryssl(host, port, data, opts)
if not socket then
return result
return error_response
end
repeat
response, partial = next_response(socket, method, partial)
if not response then
return nil, partial
return error_response
end
-- See RFC 2616, sections 8.2.3 and 10.1.1, for the 100 Continue status.
-- Sometimes a server will tell us to "go ahead" with a POST body before