Skip to content

Commit e415e3c

Browse files
committed
BUG/MEDIUM: mux-h2: Increase max number of headers when encoding HEADERS frames
When a HEADERS frame is encoded to be sent, the maximum number of headers allowed in the frame is lower than on receiving path. This can lead to report a sending error while the message was accepted. It could be confusing. In addition, the start-line is splitted into pseudo-headers and consummes this way some header slots, increasing the difference between HEADERS frames encoding and decoding. It is even more noticeable because when a HEADERS frame is decoded, a margin is used to be able to handle splitted cookie headers. Concretly, on decoding path, a limit of twice the maxumum number of headers allowed in a message (tune.http.maxhdr * 2) is used. On encoding path, the exact limit is used. It is not consistent. Note that when a frame is decoded, we must use a larger limit because the pseudo headers are reassembled in the start-line and must count for one. But also because, most of time, the cookies are splitted into several headers and are reassembled too. To fix the issue, the same ratio is applied on sending path. A limit must be defined because an dynamic allocation is not acceptable. Twice of the configured limit should be good enough to support headers manipulation. This patch should be backported to all stable versions.
1 parent 3499546 commit e415e3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mux_h2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6123,7 +6123,7 @@ static int h2_frt_transfer_data(struct h2s *h2s)
61236123
*/
61246124
static size_t h2s_snd_fhdrs(struct h2s *h2s, struct htx *htx)
61256125
{
6126-
struct http_hdr list[global.tune.max_http_hdr];
6126+
struct http_hdr list[global.tune.max_http_hdr * 2];
61276127
struct h2c *h2c = h2s->h2c;
61286128
struct htx_blk *blk;
61296129
struct buffer outbuf;
@@ -6388,7 +6388,7 @@ static size_t h2s_snd_fhdrs(struct h2s *h2s, struct htx *htx)
63886388
*/
63896389
static size_t h2s_snd_bhdrs(struct h2s *h2s, struct htx *htx)
63906390
{
6391-
struct http_hdr list[global.tune.max_http_hdr];
6391+
struct http_hdr list[global.tune.max_http_hdr * 2];
63926392
struct h2c *h2c = h2s->h2c;
63936393
struct htx_blk *blk;
63946394
struct buffer outbuf;
@@ -7179,7 +7179,7 @@ static size_t h2s_skip_data(struct h2s *h2s, struct buffer *buf, size_t count)
71797179
*/
71807180
static size_t h2s_make_trailers(struct h2s *h2s, struct htx *htx)
71817181
{
7182-
struct http_hdr list[global.tune.max_http_hdr];
7182+
struct http_hdr list[global.tune.max_http_hdr * 2];
71837183
struct h2c *h2c = h2s->h2c;
71847184
struct htx_blk *blk;
71857185
struct buffer outbuf;

0 commit comments

Comments
 (0)