1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-06 14:39:03 +00:00

Added 'rawheader' when parsing http requests. It saves the header fields, in order, preserving the case. Change http-headers.nse to read this instead of the processed headers.

This commit is contained in:
ron
2009-08-27 15:24:09 +00:00
parent d254c85b42
commit fc2b575fba
2 changed files with 5 additions and 3 deletions

View File

@@ -948,7 +948,7 @@ end
-- @return A table with the values received from the server
function parseResult( response )
if type(response) ~= "string" then return response end
local result = {status=nil,["status-line"]=nil,header={},body=""}
local result = {status=nil,["status-line"]=nil,header={},rawheader={},body=""}
-- try and separate the head from the body
local header, body
@@ -974,6 +974,8 @@ function parseResult( response )
else
match, _, key, value = string.find( line, "(.+): (.*)" )
if match and key and value then
-- Keep the raw header too, in case a script wants to access it
table.insert(result['rawheader'], line)
key = key:lower()
if result.header[key] then
result.header[key] = result.header[key] .. ',' .. value