From: Christopher Faulet Date: Fri, 14 Dec 2018 12:44:53 +0000 (+0100) Subject: MINOR: payload/htx: Adapt smp_fetch_len to be HTX aware X-Git-Tag: v1.9-dev11~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0216dae0c582e3b3468668f4c6ded4c154a2b25;p=thirdparty%2Fhaproxy.git MINOR: payload/htx: Adapt smp_fetch_len to be HTX aware --- diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h index 1d210336fd..2e2163ee5d 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -27,6 +27,7 @@ #include #include #include +#include #define IS_HTX_STRM(strm) (strm_fe(strm)->options2 & PR_O2_USE_HTX) #define IS_HTX_SMP(smp) ((smp)->strm && IS_HTX_STRM((smp)->strm)) diff --git a/src/payload.c b/src/payload.c index 14191a7e20..7ef6d97e22 100644 --- a/src/payload.c +++ b/src/payload.c @@ -15,12 +15,14 @@ #include #include +#include #include #include #include #include #include #include +#include /************************************************************************/ @@ -53,7 +55,12 @@ smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void * chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req; smp->data.type = SMP_T_SINT; - smp->data.u.sint = ci_data(chn); + if (IS_HTX_SMP(smp)) { + struct htx *htx = htxbuf(&chn->buf); + smp->data.u.sint = htx->data - co_data(chn); + } + else + smp->data.u.sint = ci_data(chn); smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE; return 1; }