# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1592919571 -7200
# Node ID a23328c463897cdb4312b84566192cca7db10983
# Parent  801b9d5957a609b4ef2f2425306d530b4b41baea
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]`

diff -r 801b9d5957a6 -r a23328c46389 net/http/server.lua
--- a/net/http/server.lua	Mon Jun 22 14:56:44 2020 +0200
+++ b/net/http/server.lua	Tue Jun 23 15:39:31 2020 +0200
@@ -207,7 +207,7 @@
 	};
 	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;