diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-28 01:13:49 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-28 01:13:49 +0100 |
commit | bdbf9df051b000de88e6e2d962d23606d44cfb65 (patch) | |
tree | f14553c1573cfca0bcd5aa72ec7bfd104498e24d | |
parent | a5affc4e5d4639700b8a4ea34b2bf8d350e5ab74 (diff) | |
download | prosody-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.lua | 8 |
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 |