Mercurial > prosody-hg
diff net/http/server.lua @ 10950:a23328c46389 0.11
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]`
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 23 Jun 2020 15:39:31 +0200 |
| parents | cc9dff0212f4 |
| children | f4215f8baa5d |
line wrap: on
line diff
--- 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;
