]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http: Use the global value to limit the number of parsed headers
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Jun 2019 13:05:37 +0000 (15:05 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Jun 2019 09:13:32 +0000 (11:13 +0200)
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.

src/http_fetch.c
src/http_htx.c
src/mux_h1.c
src/mux_h2.c

index 0b8f2678f17155e840c8f60c2acd241c8db225ce..858e72e16f49bae322718830e7ac8fac1f4a5ea7 100644 (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;
index 9db87c12d706a3fd809b8dae2c4bb94e567cf3e7..7322b33780fc6a4a8d8685939a93f533688bf316 100644 (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;
index cbab1c4ce465439fcce3ffa47694c56cfdd2ee24..2a6e401599dd034f772ebe6527f5fb46515ebed2 100644 (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;
 
index 39770e83d0f50dd7029fe9c9383ec294e60b248b..898425658674673fb2bab4b523ca2225f879856b 100644 (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 @@ 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;