diff options
-rw-r--r-- | net/http/server.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua index 7d2fec34..4613783f 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -107,7 +107,12 @@ end function runner_callbacks:error(err) log("error", "Traceback[httpserver]: %s", err); - self.data.conn:write("HTTP/1.0 500 Internal Server Error\r\n\r\n"..events.fire_event("http-error", { code = 500, private_message = err })); + local response = { headers = { content_type = "text/plain" }; body = "" }; + response.body = events.fire_event("http-error", { code = 500; private_message = err; response = response }); + self.data.conn:write("HTTP/1.0 500 Internal Server Error\r\n\z\ + X-Content-Type-Options: nosniff\r\n\z\ + Content-Type: " .. response.header.content_type .. "\r\n\r\n"); + self.data.conn:write(response.body); self.data.conn:close(); end |