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.
This commit is contained in:
Christopher Faulet 2019-06-11 15:05:37 +02:00
parent 87ebe944d6
commit e4ab11bb88
4 changed files with 9 additions and 9 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 @@ static int h2_frt_transfer_data(struct h2s *h2s)
*/
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;