[Reconnoiter-devel] [reconnoiter commit] r885 - trunk/src/modules-lua/noit

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Fri Sep 25 18:00:36 EDT 2009


Author: jesus
Date: 2009-09-25 18:00:35 -0400 (Fri, 25 Sep 2009)
New Revision: 885

Modified:
   trunk/src/modules-lua/noit/HttpClient.lua
Log:
allow payloads to be sent as well, refs #187

Modified: trunk/src/modules-lua/noit/HttpClient.lua
===================================================================
--- trunk/src/modules-lua/noit/HttpClient.lua	2009-09-25 18:28:59 UTC (rev 884)
+++ trunk/src/modules-lua/noit/HttpClient.lua	2009-09-25 22:00:35 UTC (rev 885)
@@ -29,10 +29,13 @@
    return self.e:ssl_ctx()
 end
 
-function HttpClient:do_request(method, uri, headers)
+function HttpClient:do_request(method, uri, headers, payload)
     self.raw_bytes = 0
     self.content_bytes = 0
     self.e:write(method .. " " .. uri .. " " .. "HTTP/1.1\r\n")
+    if payload ~= nil and string.len(payload) > 0 then
+      headers["Content-Length"] = string.len(payload)
+    end
     headers["Accept-Encoding"] = "gzip, deflate";
     if headers["User-Agent"] == nil then
         headers["User-Agent"] = "Reconnoiter/0.9"
@@ -41,6 +44,9 @@
       self.e:write(header .. ": " .. value .. "\r\n")
     end
     self.e:write("\r\n")
+    if payload ~= nil and string.len(payload) > 0 then
+      self.e:write(payload)
+    end
 end
 
 function HttpClient:get_headers()



More information about the Reconnoiter-devel mailing list