Lines Matching refs:iframe
231 session->iframe.state = NGHTTP2_IB_IGN_ALL; in session_terminate_session()
306 nghttp2_inbound_frame *iframe = &session->iframe; in session_inbound_frame_reset() local
311 switch (iframe->frame.hd.type) { in session_inbound_frame_reset()
315 nghttp2_frame_headers_free(&iframe->frame.headers, mem); in session_inbound_frame_reset()
318 nghttp2_frame_priority_free(&iframe->frame.priority); in session_inbound_frame_reset()
321 nghttp2_frame_rst_stream_free(&iframe->frame.rst_stream); in session_inbound_frame_reset()
324 nghttp2_frame_settings_free(&iframe->frame.settings, mem); in session_inbound_frame_reset()
326 nghttp2_mem_free(mem, iframe->iv); in session_inbound_frame_reset()
328 iframe->iv = NULL; in session_inbound_frame_reset()
329 iframe->niv = 0; in session_inbound_frame_reset()
330 iframe->max_niv = 0; in session_inbound_frame_reset()
334 nghttp2_frame_push_promise_free(&iframe->frame.push_promise, mem); in session_inbound_frame_reset()
337 nghttp2_frame_ping_free(&iframe->frame.ping); in session_inbound_frame_reset()
340 nghttp2_frame_goaway_free(&iframe->frame.goaway, mem); in session_inbound_frame_reset()
343 nghttp2_frame_window_update_free(&iframe->frame.window_update); in session_inbound_frame_reset()
348 iframe->frame.hd.type)) { in session_inbound_frame_reset()
349 nghttp2_frame_extension_free(&iframe->frame.ext); in session_inbound_frame_reset()
351 switch (iframe->frame.hd.type) { in session_inbound_frame_reset()
356 nghttp2_frame_altsvc_free(&iframe->frame.ext, mem); in session_inbound_frame_reset()
362 nghttp2_frame_origin_free(&iframe->frame.ext, mem); in session_inbound_frame_reset()
378 memset(&iframe->frame, 0, sizeof(nghttp2_frame)); in session_inbound_frame_reset()
379 memset(&iframe->ext_frame_payload, 0, sizeof(nghttp2_ext_frame_payload)); in session_inbound_frame_reset()
381 iframe->state = NGHTTP2_IB_READ_HEAD; in session_inbound_frame_reset()
383 nghttp2_buf_wrap_init(&iframe->sbuf, iframe->raw_sbuf, in session_inbound_frame_reset()
384 sizeof(iframe->raw_sbuf)); in session_inbound_frame_reset()
385 iframe->sbuf.mark += NGHTTP2_FRAME_HDLEN; in session_inbound_frame_reset()
387 nghttp2_buf_free(&iframe->lbuf, mem); in session_inbound_frame_reset()
388 nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); in session_inbound_frame_reset()
390 iframe->raw_lbuf = NULL; in session_inbound_frame_reset()
392 iframe->payloadleft = 0; in session_inbound_frame_reset()
393 iframe->padlen = 0; in session_inbound_frame_reset()
625 nghttp2_inbound_frame *iframe = &(*session_ptr)->iframe; in session_new() local
629 iframe->state = NGHTTP2_IB_READ_CLIENT_MAGIC; in session_new()
630 iframe->payloadleft = NGHTTP2_CLIENT_MAGIC_LEN; in session_new()
632 iframe->state = NGHTTP2_IB_READ_FIRST_SETTINGS; in session_new()
3682 nghttp2_inbound_frame *iframe = &session->iframe; in session_call_on_extension_chunk_recv_callback() local
3683 nghttp2_frame *frame = &iframe->frame; in session_call_on_extension_chunk_recv_callback()
3701 nghttp2_inbound_frame *iframe = &session->iframe; in session_call_unpack_extension_callback() local
3702 nghttp2_frame *frame = &iframe->frame; in session_call_unpack_extension_callback()
3901 if (session->iframe.state == NGHTTP2_IB_READ_HEADER_BLOCK) { in inflate_header_block()
4056 nghttp2_frame *frame = &session->iframe.frame; in session_after_header_block_received()
4364 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_headers_frame() local
4365 nghttp2_frame *frame = &iframe->frame; in session_process_headers_frame()
4368 nghttp2_frame_unpack_headers_payload(&frame->headers, iframe->sbuf.pos); in session_process_headers_frame()
4453 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_priority_frame() local
4454 nghttp2_frame *frame = &iframe->frame; in session_process_priority_frame()
4458 nghttp2_frame_unpack_priority_payload(&frame->priority, iframe->sbuf.pos); in session_process_priority_frame()
4514 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_rst_stream_frame() local
4515 nghttp2_frame *frame = &iframe->frame; in session_process_rst_stream_frame()
4517 nghttp2_frame_unpack_rst_stream_payload(&frame->rst_stream, iframe->sbuf.pos); in session_process_rst_stream_frame()
4927 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_settings_frame() local
4928 nghttp2_frame *frame = &iframe->frame; in session_process_settings_frame()
4932 if (iframe->max_niv) { in session_process_settings_frame()
4933 min_header_size_entry = iframe->iv[iframe->max_niv - 1]; in session_process_settings_frame()
4938 for (i = 0; i < iframe->niv; ++i) { in session_process_settings_frame()
4939 if (iframe->iv[i].settings_id == NGHTTP2_SETTINGS_HEADER_TABLE_SIZE) { in session_process_settings_frame()
4944 assert(i < iframe->niv); in session_process_settings_frame()
4946 if (min_header_size_entry.value != iframe->iv[i].value) { in session_process_settings_frame()
4947 iframe->iv[iframe->niv++] = iframe->iv[i]; in session_process_settings_frame()
4948 iframe->iv[i] = min_header_size_entry; in session_process_settings_frame()
4953 nghttp2_frame_unpack_settings_payload(&frame->settings, iframe->iv, in session_process_settings_frame()
4954 iframe->niv); in session_process_settings_frame()
4956 iframe->iv = NULL; in session_process_settings_frame()
4957 iframe->niv = 0; in session_process_settings_frame()
4958 iframe->max_niv = 0; in session_process_settings_frame()
5050 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_push_promise_frame() local
5051 nghttp2_frame *frame = &iframe->frame; in session_process_push_promise_frame()
5054 iframe->sbuf.pos); in session_process_push_promise_frame()
5080 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_ping_frame() local
5081 nghttp2_frame *frame = &iframe->frame; in session_process_ping_frame()
5083 nghttp2_frame_unpack_ping_payload(&frame->ping, iframe->sbuf.pos); in session_process_ping_frame()
5121 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_goaway_frame() local
5122 nghttp2_frame *frame = &iframe->frame; in session_process_goaway_frame()
5124 nghttp2_frame_unpack_goaway_payload(&frame->goaway, iframe->sbuf.pos, in session_process_goaway_frame()
5125 iframe->lbuf.pos, in session_process_goaway_frame()
5126 nghttp2_buf_len(&iframe->lbuf)); in session_process_goaway_frame()
5128 nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); in session_process_goaway_frame()
5206 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_window_update_frame() local
5207 nghttp2_frame *frame = &iframe->frame; in session_process_window_update_frame()
5210 iframe->sbuf.pos); in session_process_window_update_frame()
5333 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_altsvc_frame() local
5334 nghttp2_frame *frame = &iframe->frame; in session_process_altsvc_frame()
5337 &frame->ext, nghttp2_get_uint16(iframe->sbuf.pos), iframe->lbuf.pos, in session_process_altsvc_frame()
5338 nghttp2_buf_len(&iframe->lbuf)); in session_process_altsvc_frame()
5342 nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); in session_process_altsvc_frame()
5348 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_origin_frame() local
5349 nghttp2_frame *frame = &iframe->frame; in session_process_origin_frame()
5353 rv = nghttp2_frame_unpack_origin_payload(&frame->ext, iframe->lbuf.pos, in session_process_origin_frame()
5354 nghttp2_buf_len(&iframe->lbuf), mem); in session_process_origin_frame()
5367 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_priority_update_frame() local
5368 nghttp2_frame *frame = &iframe->frame; in session_process_priority_update_frame()
5370 nghttp2_frame_unpack_priority_update_payload(&frame->ext, iframe->sbuf.pos, in session_process_priority_update_frame()
5371 nghttp2_buf_len(&iframe->sbuf)); in session_process_priority_update_frame()
5378 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_extension_frame() local
5379 nghttp2_frame *frame = &iframe->frame; in session_process_extension_frame()
5443 nghttp2_frame *public_data_frame = &session->iframe.frame; in session_process_data_frame()
5603 nghttp2_inbound_frame *iframe; in session_on_data_received_fail_fast() local
5608 iframe = &session->iframe; in session_on_data_received_fail_fast()
5609 stream_id = iframe->frame.hd.stream_id; in session_on_data_received_fail_fast()
5669 static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe, in inbound_frame_payload_readlen() argument
5672 return nghttp2_min((size_t)(last - in), iframe->payloadleft); in inbound_frame_payload_readlen()
5678 static void inbound_frame_set_mark(nghttp2_inbound_frame *iframe, size_t left) { in inbound_frame_set_mark() argument
5679 nghttp2_buf_reset(&iframe->sbuf); in inbound_frame_set_mark()
5680 iframe->sbuf.mark += left; in inbound_frame_set_mark()
5683 static size_t inbound_frame_buf_read(nghttp2_inbound_frame *iframe, in inbound_frame_buf_read() argument
5688 nghttp2_min((size_t)(last - in), nghttp2_buf_mark_avail(&iframe->sbuf)); in inbound_frame_buf_read()
5690 iframe->sbuf.last = nghttp2_cpymem(iframe->sbuf.last, in, readlen); in inbound_frame_buf_read()
5698 static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) { in inbound_frame_set_settings_entry() argument
5703 nghttp2_frame_unpack_settings_entry(&iv, iframe->sbuf.pos); in inbound_frame_set_settings_entry()
5718 iframe->iv[iframe->niv++] = iv; in inbound_frame_set_settings_entry()
5723 for (i = 0; i < iframe->niv; ++i) { in inbound_frame_set_settings_entry()
5724 if (iframe->iv[i].settings_id == iv.settings_id) { in inbound_frame_set_settings_entry()
5725 iframe->iv[i] = iv; in inbound_frame_set_settings_entry()
5730 if (i == iframe->niv) { in inbound_frame_set_settings_entry()
5731 iframe->iv[iframe->niv++] = iv; in inbound_frame_set_settings_entry()
5736 min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; in inbound_frame_set_settings_entry()
5749 static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe, in inbound_frame_handle_pad() argument
5755 inbound_frame_set_mark(iframe, 1); in inbound_frame_handle_pad()
5766 static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { in inbound_frame_compute_pad() argument
5770 padlen = (size_t)(iframe->sbuf.pos[0] + 1); in inbound_frame_compute_pad()
5775 if (padlen - 1 > iframe->payloadleft) { in inbound_frame_compute_pad()
5779 iframe->padlen = padlen; in inbound_frame_compute_pad()
5790 static ssize_t inbound_frame_effective_readlen(nghttp2_inbound_frame *iframe, in inbound_frame_effective_readlen() argument
5794 nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); in inbound_frame_effective_readlen()
5812 nghttp2_inbound_frame *iframe = &session->iframe; in nghttp2_session_mem_recv() local
5848 switch (iframe->state) { in nghttp2_session_mem_recv()
5850 readlen = nghttp2_min(inlen, iframe->payloadleft); in nghttp2_session_mem_recv()
5853 iframe->payloadleft], in nghttp2_session_mem_recv()
5858 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
5861 if (iframe->payloadleft == 0) { in nghttp2_session_mem_recv()
5863 iframe->state = NGHTTP2_IB_READ_FIRST_SETTINGS; in nghttp2_session_mem_recv()
5870 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
5873 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
5877 if (iframe->sbuf.pos[3] != NGHTTP2_SETTINGS || in nghttp2_session_mem_recv()
5878 (iframe->sbuf.pos[4] & NGHTTP2_FLAG_ACK)) { in nghttp2_session_mem_recv()
5899 iframe->state = NGHTTP2_IB_READ_HEAD; in nghttp2_session_mem_recv()
5907 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
5910 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
5914 nghttp2_frame_unpack_frame_hd(&iframe->frame.hd, iframe->sbuf.pos); in nghttp2_session_mem_recv()
5915 iframe->payloadleft = iframe->frame.hd.length; in nghttp2_session_mem_recv()
5918 iframe->frame.hd.length, iframe->frame.hd.type, in nghttp2_session_mem_recv()
5919 iframe->frame.hd.flags, iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
5921 if (iframe->frame.hd.length > session->local_settings.max_frame_size) { in nghttp2_session_mem_recv()
5922 DEBUGF("recv: length is too large %zu > %u\n", iframe->frame.hd.length, in nghttp2_session_mem_recv()
5935 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
5939 iframe->frame.hd.flags &= in nghttp2_session_mem_recv()
5946 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
5951 iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
5952 iframe->state = NGHTTP2_IB_IGN_DATA; in nghttp2_session_mem_recv()
5960 rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); in nghttp2_session_mem_recv()
5973 iframe->state = NGHTTP2_IB_READ_PAD_DATA; in nghttp2_session_mem_recv()
5977 iframe->state = NGHTTP2_IB_READ_DATA; in nghttp2_session_mem_recv()
5984 iframe->frame.hd.flags &= in nghttp2_session_mem_recv()
5988 rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); in nghttp2_session_mem_recv()
6000 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6004 pri_fieldlen = nghttp2_frame_priority_len(iframe->frame.hd.flags); in nghttp2_session_mem_recv()
6007 if (iframe->payloadleft < pri_fieldlen) { in nghttp2_session_mem_recv()
6009 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6013 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6015 inbound_frame_set_mark(iframe, pri_fieldlen); in nghttp2_session_mem_recv()
6023 rv = session_call_on_begin_frame(session, &iframe->frame.hd); in nghttp2_session_mem_recv()
6038 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6044 session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); in nghttp2_session_mem_recv()
6048 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6053 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6057 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6063 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6065 if (iframe->payloadleft != NGHTTP2_PRIORITY_SPECLEN) { in nghttp2_session_mem_recv()
6068 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6073 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6075 inbound_frame_set_mark(iframe, NGHTTP2_PRIORITY_SPECLEN); in nghttp2_session_mem_recv()
6081 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6091 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6093 if (iframe->payloadleft != 4) { in nghttp2_session_mem_recv()
6095 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6099 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6101 inbound_frame_set_mark(iframe, 4); in nghttp2_session_mem_recv()
6107 iframe->frame.hd.flags &= NGHTTP2_FLAG_ACK; in nghttp2_session_mem_recv()
6109 if ((iframe->frame.hd.length % NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) || in nghttp2_session_mem_recv()
6110 ((iframe->frame.hd.flags & NGHTTP2_FLAG_ACK) && in nghttp2_session_mem_recv()
6111 iframe->payloadleft > 0)) { in nghttp2_session_mem_recv()
6113 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6119 !(iframe->frame.hd.flags & NGHTTP2_FLAG_ACK)) { in nghttp2_session_mem_recv()
6123 iframe->state = NGHTTP2_IB_READ_SETTINGS; in nghttp2_session_mem_recv()
6125 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6130 iframe->max_niv = in nghttp2_session_mem_recv()
6131 iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1; in nghttp2_session_mem_recv()
6133 if (iframe->max_niv - 1 > session->max_settings) { in nghttp2_session_mem_recv()
6143 iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) * in nghttp2_session_mem_recv()
6144 iframe->max_niv); in nghttp2_session_mem_recv()
6146 if (!iframe->iv) { in nghttp2_session_mem_recv()
6150 min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; in nghttp2_session_mem_recv()
6155 inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); in nghttp2_session_mem_recv()
6161 inbound_frame_set_mark(iframe, 0); in nghttp2_session_mem_recv()
6167 iframe->frame.hd.flags &= in nghttp2_session_mem_recv()
6170 rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); in nghttp2_session_mem_recv()
6182 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6186 if (iframe->payloadleft < 4) { in nghttp2_session_mem_recv()
6188 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6192 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6194 inbound_frame_set_mark(iframe, 4); in nghttp2_session_mem_recv()
6200 iframe->frame.hd.flags &= NGHTTP2_FLAG_ACK; in nghttp2_session_mem_recv()
6202 if (iframe->payloadleft != 8) { in nghttp2_session_mem_recv()
6204 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6208 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6209 inbound_frame_set_mark(iframe, 8); in nghttp2_session_mem_recv()
6215 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6217 if (iframe->payloadleft < 8) { in nghttp2_session_mem_recv()
6219 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6223 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6224 inbound_frame_set_mark(iframe, 8); in nghttp2_session_mem_recv()
6243 iframe->frame.hd.type)) { in nghttp2_session_mem_recv()
6249 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6256 iframe->state = NGHTTP2_IB_READ_EXTENSION_PAYLOAD; in nghttp2_session_mem_recv()
6260 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6265 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6271 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6272 iframe->frame.ext.payload = &iframe->ext_frame_payload.altsvc; in nghttp2_session_mem_recv()
6276 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6280 if (iframe->payloadleft < 2) { in nghttp2_session_mem_recv()
6282 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6288 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6289 inbound_frame_set_mark(iframe, 2); in nghttp2_session_mem_recv()
6295 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6301 iframe->frame.ext.payload = &iframe->ext_frame_payload.origin; in nghttp2_session_mem_recv()
6303 if (session->server || iframe->frame.hd.stream_id || in nghttp2_session_mem_recv()
6304 (iframe->frame.hd.flags & 0xf0)) { in nghttp2_session_mem_recv()
6306 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6310 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6312 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6313 iframe->raw_lbuf = nghttp2_mem_malloc(mem, iframe->payloadleft); in nghttp2_session_mem_recv()
6315 if (iframe->raw_lbuf == NULL) { in nghttp2_session_mem_recv()
6319 nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, in nghttp2_session_mem_recv()
6320 iframe->payloadleft); in nghttp2_session_mem_recv()
6325 iframe->state = NGHTTP2_IB_READ_ORIGIN_PAYLOAD; in nghttp2_session_mem_recv()
6332 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6338 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6339 iframe->frame.ext.payload = in nghttp2_session_mem_recv()
6340 &iframe->ext_frame_payload.priority_update; in nghttp2_session_mem_recv()
6352 if (iframe->payloadleft < 4) { in nghttp2_session_mem_recv()
6354 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6359 iframe->payloadleft > sizeof(iframe->raw_sbuf)) { in nghttp2_session_mem_recv()
6361 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6367 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6368 inbound_frame_set_mark(iframe, iframe->payloadleft); in nghttp2_session_mem_recv()
6374 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6382 switch (iframe->state) { in nghttp2_session_mem_recv()
6390 rv = session_call_on_begin_frame(session, &iframe->frame.hd); in nghttp2_session_mem_recv()
6403 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6405 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6408 iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf)); in nghttp2_session_mem_recv()
6410 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6414 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6416 if (iframe->padlen == 0 && in nghttp2_session_mem_recv()
6417 (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { in nghttp2_session_mem_recv()
6418 pri_fieldlen = nghttp2_frame_priority_len(iframe->frame.hd.flags); in nghttp2_session_mem_recv()
6419 padlen = inbound_frame_compute_pad(iframe); in nghttp2_session_mem_recv()
6421 (size_t)padlen + pri_fieldlen > 1 + iframe->payloadleft) { in nghttp2_session_mem_recv()
6429 iframe->frame.headers.padlen = (size_t)padlen; in nghttp2_session_mem_recv()
6432 if (iframe->payloadleft < pri_fieldlen) { in nghttp2_session_mem_recv()
6434 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6437 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6438 inbound_frame_set_mark(iframe, pri_fieldlen); in nghttp2_session_mem_recv()
6442 inbound_frame_set_mark(iframe, 0); in nghttp2_session_mem_recv()
6453 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6459 session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); in nghttp2_session_mem_recv()
6463 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6468 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6472 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6483 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6497 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6505 if (iframe->padlen == 0 && in nghttp2_session_mem_recv()
6506 (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { in nghttp2_session_mem_recv()
6507 padlen = inbound_frame_compute_pad(iframe); in nghttp2_session_mem_recv()
6509 > 1 + iframe->payloadleft) { in nghttp2_session_mem_recv()
6519 iframe->frame.push_promise.padlen = (size_t)padlen; in nghttp2_session_mem_recv()
6521 if (iframe->payloadleft < 4) { in nghttp2_session_mem_recv()
6523 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6527 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6529 inbound_frame_set_mark(iframe, 4); in nghttp2_session_mem_recv()
6541 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6547 session, iframe->frame.push_promise.promised_stream_id, in nghttp2_session_mem_recv()
6552 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6557 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6561 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6570 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6581 debuglen = iframe->frame.hd.length - 8; in nghttp2_session_mem_recv()
6584 iframe->raw_lbuf = nghttp2_mem_malloc(mem, debuglen); in nghttp2_session_mem_recv()
6586 if (iframe->raw_lbuf == NULL) { in nghttp2_session_mem_recv()
6590 nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, debuglen); in nghttp2_session_mem_recv()
6595 iframe->state = NGHTTP2_IB_READ_GOAWAY_DEBUG; in nghttp2_session_mem_recv()
6605 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6615 origin_len = nghttp2_get_uint16(iframe->sbuf.pos); in nghttp2_session_mem_recv()
6619 if (origin_len > iframe->payloadleft) { in nghttp2_session_mem_recv()
6621 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6625 if (iframe->frame.hd.length > 2) { in nghttp2_session_mem_recv()
6626 iframe->raw_lbuf = in nghttp2_session_mem_recv()
6627 nghttp2_mem_malloc(mem, iframe->frame.hd.length - 2); in nghttp2_session_mem_recv()
6629 if (iframe->raw_lbuf == NULL) { in nghttp2_session_mem_recv()
6633 nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, in nghttp2_session_mem_recv()
6634 iframe->frame.hd.length); in nghttp2_session_mem_recv()
6639 iframe->state = NGHTTP2_IB_READ_ALTSVC_PAYLOAD; in nghttp2_session_mem_recv()
6644 nghttp2_get_uint32(iframe->sbuf.pos) & NGHTTP2_STREAM_ID_MASK); in nghttp2_session_mem_recv()
6668 if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { in nghttp2_session_mem_recv()
6675 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
6678 iframe->payloadleft - readlen); in nghttp2_session_mem_recv()
6681 iframe, iframe->payloadleft - readlen, readlen); in nghttp2_session_mem_recv()
6688 trail_padlen = nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); in nghttp2_session_mem_recv()
6690 final = (iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) && in nghttp2_session_mem_recv()
6691 iframe->payloadleft - (size_t)data_readlen == trail_padlen; in nghttp2_session_mem_recv()
6699 inflate_header_block(session, &iframe->frame, &hd_proclen, in nghttp2_session_mem_recv()
6701 iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK); in nghttp2_session_mem_recv()
6707 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6713 iframe->payloadleft -= hd_proclen; in nghttp2_session_mem_recv()
6723 iframe->payloadleft -= hd_proclen; in nghttp2_session_mem_recv()
6728 iframe->frame.hd.type == NGHTTP2_PUSH_PROMISE in nghttp2_session_mem_recv()
6729 ? iframe->frame.push_promise.promised_stream_id in nghttp2_session_mem_recv()
6730 : iframe->frame.hd.stream_id, in nghttp2_session_mem_recv()
6736 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6741 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6745 if (iframe->payloadleft == 0) { in nghttp2_session_mem_recv()
6749 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6755 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6758 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6762 if ((iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) == 0) { in nghttp2_session_mem_recv()
6764 inbound_frame_set_mark(iframe, NGHTTP2_FRAME_HDLEN); in nghttp2_session_mem_recv()
6766 iframe->padlen = 0; in nghttp2_session_mem_recv()
6768 if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { in nghttp2_session_mem_recv()
6769 iframe->state = NGHTTP2_IB_EXPECT_CONTINUATION; in nghttp2_session_mem_recv()
6771 iframe->state = NGHTTP2_IB_IGN_CONTINUATION; in nghttp2_session_mem_recv()
6774 if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { in nghttp2_session_mem_recv()
6787 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
6788 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6792 iframe->payloadleft); in nghttp2_session_mem_recv()
6794 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6798 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6820 assert(iframe->state == NGHTTP2_IB_IGN_ALL); in nghttp2_session_mem_recv()
6826 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6827 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6831 iframe->payloadleft); in nghttp2_session_mem_recv()
6833 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6838 inbound_frame_set_settings_entry(iframe); in nghttp2_session_mem_recv()
6840 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6841 inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); in nghttp2_session_mem_recv()
6851 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6861 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
6864 iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); in nghttp2_session_mem_recv()
6866 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6871 iframe->payloadleft); in nghttp2_session_mem_recv()
6873 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6874 assert(nghttp2_buf_avail(&iframe->lbuf) > 0); in nghttp2_session_mem_recv()
6885 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6895 if (iframe->state == NGHTTP2_IB_EXPECT_CONTINUATION) { in nghttp2_session_mem_recv()
6902 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6905 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6909 nghttp2_frame_unpack_frame_hd(&cont_hd, iframe->sbuf.pos); in nghttp2_session_mem_recv()
6910 iframe->payloadleft = cont_hd.length; in nghttp2_session_mem_recv()
6916 cont_hd.stream_id != iframe->frame.hd.stream_id) { in nghttp2_session_mem_recv()
6919 iframe->frame.hd.stream_id, NGHTTP2_CONTINUATION, in nghttp2_session_mem_recv()
6933 iframe->frame.hd.flags = in nghttp2_session_mem_recv()
6934 (uint8_t)(iframe->frame.hd.flags | in nghttp2_session_mem_recv()
6936 iframe->frame.hd.length += cont_hd.length; in nghttp2_session_mem_recv()
6940 if (iframe->state == NGHTTP2_IB_EXPECT_CONTINUATION) { in nghttp2_session_mem_recv()
6941 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6949 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6956 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6958 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6961 iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf)); in nghttp2_session_mem_recv()
6963 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6973 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6979 nghttp2_session_consume(session, iframe->frame.hd.stream_id, readlen); in nghttp2_session_mem_recv()
6985 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6989 stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
6993 iframe->payloadleft || in nghttp2_session_mem_recv()
6994 (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); in nghttp2_session_mem_recv()
7002 padlen = inbound_frame_compute_pad(iframe); in nghttp2_session_mem_recv()
7012 iframe->frame.data.padlen = (size_t)padlen; in nghttp2_session_mem_recv()
7014 iframe->state = NGHTTP2_IB_READ_DATA; in nghttp2_session_mem_recv()
7018 stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
7022 iframe->state = NGHTTP2_IB_IGN_DATA; in nghttp2_session_mem_recv()
7028 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7029 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7033 iframe->payloadleft); in nghttp2_session_mem_recv()
7044 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7050 iframe->payloadleft || in nghttp2_session_mem_recv()
7051 (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); in nghttp2_session_mem_recv()
7057 iframe, iframe->payloadleft, readlen); in nghttp2_session_mem_recv()
7068 rv = nghttp2_session_consume(session, iframe->frame.hd.stream_id, in nghttp2_session_mem_recv()
7075 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7094 if (iframe->state == NGHTTP2_IB_IGN_DATA) { in nghttp2_session_mem_recv()
7100 session, iframe->frame.hd.stream_id, NGHTTP2_PROTOCOL_ERROR); in nghttp2_session_mem_recv()
7105 iframe->state = NGHTTP2_IB_IGN_DATA; in nghttp2_session_mem_recv()
7111 session, iframe->frame.hd.flags, iframe->frame.hd.stream_id, in nghttp2_session_mem_recv()
7124 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7139 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7140 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7144 iframe->payloadleft); in nghttp2_session_mem_recv()
7155 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7168 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7174 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7186 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7187 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7191 iframe->payloadleft); in nghttp2_session_mem_recv()
7203 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
7209 if (iframe->payloadleft > 0) { in nghttp2_session_mem_recv()
7224 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7226 iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); in nghttp2_session_mem_recv()
7228 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7233 iframe->payloadleft); in nghttp2_session_mem_recv()
7235 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7236 assert(nghttp2_buf_avail(&iframe->lbuf) > 0); in nghttp2_session_mem_recv()
7252 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7255 iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); in nghttp2_session_mem_recv()
7257 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7262 iframe->payloadleft); in nghttp2_session_mem_recv()
7264 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7265 assert(nghttp2_buf_avail(&iframe->lbuf) > 0); in nghttp2_session_mem_recv()
7276 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()