From: Christopher Faulet Date: Tue, 11 Jun 2019 13:05:37 +0000 (+0200) Subject: BUG/MINOR: http: Use the global value to limit the number of parsed headers X-Git-Tag: v2.0.0~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4ab11bb8856c98e5db901e2f079e370a385c970;p=thirdparty%2Fhaproxy.git BUG/MINOR: http: Use the global value to limit the number of parsed headers Instead of using the macro MAX_HTTP_HDR to limit the number of headers parsed before throwing an error, we now use the custom global variable global.tune.max_http_hdr. This patch must be backported to 1.9. --- diff --git a/src/http_fetch.c b/src/http_fetch.c index 0b8f2678f1..858e72e16f 100644 --- a/src/http_fetch.c +++ b/src/http_fetch.c @@ -218,7 +218,7 @@ struct htx *smp_prefetch_htx(struct sample *smp, struct channel *chn, int vol) else { /* RAW mode */ struct buffer *buf; struct h1m h1m; - struct http_hdr hdrs[MAX_HTTP_HDR]; + struct http_hdr hdrs[global.tune.max_http_hdr]; union h1_sl h1sl; unsigned int flags = HTX_FL_NONE; int ret; diff --git a/src/http_htx.c b/src/http_htx.c index 9db87c12d7..7322b33780 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -608,7 +608,7 @@ static struct htx *http_str_to_htx(struct buffer *buf, struct ist raw) struct htx *htx; struct htx_sl *sl; struct h1m h1m; - struct http_hdr hdrs[MAX_HTTP_HDR]; + struct http_hdr hdrs[global.tune.max_http_hdr]; union h1_sl h1sl; unsigned int flags = HTX_SL_F_IS_RESP; int ret = 0; diff --git a/src/mux_h1.c b/src/mux_h1.c index cbab1c4ce4..2a6e401599 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -958,7 +958,7 @@ static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *h struct buffer *buf, size_t *ofs, size_t max) { struct htx_sl *sl; - struct http_hdr hdrs[MAX_HTTP_HDR]; + struct http_hdr hdrs[global.tune.max_http_hdr]; union h1_sl h1sl; unsigned int flags = HTX_SL_F_NONE; size_t used; @@ -1302,7 +1302,7 @@ static size_t h1_process_data(struct h1s *h1s, struct h1m *h1m, struct htx *htx, static size_t h1_process_trailers(struct h1s *h1s, struct h1m *h1m, struct htx *htx, struct buffer *buf, size_t *ofs, size_t max) { - struct http_hdr hdrs[MAX_HTTP_HDR]; + struct http_hdr hdrs[global.tune.max_http_hdr]; struct h1m tlr_h1m; int ret = 0; diff --git a/src/mux_h2.c b/src/mux_h2.c index 39770e83d0..8984256586 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3480,7 +3480,7 @@ static int h2c_decode_headers(struct h2c *h2c, struct buffer *rxbuf, uint32_t *f { const uint8_t *hdrs = (uint8_t *)b_head(&h2c->dbuf); struct buffer *tmp = get_trash_chunk(); - struct http_hdr list[MAX_HTTP_HDR * 2]; + struct http_hdr list[global.tune.max_http_hdr * 2]; struct buffer *copy = NULL; unsigned int msgf; struct htx *htx = NULL; @@ -3952,7 +3952,7 @@ try_again: */ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, const struct buffer *buf, size_t ofs, size_t max) { - struct http_hdr list[MAX_HTTP_HDR]; + struct http_hdr list[global.tune.max_http_hdr]; struct h2c *h2c = h2s->h2c; struct h1m *h1m = &h2s->h1m; struct buffer outbuf; @@ -4403,7 +4403,7 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf, */ static size_t h2s_htx_frt_make_resp_headers(struct h2s *h2s, struct htx *htx) { - struct http_hdr list[MAX_HTTP_HDR]; + struct http_hdr list[global.tune.max_http_hdr]; struct h2c *h2c = h2s->h2c; struct htx_blk *blk; struct htx_blk *blk_end; @@ -4611,7 +4611,7 @@ static size_t h2s_htx_frt_make_resp_headers(struct h2s *h2s, struct htx *htx) */ static size_t h2s_htx_bck_make_req_headers(struct h2s *h2s, struct htx *htx) { - struct http_hdr list[MAX_HTTP_HDR]; + struct http_hdr list[global.tune.max_http_hdr]; struct h2c *h2c = h2s->h2c; struct htx_blk *blk; struct htx_blk *blk_end; @@ -5120,7 +5120,7 @@ static size_t h2s_htx_frt_make_resp_data(struct h2s *h2s, struct buffer *buf, si */ static size_t h2s_htx_make_trailers(struct h2s *h2s, struct htx *htx) { - struct http_hdr list[MAX_HTTP_HDR]; + struct http_hdr list[global.tune.max_http_hdr]; struct h2c *h2c = h2s->h2c; struct htx_blk *blk; struct htx_blk *blk_end;