aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-28 01:13:49 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-28 01:13:49 +0100
commitbdbf9df051b000de88e6e2d962d23606d44cfb65 (patch)
treef14553c1573cfca0bcd5aa72ec7bfd104498e24d
parenta5affc4e5d4639700b8a4ea34b2bf8d350e5ab74 (diff)
downloadprosody-bdbf9df051b000de88e6e2d962d23606d44cfb65.tar.gz
prosody-bdbf9df051b000de88e6e2d962d23606d44cfb65.zip
net.http.server: Try default_host if client sent no host anywhere, otherwise... fail. It's 2012.
-rw-r--r--net/http/server.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index eb30da78..8b91b4d3 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -174,15 +174,15 @@ function handle_request(conn, request, finish_cb)
-- Some sanity checking
local err_code, err;
- if not host then
- err_code, err = 400, "Missing or invalid 'Host' header";
- elseif not request.path then
+ if not request.path then
err_code, err = 400, "Invalid path";
elseif not hosts[host] then
if hosts[default_host] then
host = default_host;
- else
+ elseif host then
err_code, err = 404, "Unknown host: "..host;
+ else
+ err_code, err = 400, "Missing or invalid 'Host' header";
end
end