If an HTTP data filter is registered on a channel, we must not rely on the
HTX extra field because the payload may be changed and we cannot predict if
this value will change or not. It is too errorprone to let filters deal with
this reponsibility. So we set it to 0 when payload filtering is performed,
but only if the payload length can be determined. It is important because
this field may be used when data are forwarded. In fact, it will be used by
the H1 multiplexer to be able to splice chunk-encoded payload.
flt_http_payload(struct stream *s, struct http_msg *msg, unsigned int len)
{
struct filter *filter;
+ struct htx *htx;
unsigned long long *strm_off = &FLT_STRM_OFF(s, msg->chn);
unsigned int out = co_data(msg->chn);
int ret, data;
ret = data;
*strm_off += ret;
end:
+ htx = htxbuf(&msg->chn->buf);
+ if (msg->flags & HTTP_MSGF_XFER_LEN)
+ htx->extra = 0;
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_FLT_ANA, s);
return ret;
}