struct htx_sl *sl;
struct ist path;
unsigned long long len = 0;
- int32_t pos;
struct http_uri_parser parser;
int app_idx = 1 - hlua->nargs; /* index of the HTTP applet object in the lua stask */
lua_settable(hlua->T, app_idx - 3);
}
- for (pos = htx_get_first(req_htx); pos != -1; pos = htx_get_next(req_htx, pos)) {
- struct htx_blk *blk = htx_get_blk(req_htx, pos);
- enum htx_blk_type type = htx_get_blk_type(blk);
-
- if (type == HTX_BLK_TLR || type == HTX_BLK_EOT)
- break;
- if (type == HTX_BLK_DATA)
- len += htx_get_blksz(blk);
- }
- if (req_htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH)
- len += req_htx->extra;
-
/* Stores the request path. */
+ len = ctx->sedesc->kip;
lua_pushstring(hlua->T, "length");
lua_pushinteger(hlua->T, len);
lua_settable(hlua->T, app_idx - 3);
#define SMP_REQ_CHN(smp) (smp->strm ? &smp->strm->req : NULL)
#define SMP_RES_CHN(smp) (smp->strm ? &smp->strm->res : NULL)
+#define SMP_REQ_SC(smp) (smp->strm ? smp->strm->scf : NULL)
+#define SMP_RES_SC(smp) (smp->strm ? smp->strm->scb : NULL)
+
/* This function returns the static htx chunk, where raw connections get
* converted to HTX as needed for samplxsing.
*/
static int smp_fetch_body_size(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
/* possible keywords: req.body_size, res.body_size */
- struct channel *chn = ((kw[2] == 'q') ? SMP_REQ_CHN(smp) : SMP_RES_CHN(smp));
+ struct stconn *sc = ((kw[2] == 'q') ? SMP_REQ_SC(smp) : SMP_RES_SC(smp));
struct check *check = ((kw[2] == 's') ? objt_check(smp->sess->origin) : NULL);
- struct htx *htx = smp_prefetch_htx(smp, chn, check, 1);
- int32_t pos;
+ struct htx *htx = smp_prefetch_htx(smp, (sc ? sc_ic(sc) : NULL), check, 1);
unsigned long long len = 0;
if (!htx)
return 0;
-
- for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {
- struct htx_blk *blk = htx_get_blk(htx, pos);
- enum htx_blk_type type = htx_get_blk_type(blk);
-
- if (type == HTX_BLK_TLR || type == HTX_BLK_EOT)
- break;
- if (type == HTX_BLK_DATA)
- len += htx_get_blksz(blk);
- }
- if (htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH)
- len += htx->extra;
+ len = (sc ? sc->sedesc->kip : check->sc->sedesc->kip);
smp->data.type = SMP_T_SINT;
smp->data.u.sint = len;