Merge with 0.5

Wed, 05 Aug 2009 03:08:54 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 05 Aug 2009 03:08:54 +0100
changeset 1634
46120978150c
parent 1631
fa49cbfff0e6 (current diff)
parent 1633
7812459eeed7 (diff)
child 1636
16e9ba7c4a03

Merge with 0.5

--- a/net/httpserver.lua	Mon Aug 03 17:53:02 2009 +0100
+++ b/net/httpserver.lua	Wed Aug 05 03:08:54 2009 +0100
@@ -37,6 +37,7 @@
 	-- Write status line
 	local resp;
 	if response.body then
+		local body = tostring(response.body);
 		log("debug", "Sending response to %s", request.id);
 		resp = { "HTTP/1.0 ", response.status or "200 OK", "\r\n"};
 		local h = response.headers;
@@ -48,15 +49,15 @@
 				t_insert(resp, "\r\n");
 			end
 		end
-		if response.body and not (h and h["Content-Length"]) then
+		if not (h and h["Content-Length"]) then
 			t_insert(resp, "Content-Length: ");
-			t_insert(resp, #response.body);
+			t_insert(resp, #body);
 			t_insert(resp, "\r\n");
 		end
 		t_insert(resp, "\r\n");
 		
-		if response.body and request.method ~= "HEAD" then
-			t_insert(resp, response.body);
+		if request.method ~= "HEAD" then
+			t_insert(resp, body);
 		end
 	else
 		-- Response we have is just a string (the body)
--- a/plugins/mod_bosh.lua	Mon Aug 03 17:53:02 2009 +0100
+++ b/plugins/mod_bosh.lua	Wed Aug 05 03:08:54 2009 +0100
@@ -136,8 +136,8 @@
 		if not hosts[attr.to] then
 			-- Unknown host
 			log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to));
-			session_close_reply.attr.condition = "host-unknown";
-			request:send{ headers = default_headers, body = tostring(session_close_reply) };
+			session_close_reply.body.attr.condition = "host-unknown";
+			request:send(session_close_reply);
 			request.notopen = nil
 			return;
 		end

mercurial