Handle incoming PAD_HIGH and PAD_LOW in inbound_frame_handle_padding
This commit is contained in:
parent
2ff3d97b2e
commit
e9d1ba2539
|
@ -3313,6 +3313,29 @@ static int inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checks PAD_HIGH and PAD_LOW flags and set next state
|
||||||
|
* accordingly. If padding is set, this function returns 1. If no
|
||||||
|
* padding is set, this function returns 0. On error, returns -1.
|
||||||
|
*/
|
||||||
|
static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe)
|
||||||
|
{
|
||||||
|
if(iframe->frame.hd.flags & NGHTTP2_FLAG_PAD_HIGH) {
|
||||||
|
if((iframe->frame.hd.flags & NGHTTP2_FLAG_PAD_LOW) == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
iframe->state = NGHTTP2_IB_READ_NBYTE;
|
||||||
|
iframe->left = 2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(iframe->frame.hd.flags & NGHTTP2_FLAG_PAD_LOW) {
|
||||||
|
iframe->state = NGHTTP2_IB_READ_NBYTE;
|
||||||
|
iframe->left = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
||||||
const uint8_t *in, size_t inlen)
|
const uint8_t *in, size_t inlen)
|
||||||
{
|
{
|
||||||
|
@ -3354,8 +3377,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
||||||
if(nghttp2_is_fatal(rv)) {
|
if(nghttp2_is_fatal(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
if(iframe->frame.hd.flags & NGHTTP2_FLAG_PAD_HIGH) {
|
rv = inbound_frame_handle_pad(iframe);
|
||||||
if((iframe->frame.hd.flags & NGHTTP2_FLAG_PAD_LOW) == 0) {
|
if(rv < 0) {
|
||||||
iframe->state = NGHTTP2_IB_IGN_DATA;
|
iframe->state = NGHTTP2_IB_IGN_DATA;
|
||||||
rv = nghttp2_session_terminate_session(session,
|
rv = nghttp2_session_terminate_session(session,
|
||||||
NGHTTP2_PROTOCOL_ERROR);
|
NGHTTP2_PROTOCOL_ERROR);
|
||||||
|
@ -3364,18 +3387,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iframe->state = NGHTTP2_IB_READ_NBYTE;
|
if(rv == 0) {
|
||||||
iframe->left = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(iframe->frame.hd.flags & NGHTTP2_FLAG_PAD_LOW) {
|
|
||||||
iframe->state = NGHTTP2_IB_READ_NBYTE;
|
|
||||||
iframe->left = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iframe->state = NGHTTP2_IB_READ_DATA;
|
iframe->state = NGHTTP2_IB_READ_DATA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case NGHTTP2_HEADERS:
|
case NGHTTP2_HEADERS:
|
||||||
DEBUGF(fprintf(stderr, "HEADERS\n"));
|
DEBUGF(fprintf(stderr, "HEADERS\n"));
|
||||||
if(iframe->frame.hd.flags & NGHTTP2_FLAG_PRIORITY) {
|
if(iframe->frame.hd.flags & NGHTTP2_FLAG_PRIORITY) {
|
||||||
|
|
Loading…
Reference in New Issue