Software /
code /
prosody
Diff
net/http/server.lua @ 5404:ae9a47e579d7
net.http.server: Don't overwrite existing response.headers when returning a response object from a HTTP handler (waqas says it's wrong)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 31 Mar 2013 13:45:04 +0100 |
parent | 5333:760c345dc7a1 |
child | 5439:bd7b314c2301 |
line wrap: on
line diff
--- a/net/http/server.lua Sun Mar 31 13:43:12 2013 +0100 +++ b/net/http/server.lua Sun Mar 31 13:45:04 2013 +0100 @@ -219,7 +219,13 @@ 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);