]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http-htx: Normalized absolute URIs with an empty port
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 21 Nov 2022 18:20:20 +0000 (19:20 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Nov 2022 15:56:49 +0000 (16:56 +0100)
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

index 7a32c2156f6b64266a3e0aa3fd0558052b0dd539..0a63fff8d641878488ca1846d71279b23c748b18 100644 (file)
@@ -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;