]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: url32 does not take the path part into account in the returned hash.
authorJerome Magnin <jmagnin@haproxy.com>
Mon, 26 Aug 2019 09:44:21 +0000 (11:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Aug 2019 11:28:13 +0000 (13:28 +0200)
The url32 sample fetch does not take the path part of the URL into
account. This is because in smp_fetch_url32() we erroneously modify
path.len and path.ptr before testing their value and building the
path based part of the hash.

This fixes issue #235

This must be backported as far as 1.9, when HTX was introduced.

src/http_fetch.c

index 922e25cc1adaff4e1b11fc34285b5f03121450d4..126c1a2a8d2f5a3c1341e4e5f7c8ad47ec3cf0c9 100644 (file)
@@ -1786,10 +1786,6 @@ static int smp_fetch_url32(const struct arg *args, struct sample *smp, const cha
        /* now retrieve the path */
        sl = http_get_stline(htx);
        path = http_get_path(htx_sl_req_uri(sl));
-       while (path.len > 0 && *(path.ptr) != '?') {
-               path.ptr++;
-               path.len--;
-       }
        if (path.len && *(path.ptr) == '/') {
                while (path.len--)
                        hash = *(path.ptr++) + (hash << 6) + (hash << 16) - hash;