nghttpd does not support client requested frame size

Fixes #1647
This commit is contained in:
robaho 2021-11-20 14:54:52 -06:00
parent 6feab0a09c
commit 950f0f8d14
3 changed files with 17 additions and 2 deletions

View File

@ -53,7 +53,7 @@
(NGHTTP2_FRAME_HDLEN + 1 + NGHTTP2_MAX_PAYLOADLEN)
/* The default length of DATA frame payload. */
#define NGHTTP2_DATA_PAYLOADLEN NGHTTP2_MAX_FRAME_SIZE_MIN
#define NGHTTP2_DATA_PAYLOADLEN 256*1024
/* Maximum headers block size to send, calculated using
nghttp2_hd_deflate_bound(). This is the default value, and can be

View File

@ -7165,6 +7165,21 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs,
datamax = (size_t)payloadlen;
}
if ((size_t)datamax > nghttp2_buf_avail(buf)) {
/* Resize the current buffer(s). The reason why we do +1 for
buffer size is for possible padding field. */
rv = nghttp2_bufs_realloc(&session->aob.framebufs,
(size_t)(NGHTTP2_FRAME_HDLEN + 1 + datamax));
if (rv != 0) {
DEBUGF("send: realloc buffer failed rv=%d", rv);
} else {
assert(&session->aob.framebufs == bufs);
buf = &bufs->cur->buf;
}
}
/* Current max DATA length is less then buffer chunk size */
assert(nghttp2_buf_avail(buf) >= datamax);

View File

@ -203,7 +203,7 @@ public:
struct ev_loop *get_loop() const;
using WriteBuf = Buffer<64_k>;
using WriteBuf = Buffer<512_k>;
WriteBuf *get_wb();