Remove check for incoming header block size
The application should be responsible for the size of incoming header block size. Framing layer just passes everything (we have size limit for one header/field though) to application.
This commit is contained in:
parent
04b5d1679f
commit
8d5422c9bb
|
@ -57,7 +57,7 @@
|
||||||
#define NGHTTP2_DATA_PAYLOADLEN 4096
|
#define NGHTTP2_DATA_PAYLOADLEN 4096
|
||||||
|
|
||||||
/* Maximum headers payload length, calculated in compressed form.
|
/* Maximum headers payload length, calculated in compressed form.
|
||||||
This applies to both transmission and reception. */
|
This applies to transmission only. */
|
||||||
#define NGHTTP2_MAX_HEADERSLEN 65536
|
#define NGHTTP2_MAX_HEADERSLEN 65536
|
||||||
|
|
||||||
/* The number of bytes for each SETTINGS entry */
|
/* The number of bytes for each SETTINGS entry */
|
||||||
|
|
|
@ -281,7 +281,6 @@ static void session_inbound_frame_reset(nghttp2_session *session)
|
||||||
iframe->niv = 0;
|
iframe->niv = 0;
|
||||||
iframe->payloadleft = 0;
|
iframe->payloadleft = 0;
|
||||||
iframe->padlen = 0;
|
iframe->padlen = 0;
|
||||||
iframe->headers_payload_length = 0;
|
|
||||||
iframe->iv[NGHTTP2_INBOUND_NUM_IV - 1].settings_id =
|
iframe->iv[NGHTTP2_INBOUND_NUM_IV - 1].settings_id =
|
||||||
NGHTTP2_SETTINGS_HEADER_TABLE_SIZE;
|
NGHTTP2_SETTINGS_HEADER_TABLE_SIZE;
|
||||||
iframe->iv[NGHTTP2_INBOUND_NUM_IV - 1].value = UINT32_MAX;
|
iframe->iv[NGHTTP2_INBOUND_NUM_IV - 1].value = UINT32_MAX;
|
||||||
|
@ -4328,8 +4327,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
||||||
NGHTTP2_FLAG_PADDED |
|
NGHTTP2_FLAG_PADDED |
|
||||||
NGHTTP2_FLAG_PRIORITY);
|
NGHTTP2_FLAG_PRIORITY);
|
||||||
|
|
||||||
iframe->headers_payload_length = iframe->frame.hd.length;
|
|
||||||
|
|
||||||
rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd);
|
rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd);
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
busy = 1;
|
busy = 1;
|
||||||
|
@ -4456,8 +4453,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
||||||
iframe->frame.hd.flags &= (NGHTTP2_FLAG_END_HEADERS |
|
iframe->frame.hd.flags &= (NGHTTP2_FLAG_END_HEADERS |
|
||||||
NGHTTP2_FLAG_PADDED);
|
NGHTTP2_FLAG_PADDED);
|
||||||
|
|
||||||
iframe->headers_payload_length = iframe->frame.hd.length;
|
|
||||||
|
|
||||||
rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd);
|
rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd);
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
busy = 1;
|
busy = 1;
|
||||||
|
@ -5036,27 +5031,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe->headers_payload_length += cont_hd.length;
|
|
||||||
|
|
||||||
if(iframe->headers_payload_length > NGHTTP2_MAX_HEADERSLEN) {
|
|
||||||
|
|
||||||
DEBUGF(fprintf(stderr,
|
|
||||||
"recv: headers too large %zu\n",
|
|
||||||
iframe->headers_payload_length));
|
|
||||||
|
|
||||||
rv = nghttp2_session_terminate_session_with_reason
|
|
||||||
(session, NGHTTP2_INTERNAL_ERROR, "header is too large");
|
|
||||||
if(nghttp2_is_fatal(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
busy = 1;
|
|
||||||
|
|
||||||
iframe->state = NGHTTP2_IB_IGN_PAYLOAD;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* CONTINUATION won't bear NGHTTP2_PADDED flag */
|
/* CONTINUATION won't bear NGHTTP2_PADDED flag */
|
||||||
|
|
||||||
iframe->frame.hd.flags |= cont_hd.flags & NGHTTP2_FLAG_END_HEADERS;
|
iframe->frame.hd.flags |= cont_hd.flags & NGHTTP2_FLAG_END_HEADERS;
|
||||||
|
|
|
@ -104,9 +104,6 @@ typedef struct {
|
||||||
size_t payloadleft;
|
size_t payloadleft;
|
||||||
/* padding length for the current frame */
|
/* padding length for the current frame */
|
||||||
size_t padlen;
|
size_t padlen;
|
||||||
/* Sum of payload of (HEADERS | PUSH_PROMISE) + possible
|
|
||||||
CONTINUATION received so far. */
|
|
||||||
size_t headers_payload_length;
|
|
||||||
nghttp2_inbound_state state;
|
nghttp2_inbound_state state;
|
||||||
uint8_t raw_sbuf[8];
|
uint8_t raw_sbuf[8];
|
||||||
} nghttp2_inbound_frame;
|
} nghttp2_inbound_frame;
|
||||||
|
|
Loading…
Reference in New Issue