diff --git a/include/haproxy/htx.h b/include/haproxy/htx.h index 0fd1a1b97..339f0a559 100644 --- a/include/haproxy/htx.h +++ b/include/haproxy/htx.h @@ -30,6 +30,11 @@ #include #include +/* ->extra field value when the payload lenght 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); diff --git a/src/h1_htx.c b/src/h1_htx.c index 1b79584a3..5e7f1ad5e 100644 --- a/src/h1_htx.c +++ b/src/h1_htx.c @@ -208,9 +208,9 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx } /* If body length cannot be determined, set htx->extra to - * ULLONG_MAX. This value is impossible in other cases. + * HTX_UNKOWN_PAYLOAD_LENGTH. This value is impossible in other cases. */ - htx->extra = ((h1m->flags & H1_MF_XFER_LEN) ? h1m->curr_len : ULLONG_MAX); + htx->extra = ((h1m->flags & H1_MF_XFER_LEN) ? h1m->curr_len : HTX_UNKOWN_PAYLOAD_LENGTH); end: return 1; @@ -306,9 +306,9 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx sl->info.res.status = code; /* If body length cannot be determined, set htx->extra to - * ULLONG_MAX. This value is impossible in other cases. + * HTX_UNKOWN_PAYLOAD_LENGTH. This value is impossible in other cases. */ - htx->extra = ((h1m->flags & H1_MF_XFER_LEN) ? h1m->curr_len : ULLONG_MAX); + htx->extra = ((h1m->flags & H1_MF_XFER_LEN) ? h1m->curr_len : HTX_UNKOWN_PAYLOAD_LENGTH); end: return 1; diff --git a/src/hlua.c b/src/hlua.c index e5c6c93b6..346722675 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -4890,7 +4890,7 @@ static int hlua_applet_http_new(lua_State *L, struct appctx *ctx) if (type == HTX_BLK_DATA) len += htx_get_blksz(blk); } - if (htx->extra != ULLONG_MAX) + if (htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH) len += htx->extra; /* Stores the request path. */ diff --git a/src/http_fetch.c b/src/http_fetch.c index 27cfe5473..8c01e0343 100644 --- a/src/http_fetch.c +++ b/src/http_fetch.c @@ -679,7 +679,7 @@ static int smp_fetch_body_size(const struct arg *args, struct sample *smp, const if (type == HTX_BLK_DATA) len += htx_get_blksz(blk); } - if (htx->extra != ULLONG_MAX) + if (htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH) len += htx->extra; smp->data.type = SMP_T_SINT; diff --git a/src/mux_h2.c b/src/mux_h2.c index 4c29a2815..ffbde4619 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -6356,7 +6356,7 @@ static size_t h2_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, in if (!(h2s->flags & H2_SF_OUTGOING_DATA) && count) h2s->flags |= H2_SF_OUTGOING_DATA; - if (htx->extra && htx->extra != ULLONG_MAX) + if (htx->extra && htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH) h2s->flags |= H2_SF_MORE_HTX_DATA; else h2s->flags &= ~H2_SF_MORE_HTX_DATA;