mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
BUG/MEDIUM: http_fetch: fix the "base" and "base32" fetch methods in HTX mode
The resulting value produced in functions smp_fetch_base() and smp_fetch_base32() was wrong when in HTX mode. This patch also adds the semicolon at the end of the for-loop line, used in function smp_fetch_path(), since it's actually with no body. This must be backported to 1.9.
This commit is contained in:
parent
76d2cef0c2
commit
8861e1c082
@ -1571,6 +1571,7 @@ static int smp_fetch_path(const struct arg *args, struct sample *smp, const char
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (len = 0; len < path.len && *(path.ptr + len) != '?'; len++)
|
for (len = 0; len < path.len && *(path.ptr + len) != '?'; len++)
|
||||||
|
;
|
||||||
|
|
||||||
/* OK, we got the '/' ! */
|
/* OK, we got the '/' ! */
|
||||||
smp->data.type = SMP_T_STR;
|
smp->data.type = SMP_T_STR;
|
||||||
@ -1638,7 +1639,9 @@ static int smp_fetch_base(const struct arg *args, struct sample *smp, const char
|
|||||||
if (path.ptr) {
|
if (path.ptr) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
for (len = 0; len < path.len && *(path.ptr) != '?'; len++);
|
for (len = 0; len < path.len && *(path.ptr + len) != '?'; len++)
|
||||||
|
;
|
||||||
|
|
||||||
if (len && *(path.ptr) == '/')
|
if (len && *(path.ptr) == '/')
|
||||||
chunk_memcat(temp, path.ptr, len);
|
chunk_memcat(temp, path.ptr, len);
|
||||||
}
|
}
|
||||||
@ -1708,7 +1711,7 @@ static int smp_fetch_base32(const struct arg *args, struct sample *smp, const ch
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ctx.blk = NULL;
|
ctx.blk = NULL;
|
||||||
if (!http_find_header(htx, ist("Host"), &ctx, 0)) {
|
if (http_find_header(htx, ist("Host"), &ctx, 0)) {
|
||||||
/* OK we have the header value in ctx.value */
|
/* OK we have the header value in ctx.value */
|
||||||
while (ctx.value.len--)
|
while (ctx.value.len--)
|
||||||
hash = *(ctx.value.ptr++) + (hash << 6) + (hash << 16) - hash;
|
hash = *(ctx.value.ptr++) + (hash << 6) + (hash << 16) - hash;
|
||||||
@ -1720,7 +1723,9 @@ static int smp_fetch_base32(const struct arg *args, struct sample *smp, const ch
|
|||||||
if (path.ptr) {
|
if (path.ptr) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
for (len = 0; len < path.len && *(path.ptr) != '?'; len++);
|
for (len = 0; len < path.len && *(path.ptr + len) != '?'; len++)
|
||||||
|
;
|
||||||
|
|
||||||
if (len && *(path.ptr) == '/') {
|
if (len && *(path.ptr) == '/') {
|
||||||
while (len--)
|
while (len--)
|
||||||
hash = *(path.ptr++) + (hash << 6) + (hash << 16) - hash;
|
hash = *(path.ptr++) + (hash << 6) + (hash << 16) - hash;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user