]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http-htx: Don't consider an URI as normalized after a set-uri action
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Nov 2022 14:41:48 +0000 (15:41 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Nov 2022 16:49:10 +0000 (17:49 +0100)
An abosulte URI is marked as normalized if it comes from an H2 client. This
way, we know we can send a relative URI to an H1 server. But, after a
set-uri action, the URI must no longer be considered as normalized.
Otherwise there is no way to send an absolute URI on the server side.

If it is important to update a normalized absolute URI without altering this
property, the host, path and/or query-string must be set separatly.

This patch should fix the issue #1938. It should be backported as far as
2.4.

doc/configuration.txt
src/http_htx.c

index d0ce0ab52508a6761c910b7462d6bd52b926a1f6..5b4a5a44fab054df1cbe1de6ce7eacef92695131 100644 (file)
@@ -7366,9 +7366,11 @@ http-request set-uri <fmt> [ { if | unless } <condition> ]
 
   This rewrites the request URI with the result of the evaluation of format
   string <fmt>. The scheme, authority, path and query string are all replaced
-  at once. This can be used to rewrite hosts in front of proxies, or to
-  perform complex modifications to the URI such as moving parts between the
-  path and the query string.
+  at once. This can be used to rewrite hosts in front of proxies, or to perform
+  complex modifications to the URI such as moving parts between the path and
+  the query string. If an absolute URI is set, it will be sent as is to
+  HTTP/1.1 servers. If it is not the desired behavior, the host, the path
+  and/or the query string should be set separately.
   See also "http-request set-path" and "http-request set-query".
 
 http-request set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
index 0a63fff8d641878488ca1846d71279b23c748b18..3dfbd010624feba44e9ca8e89dfef32afd5291dd 100644 (file)
@@ -389,6 +389,7 @@ int http_replace_req_uri(struct htx *htx, const struct ist uri)
                goto fail;
 
        sl = http_get_stline(htx);
+       sl->flags &= ~HTX_SL_F_NORMALIZED_URI;
        if (!http_update_host(htx, sl, uri))
                goto fail;