From: Christopher Faulet Date: Mon, 21 Nov 2022 18:20:20 +0000 (+0100) Subject: BUG/MINOR: http-htx: Normalized absolute URIs with an empty port X-Git-Tag: v2.7-dev10~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5dfe1169d50acd3a4c7d04441203718f1964836;p=thirdparty%2Fhaproxy.git BUG/MINOR: http-htx: Normalized absolute URIs with an empty port Thanks to the previous commit ("MINOR: http: Considere empty ports as valid default ports"), empty ports are now considered as valid default ports. Thus, absolute URIs with empty port should be normalized. So now, the following URIs are normalized: http://example.com:/ --> http://example.com/ https://example.com:/ --> https://example.com/ This patch depend on: * MINOR: h1: Consider empty port as invalid in authority for CONNECT * MINOR: http: Considere empty ports as valid default ports It is a bug regarding the RFC3986. Technically, I may be backported as far as 2.4. However, this must be discussed first. If backported, the commits above must be backported too. --- diff --git a/src/http_htx.c b/src/http_htx.c index 7a32c2156f..0a63fff8d6 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -1767,7 +1767,7 @@ int http_scheme_based_normalize(struct htx *htx) } host = isttrim(authority, istlen(authority) - istlen(port) - 1); - if (istlen(port) && http_is_default_port(scheme, port)) { + if (http_is_default_port(scheme, port)) { /* reconstruct the uri with removal of the port */ struct buffer *temp = get_trash_chunk(); struct ist meth, vsn;