Nmap Development mailing list archives

re: [PATCH] http.lua and malformed HTTP responses


From: jah <jah () zadkiel plus com>
Date: Mon, 16 Jun 2008 15:53:48 +0100

This patch, not that one!
--- http.lua.orig       2008-06-16 15:48:55.875000000 +0100
+++ http.lua    2008-06-16 15:47:56.609375000 +0100
@@ -109,11 +109,12 @@
 
   -- 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
@@ -126,8 +127,10 @@
         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

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: