Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
5403:d7ecf6cd584e | 5404:ae9a47e579d7 |
---|---|
217 end | 217 end |
218 elseif result_type == "string" then | 218 elseif result_type == "string" then |
219 body = result; | 219 body = result; |
220 elseif result_type == "table" then | 220 elseif result_type == "table" then |
221 for k, v in pairs(result) do | 221 for k, v in pairs(result) do |
222 response[k] = v; | 222 if k ~= "headers" then |
223 response[k] = v; | |
224 else | |
225 for header_name, header_value in pairs(v) do | |
226 response.headers[header_name] = header_value; | |
227 end | |
228 end | |
223 end | 229 end |
224 end | 230 end |
225 response:send(body); | 231 response:send(body); |
226 end | 232 end |
227 return; | 233 return; |