#define HTX_FL_PARSING_ERROR 0x00000001 /* Set when a parsing error occurred */
#define HTX_FL_PROCESSING_ERROR 0x00000002 /* Set when a processing error occurred */
#define HTX_FL_FRAGMENTED 0x00000004 /* Set when the HTX buffer is fragmented */
-#define HTX_FL_ALTERED_PAYLOAD 0x00000008 /* The payload is altered, the extra value must not be trusted */
+/* 0x00000008 unused */
#define HTX_FL_EOM 0x00000010 /* Set when end-of-message is reached from the HTTP point of view
* (at worst, on the EOM block is missing)
*/
uint32_t head_addr; /* start address of the free space at the beginning */
uint32_t end_addr; /* end address of the free space at the beginning */
- uint64_t extra; /* known bytes amount remaining to receive */
uint32_t flags; /* HTX_FL_* */
/* XXX 4 bytes unused */
#include <haproxy/http-t.h>
#include <haproxy/htx-t.h>
-/* ->extra field value when the payload length is unknown (non-chunked message
- * with no "Content-length" header)
- */
-#define HTX_UNKOWN_PAYLOAD_LENGTH ULLONG_MAX
-
extern struct htx htx_empty;
struct htx_blk *htx_defrag(struct htx *htx, struct htx_blk *blk, uint32_t info);
htx->tail = htx->head = htx->first = -1;
htx->data = 0;
htx->tail_addr = htx->head_addr = htx->end_addr = 0;
- htx->extra = 0;
htx->flags = HTX_FL_NONE;
}
htx->size = buf->size - sizeof(*htx);
htx_reset(htx);
}
- if (htx->flags & HTX_FL_ALTERED_PAYLOAD)
- htx->extra = 0;
return htx;
}
{
int32_t pos;
- chunk_appendf(chunk, " htx=%p(size=%u,data=%u,used=%u,wrap=%s,flags=0x%08x,extra=%llu,"
+ chunk_appendf(chunk, " htx=%p(size=%u,data=%u,used=%u,wrap=%s,flags=0x%08x,"
"first=%d,head=%d,tail=%d,tail_addr=%d,head_addr=%d,end_addr=%d)",
htx, htx->size, htx->data, htx_nbblks(htx), (!htx->head_addr) ? "NO" : "YES",
- htx->flags, (unsigned long long)htx->extra, htx->first, htx->head, htx->tail,
+ htx->flags, htx->first, htx->head, htx->tail,
htx->tail_addr, htx->head_addr, htx->end_addr);
if (!full || !htx_nbblks(htx))
if (htx_is_empty(appctx_htx)) {
buf_htx->flags |= (appctx_htx->flags & HTX_FL_EOM);
}
- buf_htx->extra = (appctx_htx->extra ? (appctx_htx->data + appctx_htx->extra) : 0);
htx_to_buf(buf_htx, buf);
htx_to_buf(appctx_htx, &appctx->outbuf);
ret -= appctx_htx->data;
appctx_htx->flags |= (buf_htx->flags & HTX_FL_EOM);
}
- appctx_htx->extra = (buf_htx->extra ? (buf_htx->data + buf_htx->extra) : 0);
htx_to_buf(appctx_htx, &appctx->outbuf);
htx_to_buf(buf_htx, buf);
ret -= buf_htx->data;
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);
- htx->flags |= HTX_FL_ALTERED_PAYLOAD;
- if (msg->flags & HTTP_MSGF_XFER_LEN)
- htx->extra = 0;
chn_prod(msg->chn)->sedesc->kip = 0;
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_FLT_ANA, s);
return ret;
http_scheme_based_normalize(htx);
}
- /* If body length cannot be determined, set htx->extra to
- * HTX_UNKOWN_PAYLOAD_LENGTH. This value is impossible in other cases.
- */
- htx->extra = ((h1m->flags & H1_MF_XFER_LEN) ? h1m->curr_len : HTX_UNKOWN_PAYLOAD_LENGTH);
-
end:
return 1;
output_full:
goto error;
sl->info.res.status = code;
- /* If body length cannot be determined, set htx->extra to
- * HTX_UNKOWN_PAYLOAD_LENGTH. This value is impossible in other cases.
- */
- htx->extra = ((h1m->flags & H1_MF_XFER_LEN) ? h1m->curr_len : HTX_UNKOWN_PAYLOAD_LENGTH);
-
end:
return 1;
output_full:
total = 0;
}
- /* Don't forget to update htx->extra */
- (*dsthtx)->extra = h1m->curr_len;
*max = lmax;
return total;
}
h1m->curr_len = chksz;
h1m->body_len += chksz;
h1m->state = H1_MSG_DATA;
- (*dsthtx)->extra = h1m->curr_len;
save = ridx;
goto end_parsing;
}
sz = h1m->curr_len;
sz = h1_copy_msg_data(dsthtx, srcbuf, ofs, sz, max, htxbuf);
h1m->curr_len -= sz;
- (*dsthtx)->extra = h1m->curr_len;
total += sz;
if (!h1m->curr_len) {
h1m->state = H1_MSG_DONE;
break;
sl = htx_get_blk_ptr(htx, blk);
sl->flags |= HTX_SL_F_XFER_LEN;
- htx->extra = 0;
}
}
else if (h1m->state < H1_MSG_TRAILERS) {
/* a payload is present */
if (msgf & H2_MSGF_BODY_CL) {
*flags |= H2_SF_DATA_CLEN;
- htx->extra = *body_len;
}
}
if (msgf & H2_MSGF_BODYLESS_RSP)
h2c->dfl -= sent;
h2c->rcvd_c += sent;
h2c->rcvd_s += sent; // warning, this can also affect the closed streams!
-
h2s->body_len -= sent;
- if (h2s->flags & H2_SF_DATA_CLEN)
- htx->extra = h2s->body_len;
-
if (sent < flen) {
if (h2s_get_rxbuf(h2s))
buf_htx->flags |= (h2s_htx->flags & HTX_FL_EOM);
}
- buf_htx->extra = (h2s_htx->extra ? (h2s_htx->data + h2s_htx->extra) : 0);
htx_to_buf(buf_htx, buf);
htx_to_buf(h2s_htx, rxbuf);
ret -= h2s_htx->data;
*fin = 1;
}
- cs_htx->extra = qcs_htx->extra ? (qcs_htx->data + qcs_htx->extra) : 0;
htx_to_buf(cs_htx, buf);
htx_to_buf(qcs_htx, &qcs->rx.app_buf);
ret -= qcs_htx->data;
struct htx *htx = htxbuf(&strm->req.buf);
chunk_appendf(buf,
- "%s htx=%p flags=0x%x size=%u data=%u used=%u wrap=%s extra=%llu\n", pfx,
+ "%s htx=%p flags=0x%x size=%u data=%u used=%u wrap=%s\n", pfx,
htx, htx->flags, htx->size, htx->data, htx_nbblks(htx),
- (htx->tail >= htx->head) ? "NO" : "YES",
- (unsigned long long)htx->extra);
+ (htx->tail >= htx->head) ? "NO" : "YES");
}
if (HAS_FILTERS(strm) && strm->strm_flt.current[0]) {
const struct filter *flt = strm->strm_flt.current[0];
struct htx *htx = htxbuf(&strm->res.buf);
chunk_appendf(buf,
- "%s htx=%p flags=0x%x size=%u data=%u used=%u wrap=%s extra=%llu\n", pfx,
+ "%s htx=%p flags=0x%x size=%u data=%u used=%u wrap=%s\n", pfx,
htx, htx->flags, htx->size, htx->data, htx_nbblks(htx),
- (htx->tail >= htx->head) ? "NO" : "YES",
- (unsigned long long)htx->extra);
+ (htx->tail >= htx->head) ? "NO" : "YES");
}
if (HAS_FILTERS(strm) && strm->strm_flt.current[1]) {