From 22fac0e3e590b2aa7448fb13617c8b6000c2d40c Mon Sep 17 00:00:00 2001 From: fyodor Date: Sun, 29 Jun 2008 04:26:20 +0000 Subject: [PATCH] apply patch by Jah to handle some bogus responses from some devices. See http://seclists.org/nmap-dev/2008/q2/0731.html and http://seclists.org/nmap-dev/2008/q2/0732.html --- nselib/http.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nselib/http.lua b/nselib/http.lua index b93c99977..01f76426b 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -116,11 +116,12 @@ request = function( host, port, data, options ) -- build nicer table for header local last_header, match - for number, line in pairs( header ) do + for number, line in ipairs( header ) do if number == 1 then local code _, _, code = string.find( line, "HTTP/%d\.%d (%d+)") result.status = tonumber(code) + if not result.status then table.insert(body,line) end else match, _, key, value = string.find( line, "(.+): (.*)" ) if match and key and value then @@ -133,8 +134,10 @@ request = function( host, port, data, options ) last_header = key else match, _, value = string.find( line, " +(.*)" ) - if match and value then + if match and value and last_header then result.header[last_header] = result.header[last_header] .. ',' .. value + elseif match and value then + table.insert(body,line) end end end