aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-23 15:43:57 +0200
committerKim Alvefur <zash@zash.se>2020-06-23 15:43:57 +0200
commit0774429554248ae9dc35256080764569a3afed7b (patch)
treed8ec7986d7608e4eb90407cf888b84a3dcc5b762 /net
parent84790c53a3a6618aea51ed06b52dc2bcc9547f83 (diff)
downloadprosody-0774429554248ae9dc35256080764569a3afed7b.tar.gz
prosody-0774429554248ae9dc35256080764569a3afed7b.zip
net.http.server: Fix reporting of missing Host header
The "Missing or invalid 'Host' header" case was dead code previously because `host` was always at least an empty string.
Diffstat (limited to 'net')
-rw-r--r--net/http/server.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index d0bd3294..18704962 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -207,7 +207,8 @@ function handle_request(conn, request, finish_cb)
};
conn._http_open_response = response;
- local host = (request.headers.host or ""):gsub(":%d+$","");
+ local host = request.headers.host;
+ if host then host = host:gsub(":%d+$",""); end
-- Some sanity checking
local err_code, err;