aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/http/server.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index deaa44cd..938e676d 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -170,10 +170,17 @@ function handle_request(conn, request, finish_cb)
};
conn._http_open_response = response;
+ local err;
if not request.headers.host then
+ err = "No 'Host' header";
+ elseif not request.path then
+ err = "Invalid path";
+ end
+
+ if err then
response.status_code = 400;
response.headers.content_type = "text/html";
- response:send(events.fire_event("http-error", { code = 400, message = "No 'Host' header" }));
+ response:send(events.fire_event("http-error", { code = 400, message = err }));
else
local host = request.headers.host;
if host then