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 0b8f267..858e72e 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -218,7 +218,7 @@
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 9db87c1..7322b33 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -608,7 +608,7 @@
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 cbab1c4..2a6e401 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -958,7 +958,7 @@
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_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 39770e8..8984256 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -3480,7 +3480,7 @@
{
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 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_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_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_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;