1edc1650c238aa2517f7b50c84af2dcc343b44f9
[openwrt-packages.git] /
1 commit 4db294bc0b7988607f2dfdb9d57974b2ba47cbc3
2 Author: Jerome Magnin <jmagnin@haproxy.com>
3 Date:   Mon Aug 26 11:44:21 2019 +0200
4
5     BUG/MEDIUM: url32 does not take the path part into account in the returned hash.
6     
7     The url32 sample fetch does not take the path part of the URL into
8     account. This is because in smp_fetch_url32() we erroneously modify
9     path.len and path.ptr before testing their value and building the
10     path based part of the hash.
11     
12     This fixes issue #235
13     
14     This must be backported as far as 1.9, when HTX was introduced.
15     
16     (cherry picked from commit 2dd26ca9ff8e642611b8b012d6aee45ea45196bc)
17     [wt: adjusted context, we still have legacy in 2.0]
18     Signed-off-by: Willy Tarreau <w@1wt.eu>
19
20 diff --git a/src/http_fetch.c b/src/http_fetch.c
21 index e372a122..6448bde9 100644
22 --- a/src/http_fetch.c
23 +++ b/src/http_fetch.c
24 @@ -2735,10 +2735,6 @@ static int smp_fetch_url32(const struct arg *args, struct sample *smp, const cha
25                 /* now retrieve the path */
26                 sl = http_get_stline(htx);
27                 path = http_get_path(htx_sl_req_uri(sl));
28 -               while (path.len > 0 && *(path.ptr) != '?') {
29 -                       path.ptr++;
30 -                       path.len--;
31 -               }
32                 if (path.len && *(path.ptr) == '/') {
33                         while (path.len--)
34                                 hash = *(path.ptr++) + (hash << 6) + (hash << 16) - hash;
git clone https://git.99rst.org/PROJECT