From 322e1308a21fdbe140e9a7f36c2a3b5f83f90e6f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 31 Mar 2013 13:45:04 +0100 Subject: net.http.server: Don't overwrite existing response.headers when returning a response object from a HTTP handler (waqas says it's wrong) --- net/http/server.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'net/http') 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); -- cgit v1.2.3