diff --git a/src/proto_http.c b/src/proto_http.c index c49c4f489..ccd52ad0b 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -10014,15 +10014,19 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int struct hdr_ctx ctx; const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; int cnt; + const char *name = NULL; + int len = 0; - if (!args || args->type != ARGT_STR) - return 0; + if (args && args->type == ARGT_STR) { + name = args->data.str.str; + len = args->data.str.len; + } CHECK_HTTP_MESSAGE_FIRST(); ctx.idx = 0; cnt = 0; - while (http_find_full_header2(args->data.str.str, args->data.str.len, msg->chn->buf->p, idx, &ctx)) + while (http_find_full_header2(name, len, msg->chn->buf->p, idx, &ctx)) cnt++; smp->type = SMP_T_UINT; @@ -10101,15 +10105,19 @@ smp_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int o struct hdr_ctx ctx; const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; int cnt; + const char *name = NULL; + int len = 0; - if (!args || args->type != ARGT_STR) - return 0; + if (args && args->type == ARGT_STR) { + name = args->data.str.str; + len = args->data.str.len; + } CHECK_HTTP_MESSAGE_FIRST(); ctx.idx = 0; cnt = 0; - while (http_find_header2(args->data.str.str, args->data.str.len, msg->chn->buf->p, idx, &ctx)) + while (http_find_header2(name, len, msg->chn->buf->p, idx, &ctx)) cnt++; smp->type = SMP_T_UINT;