aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commit7f6dcc373f924b1a0a7dfa6739aa22545215c9db (patch)
treef14553c1573cfca0bcd5aa72ec7bfd104498e24d /net
parente8746c77dad085ea37dda934eff87230796439fa (diff)
downloadprosody-7f6dcc373f924b1a0a7dfa6739aa22545215c9db.tar.gz
prosody-7f6dcc373f924b1a0a7dfa6739aa22545215c9db.zip
net.http.server: Try default_host if client sent no host anywhere, otherwise... fail. It's 2012.
Diffstat (limited to 'net')
-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