|
commit 4db294bc0b7988607f2dfdb9d57974b2ba47cbc3
|
|
Author: Jerome Magnin <jmagnin@haproxy.com>
|
|
Date: Mon Aug 26 11:44:21 2019 +0200
|
|
|
|
BUG/MEDIUM: url32 does not take the path part into account in the returned hash.
|
|
|
|
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.
|
|
|
|
(cherry picked from commit 2dd26ca9ff8e642611b8b012d6aee45ea45196bc)
|
|
[wt: adjusted context, we still have legacy in 2.0]
|
|
Signed-off-by: Willy Tarreau <w@1wt.eu>
|
|
|
|
diff --git a/src/http_fetch.c b/src/http_fetch.c
|
|
index e372a122..6448bde9 100644
|
|
--- a/src/http_fetch.c
|
|
+++ b/src/http_fetch.c
|
|
@@ -2735,10 +2735,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;
|