aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/server.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-03-31 13:45:04 +0100
committerMatthew Wild <mwild1@gmail.com>2013-03-31 13:45:04 +0100
commit3c45ca81a2419305201cb846b24fd429363e1a70 (patch)
tree8489a8021f2b588ab24e593e63f44b4a63eeb207 /net/http/server.lua
parent93abe7ff7b276e9c5f711f52d2ff0d68a185f870 (diff)
downloadprosody-3c45ca81a2419305201cb846b24fd429363e1a70.tar.gz
prosody-3c45ca81a2419305201cb846b24fd429363e1a70.zip
net.http.server: Don't overwrite existing response.headers when returning a response object from a HTTP handler (waqas says it's wrong)
Diffstat (limited to 'net/http/server.lua')
-rw-r--r--net/http/server.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 87d82418..20c2da3e 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -219,7 +219,13 @@ function handle_request(conn, request, finish_cb)
body = result;
elseif result_type == "table" then
for k, v in pairs(result) do
- response[k] = v;
+ if k ~= "headers" then
+ response[k] = v;
+ else
+ for header_name, header_value in pairs(v) do
+ response.headers[header_name] = header_value;
+ end
+ end
end
end
response:send(body);