aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-10-29 02:05:19 +0200
committerKim Alvefur <zash@zash.se>2017-10-29 02:05:19 +0200
commit4c8912a534e44fbbf225d5bdd27fba49d00f8c21 (patch)
tree20b8d5ec8d0b3343977c9217086cc0ac7becced3 /net
parent2720454c8e1da38e9490dc7bf1e5333a952fc9ee (diff)
parent3148bdf83f9564a9625510bf1349b94fe34a4252 (diff)
downloadprosody-im-server-4c8912a534e44fbbf225d5bdd27fba49d00f8c21.tar
prosody-im-server-4c8912a534e44fbbf225d5bdd27fba49d00f8c21.zip
Merge 0.10->trunkHEADmaster
Diffstat (limited to 'net')
-rw-r--r--net/http/server.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 8aa28f5c..877c7f17 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -229,7 +229,7 @@ function handle_request(conn, request, finish_cb)
if err then
response.status_code = err_code;
- response:send(events.fire_event("http-error", { code = err_code, message = err }));
+ response:send(events.fire_event("http-error", { code = err_code, message = err, response = response }));
return;
end
@@ -244,7 +244,8 @@ function handle_request(conn, request, finish_cb)
if result_type == "number" then
response.status_code = result;
if result >= 400 then
- body = events.fire_event("http-error", { code = result });
+ payload.code = result;
+ body = events.fire_event("http-error", payload);
end
elseif result_type == "string" then
body = result;
@@ -266,7 +267,8 @@ function handle_request(conn, request, finish_cb)
-- if handler not called, return 404
response.status_code = 404;
- response:send(events.fire_event("http-error", { code = 404 }));
+ payload.code = 404;
+ response:send(events.fire_event("http-error", payload));
end
local function prepare_header(response)
local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]);