aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-08-05 03:08:54 +0100
committerMatthew Wild <mwild1@gmail.com>2009-08-05 03:08:54 +0100
commit57ac5607c12c5bfbd83f4f02e5c6ac2c9ad1e86d (patch)
tree18e6a985b67b211bed7b3f7883a0e8845ef9e6ac /net
parentcdd3c546c7ef80cb569aafaaf76cde2d3fd3c1e2 (diff)
parentfef360b4dd88c409b5cacbed161bdd6cfd043396 (diff)
downloadprosody-57ac5607c12c5bfbd83f4f02e5c6ac2c9ad1e86d.tar.gz
prosody-57ac5607c12c5bfbd83f4f02e5c6ac2c9ad1e86d.zip
Merge with 0.5
Diffstat (limited to 'net')
-rw-r--r--net/httpserver.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/httpserver.lua b/net/httpserver.lua
index 699e0324..57c8eede 100644
--- a/net/httpserver.lua
+++ b/net/httpserver.lua
@@ -37,6 +37,7 @@ local function send_response(request, response)
-- 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 @@ local function send_response(request, response)
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)