# HG changeset patch # User Matthew Wild # Date 1249438134 -3600 # Node ID 46120978150c4561c6562dcd1f9fddfa43e3035c # Parent fa49cbfff0e6d99b1e9a224233e71323567e6b31# Parent 7812459eeed7aa9bdfc40f3cba301d712d8ee436 Merge with 0.5 diff -r fa49cbfff0e6 -r 46120978150c net/httpserver.lua --- 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) diff -r fa49cbfff0e6 -r 46120978150c plugins/mod_bosh.lua --- 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