From e5dfe1169d50acd3a4c7d04441203718f1964836 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 21 Nov 2022 19:20:20 +0100 Subject: [PATCH] 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. --- src/http_htx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http_htx.c b/src/http_htx.c index 7a32c2156..0a63fff8d 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;