From ee0fee26c08d8d56e400543da2c204ba8760197b Mon Sep 17 00:00:00 2001 From: david Date: Sun, 13 Dec 2009 22:52:08 +0000 Subject: [PATCH] Skip over a single 100 Continue response, if present, before parsing the real response in http.lua. This patch is by Patrik Karlsson. --- nselib/http.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nselib/http.lua b/nselib/http.lua index 682b23753..e467bdbe4 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1083,6 +1083,13 @@ function parseResult( response, options ) if type(response) ~= "string" then return response end local result = {status=nil,["status-line"]=nil,header={},rawheader={},body=""} + -- 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 + -- sending the real response. If we got one of those, skip over it. + if response and response:match("^HTTP/%d.%d 100%s") then + response = response:match("\r?\n\r?\n(.*)$") + end + -- try and separate the head from the body local header, body if response and response:match( "\r?\n\r?\n" ) then