mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-09 19:51:36 +01:00
MINOR: payload/htx: Adapt smp_fetch_len to be HTX aware
This commit is contained in:
parent
a361837903
commit
f0216dae0c
@ -27,6 +27,7 @@
|
||||
#include <types/stream.h>
|
||||
#include <types/task.h>
|
||||
#include <proto/channel.h>
|
||||
#include <proto/stream.h>
|
||||
|
||||
#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))
|
||||
|
||||
@ -15,12 +15,14 @@
|
||||
|
||||
#include <common/initcall.h>
|
||||
#include <common/net_helper.h>
|
||||
#include <common/htx.h>
|
||||
#include <proto/acl.h>
|
||||
#include <proto/arg.h>
|
||||
#include <proto/channel.h>
|
||||
#include <proto/pattern.h>
|
||||
#include <proto/payload.h>
|
||||
#include <proto/sample.h>
|
||||
#include <proto/proto_http.h>
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
@ -53,6 +55,11 @@ 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;
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user