aboutsummaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-23 15:39:31 +0200
committerKim Alvefur <zash@zash.se>2020-06-23 15:39:31 +0200
commit48c9a60d193c6c329a5d2b8681bd4b914f03af71 (patch)
treede728e499fac0f565b91a9bfbcf88fb2ada00010 /net/http
parentbd36651336dcfd19229d8ce9ec96c0b000608803 (diff)
downloadprosody-48c9a60d193c6c329a5d2b8681bd4b914f03af71.tar.gz
prosody-48c9a60d193c6c329a5d2b8681bd4b914f03af71.zip
net.http.server: Strip port from Host header in IPv6 friendly way (fix #1302)
E.g. given `[::1]:5280` it would previously result in only `[` instead of the correct `[::1]`
Diffstat (limited to 'net/http')
-rw-r--r--net/http/server.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 9b63d516..d0bd3294 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -207,7 +207,7 @@ function handle_request(conn, request, finish_cb)
};
conn._http_open_response = response;
- local host = (request.headers.host or ""):match("[^:]+");
+ local host = (request.headers.host or ""):gsub(":%d+$","");
-- Some sanity checking
local err_code, err;