• Home
  • Raw
  • Download

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()
630 nghttp2_inbound_frame *iframe = &(*session_ptr)->iframe; in session_new() local
634 iframe->state = NGHTTP2_IB_READ_CLIENT_MAGIC; in session_new()
635 iframe->payloadleft = NGHTTP2_CLIENT_MAGIC_LEN; in session_new()
637 iframe->state = NGHTTP2_IB_READ_FIRST_SETTINGS; in session_new()
3687 nghttp2_inbound_frame *iframe = &session->iframe; in session_call_on_extension_chunk_recv_callback() local
3688 nghttp2_frame *frame = &iframe->frame; in session_call_on_extension_chunk_recv_callback()
3706 nghttp2_inbound_frame *iframe = &session->iframe; in session_call_unpack_extension_callback() local
3707 nghttp2_frame *frame = &iframe->frame; in session_call_unpack_extension_callback()
3906 if (session->iframe.state == NGHTTP2_IB_READ_HEADER_BLOCK) { in inflate_header_block()
4061 nghttp2_frame *frame = &session->iframe.frame; in session_after_header_block_received()
4369 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_headers_frame() local
4370 nghttp2_frame *frame = &iframe->frame; in session_process_headers_frame()
4373 nghttp2_frame_unpack_headers_payload(&frame->headers, iframe->sbuf.pos); in session_process_headers_frame()
4458 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_priority_frame() local
4459 nghttp2_frame *frame = &iframe->frame; in session_process_priority_frame()
4463 nghttp2_frame_unpack_priority_payload(&frame->priority, iframe->sbuf.pos); in session_process_priority_frame()
4519 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_rst_stream_frame() local
4520 nghttp2_frame *frame = &iframe->frame; in session_process_rst_stream_frame()
4522 nghttp2_frame_unpack_rst_stream_payload(&frame->rst_stream, iframe->sbuf.pos); in session_process_rst_stream_frame()
4932 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_settings_frame() local
4933 nghttp2_frame *frame = &iframe->frame; in session_process_settings_frame()
4937 if (iframe->max_niv) { in session_process_settings_frame()
4938 min_header_size_entry = iframe->iv[iframe->max_niv - 1]; in session_process_settings_frame()
4943 for (i = 0; i < iframe->niv; ++i) { in session_process_settings_frame()
4944 if (iframe->iv[i].settings_id == NGHTTP2_SETTINGS_HEADER_TABLE_SIZE) { in session_process_settings_frame()
4949 assert(i < iframe->niv); in session_process_settings_frame()
4951 if (min_header_size_entry.value != iframe->iv[i].value) { in session_process_settings_frame()
4952 iframe->iv[iframe->niv++] = iframe->iv[i]; in session_process_settings_frame()
4953 iframe->iv[i] = min_header_size_entry; in session_process_settings_frame()
4958 nghttp2_frame_unpack_settings_payload(&frame->settings, iframe->iv, in session_process_settings_frame()
4959 iframe->niv); in session_process_settings_frame()
4961 iframe->iv = NULL; in session_process_settings_frame()
4962 iframe->niv = 0; in session_process_settings_frame()
4963 iframe->max_niv = 0; in session_process_settings_frame()
5055 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_push_promise_frame() local
5056 nghttp2_frame *frame = &iframe->frame; in session_process_push_promise_frame()
5059 iframe->sbuf.pos); in session_process_push_promise_frame()
5085 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_ping_frame() local
5086 nghttp2_frame *frame = &iframe->frame; in session_process_ping_frame()
5088 nghttp2_frame_unpack_ping_payload(&frame->ping, iframe->sbuf.pos); in session_process_ping_frame()
5126 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_goaway_frame() local
5127 nghttp2_frame *frame = &iframe->frame; in session_process_goaway_frame()
5129 nghttp2_frame_unpack_goaway_payload(&frame->goaway, iframe->sbuf.pos, in session_process_goaway_frame()
5130 iframe->lbuf.pos, in session_process_goaway_frame()
5131 nghttp2_buf_len(&iframe->lbuf)); in session_process_goaway_frame()
5133 nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); in session_process_goaway_frame()
5211 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_window_update_frame() local
5212 nghttp2_frame *frame = &iframe->frame; in session_process_window_update_frame()
5215 iframe->sbuf.pos); in session_process_window_update_frame()
5338 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_altsvc_frame() local
5339 nghttp2_frame *frame = &iframe->frame; in session_process_altsvc_frame()
5342 &frame->ext, nghttp2_get_uint16(iframe->sbuf.pos), iframe->lbuf.pos, in session_process_altsvc_frame()
5343 nghttp2_buf_len(&iframe->lbuf)); in session_process_altsvc_frame()
5347 nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); in session_process_altsvc_frame()
5353 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_origin_frame() local
5354 nghttp2_frame *frame = &iframe->frame; in session_process_origin_frame()
5358 rv = nghttp2_frame_unpack_origin_payload(&frame->ext, iframe->lbuf.pos, in session_process_origin_frame()
5359 nghttp2_buf_len(&iframe->lbuf), mem); in session_process_origin_frame()
5372 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_priority_update_frame() local
5373 nghttp2_frame *frame = &iframe->frame; in session_process_priority_update_frame()
5375 nghttp2_frame_unpack_priority_update_payload(&frame->ext, iframe->sbuf.pos, in session_process_priority_update_frame()
5376 nghttp2_buf_len(&iframe->sbuf)); in session_process_priority_update_frame()
5383 nghttp2_inbound_frame *iframe = &session->iframe; in session_process_extension_frame() local
5384 nghttp2_frame *frame = &iframe->frame; in session_process_extension_frame()
5448 nghttp2_frame *public_data_frame = &session->iframe.frame; in session_process_data_frame()
5608 nghttp2_inbound_frame *iframe; in session_on_data_received_fail_fast() local
5613 iframe = &session->iframe; in session_on_data_received_fail_fast()
5614 stream_id = iframe->frame.hd.stream_id; in session_on_data_received_fail_fast()
5674 static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe, in inbound_frame_payload_readlen() argument
5677 return nghttp2_min((size_t)(last - in), iframe->payloadleft); in inbound_frame_payload_readlen()
5683 static void inbound_frame_set_mark(nghttp2_inbound_frame *iframe, size_t left) { in inbound_frame_set_mark() argument
5684 nghttp2_buf_reset(&iframe->sbuf); in inbound_frame_set_mark()
5685 iframe->sbuf.mark += left; in inbound_frame_set_mark()
5688 static size_t inbound_frame_buf_read(nghttp2_inbound_frame *iframe, in inbound_frame_buf_read() argument
5693 nghttp2_min((size_t)(last - in), nghttp2_buf_mark_avail(&iframe->sbuf)); in inbound_frame_buf_read()
5695 iframe->sbuf.last = nghttp2_cpymem(iframe->sbuf.last, in, readlen); in inbound_frame_buf_read()
5703 static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) { in inbound_frame_set_settings_entry() argument
5708 nghttp2_frame_unpack_settings_entry(&iv, iframe->sbuf.pos); in inbound_frame_set_settings_entry()
5723 iframe->iv[iframe->niv++] = iv; in inbound_frame_set_settings_entry()
5728 for (i = 0; i < iframe->niv; ++i) { in inbound_frame_set_settings_entry()
5729 if (iframe->iv[i].settings_id == iv.settings_id) { in inbound_frame_set_settings_entry()
5730 iframe->iv[i] = iv; in inbound_frame_set_settings_entry()
5735 if (i == iframe->niv) { in inbound_frame_set_settings_entry()
5736 iframe->iv[iframe->niv++] = iv; in inbound_frame_set_settings_entry()
5741 min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; in inbound_frame_set_settings_entry()
5754 static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe, in inbound_frame_handle_pad() argument
5760 inbound_frame_set_mark(iframe, 1); in inbound_frame_handle_pad()
5771 static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { in inbound_frame_compute_pad() argument
5775 padlen = (size_t)(iframe->sbuf.pos[0] + 1); in inbound_frame_compute_pad()
5780 if (padlen - 1 > iframe->payloadleft) { in inbound_frame_compute_pad()
5784 iframe->padlen = padlen; in inbound_frame_compute_pad()
5795 static ssize_t inbound_frame_effective_readlen(nghttp2_inbound_frame *iframe, in inbound_frame_effective_readlen() argument
5799 nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); in inbound_frame_effective_readlen()
5817 nghttp2_inbound_frame *iframe = &session->iframe; in nghttp2_session_mem_recv() local
5853 switch (iframe->state) { in nghttp2_session_mem_recv()
5855 readlen = nghttp2_min(inlen, iframe->payloadleft); in nghttp2_session_mem_recv()
5858 iframe->payloadleft], in nghttp2_session_mem_recv()
5863 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
5866 if (iframe->payloadleft == 0) { in nghttp2_session_mem_recv()
5868 iframe->state = NGHTTP2_IB_READ_FIRST_SETTINGS; in nghttp2_session_mem_recv()
5875 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
5878 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
5882 if (iframe->sbuf.pos[3] != NGHTTP2_SETTINGS || in nghttp2_session_mem_recv()
5883 (iframe->sbuf.pos[4] & NGHTTP2_FLAG_ACK)) { in nghttp2_session_mem_recv()
5904 iframe->state = NGHTTP2_IB_READ_HEAD; in nghttp2_session_mem_recv()
5912 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
5915 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
5919 nghttp2_frame_unpack_frame_hd(&iframe->frame.hd, iframe->sbuf.pos); in nghttp2_session_mem_recv()
5920 iframe->payloadleft = iframe->frame.hd.length; in nghttp2_session_mem_recv()
5923 iframe->frame.hd.length, iframe->frame.hd.type, in nghttp2_session_mem_recv()
5924 iframe->frame.hd.flags, iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
5926 if (iframe->frame.hd.length > session->local_settings.max_frame_size) { in nghttp2_session_mem_recv()
5927 DEBUGF("recv: length is too large %zu > %u\n", iframe->frame.hd.length, in nghttp2_session_mem_recv()
5940 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
5944 iframe->frame.hd.flags &= in nghttp2_session_mem_recv()
5951 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
5956 iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
5957 iframe->state = NGHTTP2_IB_IGN_DATA; in nghttp2_session_mem_recv()
5965 rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); in nghttp2_session_mem_recv()
5978 iframe->state = NGHTTP2_IB_READ_PAD_DATA; in nghttp2_session_mem_recv()
5982 iframe->state = NGHTTP2_IB_READ_DATA; in nghttp2_session_mem_recv()
5989 iframe->frame.hd.flags &= in nghttp2_session_mem_recv()
5993 rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); in nghttp2_session_mem_recv()
6005 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6009 pri_fieldlen = nghttp2_frame_priority_len(iframe->frame.hd.flags); in nghttp2_session_mem_recv()
6012 if (iframe->payloadleft < pri_fieldlen) { in nghttp2_session_mem_recv()
6014 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6018 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6020 inbound_frame_set_mark(iframe, pri_fieldlen); in nghttp2_session_mem_recv()
6028 rv = session_call_on_begin_frame(session, &iframe->frame.hd); in nghttp2_session_mem_recv()
6043 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6049 session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); in nghttp2_session_mem_recv()
6053 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6058 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6062 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6068 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6070 if (iframe->payloadleft != NGHTTP2_PRIORITY_SPECLEN) { in nghttp2_session_mem_recv()
6073 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6078 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6080 inbound_frame_set_mark(iframe, NGHTTP2_PRIORITY_SPECLEN); in nghttp2_session_mem_recv()
6086 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6096 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6098 if (iframe->payloadleft != 4) { in nghttp2_session_mem_recv()
6100 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6104 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6106 inbound_frame_set_mark(iframe, 4); in nghttp2_session_mem_recv()
6112 iframe->frame.hd.flags &= NGHTTP2_FLAG_ACK; in nghttp2_session_mem_recv()
6114 if ((iframe->frame.hd.length % NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) || in nghttp2_session_mem_recv()
6115 ((iframe->frame.hd.flags & NGHTTP2_FLAG_ACK) && in nghttp2_session_mem_recv()
6116 iframe->payloadleft > 0)) { in nghttp2_session_mem_recv()
6118 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6124 !(iframe->frame.hd.flags & NGHTTP2_FLAG_ACK)) { in nghttp2_session_mem_recv()
6128 iframe->state = NGHTTP2_IB_READ_SETTINGS; in nghttp2_session_mem_recv()
6130 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6135 iframe->max_niv = in nghttp2_session_mem_recv()
6136 iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1; in nghttp2_session_mem_recv()
6138 if (iframe->max_niv - 1 > session->max_settings) { in nghttp2_session_mem_recv()
6148 iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) * in nghttp2_session_mem_recv()
6149 iframe->max_niv); in nghttp2_session_mem_recv()
6151 if (!iframe->iv) { in nghttp2_session_mem_recv()
6155 min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; in nghttp2_session_mem_recv()
6160 inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); in nghttp2_session_mem_recv()
6166 inbound_frame_set_mark(iframe, 0); in nghttp2_session_mem_recv()
6172 iframe->frame.hd.flags &= in nghttp2_session_mem_recv()
6175 rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); in nghttp2_session_mem_recv()
6187 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6191 if (iframe->payloadleft < 4) { in nghttp2_session_mem_recv()
6193 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6197 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6199 inbound_frame_set_mark(iframe, 4); in nghttp2_session_mem_recv()
6205 iframe->frame.hd.flags &= NGHTTP2_FLAG_ACK; in nghttp2_session_mem_recv()
6207 if (iframe->payloadleft != 8) { in nghttp2_session_mem_recv()
6209 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6213 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6214 inbound_frame_set_mark(iframe, 8); in nghttp2_session_mem_recv()
6220 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6222 if (iframe->payloadleft < 8) { in nghttp2_session_mem_recv()
6224 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6228 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6229 inbound_frame_set_mark(iframe, 8); in nghttp2_session_mem_recv()
6248 iframe->frame.hd.type)) { in nghttp2_session_mem_recv()
6254 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6261 iframe->state = NGHTTP2_IB_READ_EXTENSION_PAYLOAD; in nghttp2_session_mem_recv()
6265 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6270 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6276 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6277 iframe->frame.ext.payload = &iframe->ext_frame_payload.altsvc; in nghttp2_session_mem_recv()
6281 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6285 if (iframe->payloadleft < 2) { in nghttp2_session_mem_recv()
6287 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6293 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6294 inbound_frame_set_mark(iframe, 2); in nghttp2_session_mem_recv()
6300 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6306 iframe->frame.ext.payload = &iframe->ext_frame_payload.origin; in nghttp2_session_mem_recv()
6308 if (session->server || iframe->frame.hd.stream_id || in nghttp2_session_mem_recv()
6309 (iframe->frame.hd.flags & 0xf0)) { in nghttp2_session_mem_recv()
6311 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6315 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6317 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6318 iframe->raw_lbuf = nghttp2_mem_malloc(mem, iframe->payloadleft); in nghttp2_session_mem_recv()
6320 if (iframe->raw_lbuf == NULL) { in nghttp2_session_mem_recv()
6324 nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, in nghttp2_session_mem_recv()
6325 iframe->payloadleft); in nghttp2_session_mem_recv()
6330 iframe->state = NGHTTP2_IB_READ_ORIGIN_PAYLOAD; in nghttp2_session_mem_recv()
6337 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6343 iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; in nghttp2_session_mem_recv()
6344 iframe->frame.ext.payload = in nghttp2_session_mem_recv()
6345 &iframe->ext_frame_payload.priority_update; in nghttp2_session_mem_recv()
6357 if (iframe->payloadleft < 4) { in nghttp2_session_mem_recv()
6359 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6364 iframe->payloadleft > sizeof(iframe->raw_sbuf)) { in nghttp2_session_mem_recv()
6366 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6372 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6373 inbound_frame_set_mark(iframe, iframe->payloadleft); in nghttp2_session_mem_recv()
6379 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6387 switch (iframe->state) { in nghttp2_session_mem_recv()
6395 rv = session_call_on_begin_frame(session, &iframe->frame.hd); in nghttp2_session_mem_recv()
6408 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6410 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6413 iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf)); in nghttp2_session_mem_recv()
6415 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6419 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6421 if (iframe->padlen == 0 && in nghttp2_session_mem_recv()
6422 (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { in nghttp2_session_mem_recv()
6423 pri_fieldlen = nghttp2_frame_priority_len(iframe->frame.hd.flags); in nghttp2_session_mem_recv()
6424 padlen = inbound_frame_compute_pad(iframe); in nghttp2_session_mem_recv()
6426 (size_t)padlen + pri_fieldlen > 1 + iframe->payloadleft) { in nghttp2_session_mem_recv()
6434 iframe->frame.headers.padlen = (size_t)padlen; in nghttp2_session_mem_recv()
6437 if (iframe->payloadleft < pri_fieldlen) { in nghttp2_session_mem_recv()
6439 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6442 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6443 inbound_frame_set_mark(iframe, pri_fieldlen); in nghttp2_session_mem_recv()
6447 inbound_frame_set_mark(iframe, 0); in nghttp2_session_mem_recv()
6458 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6464 session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); in nghttp2_session_mem_recv()
6468 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6473 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6477 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6488 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6502 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6510 if (iframe->padlen == 0 && in nghttp2_session_mem_recv()
6511 (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { in nghttp2_session_mem_recv()
6512 padlen = inbound_frame_compute_pad(iframe); in nghttp2_session_mem_recv()
6514 > 1 + iframe->payloadleft) { in nghttp2_session_mem_recv()
6524 iframe->frame.push_promise.padlen = (size_t)padlen; in nghttp2_session_mem_recv()
6526 if (iframe->payloadleft < 4) { in nghttp2_session_mem_recv()
6528 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6532 iframe->state = NGHTTP2_IB_READ_NBYTE; in nghttp2_session_mem_recv()
6534 inbound_frame_set_mark(iframe, 4); in nghttp2_session_mem_recv()
6546 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6552 session, iframe->frame.push_promise.promised_stream_id, in nghttp2_session_mem_recv()
6557 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6562 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6566 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6575 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6586 debuglen = iframe->frame.hd.length - 8; in nghttp2_session_mem_recv()
6589 iframe->raw_lbuf = nghttp2_mem_malloc(mem, debuglen); in nghttp2_session_mem_recv()
6591 if (iframe->raw_lbuf == NULL) { in nghttp2_session_mem_recv()
6595 nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, debuglen); in nghttp2_session_mem_recv()
6600 iframe->state = NGHTTP2_IB_READ_GOAWAY_DEBUG; in nghttp2_session_mem_recv()
6610 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6620 origin_len = nghttp2_get_uint16(iframe->sbuf.pos); in nghttp2_session_mem_recv()
6624 if (origin_len > iframe->payloadleft) { in nghttp2_session_mem_recv()
6626 iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; in nghttp2_session_mem_recv()
6630 if (iframe->frame.hd.length > 2) { in nghttp2_session_mem_recv()
6631 iframe->raw_lbuf = in nghttp2_session_mem_recv()
6632 nghttp2_mem_malloc(mem, iframe->frame.hd.length - 2); in nghttp2_session_mem_recv()
6634 if (iframe->raw_lbuf == NULL) { in nghttp2_session_mem_recv()
6638 nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, in nghttp2_session_mem_recv()
6639 iframe->frame.hd.length); in nghttp2_session_mem_recv()
6644 iframe->state = NGHTTP2_IB_READ_ALTSVC_PAYLOAD; in nghttp2_session_mem_recv()
6649 nghttp2_get_uint32(iframe->sbuf.pos) & NGHTTP2_STREAM_ID_MASK); in nghttp2_session_mem_recv()
6673 if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { in nghttp2_session_mem_recv()
6680 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
6683 iframe->payloadleft - readlen); in nghttp2_session_mem_recv()
6686 iframe, iframe->payloadleft - readlen, readlen); in nghttp2_session_mem_recv()
6693 trail_padlen = nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); in nghttp2_session_mem_recv()
6695 final = (iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) && in nghttp2_session_mem_recv()
6696 iframe->payloadleft - (size_t)data_readlen == trail_padlen; in nghttp2_session_mem_recv()
6704 inflate_header_block(session, &iframe->frame, &hd_proclen, in nghttp2_session_mem_recv()
6706 iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK); in nghttp2_session_mem_recv()
6712 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6718 iframe->payloadleft -= hd_proclen; in nghttp2_session_mem_recv()
6728 iframe->payloadleft -= hd_proclen; in nghttp2_session_mem_recv()
6733 iframe->frame.hd.type == NGHTTP2_PUSH_PROMISE in nghttp2_session_mem_recv()
6734 ? iframe->frame.push_promise.promised_stream_id in nghttp2_session_mem_recv()
6735 : iframe->frame.hd.stream_id, in nghttp2_session_mem_recv()
6741 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6746 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6750 if (iframe->payloadleft == 0) { in nghttp2_session_mem_recv()
6754 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
6760 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6763 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6767 if ((iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) == 0) { in nghttp2_session_mem_recv()
6769 inbound_frame_set_mark(iframe, NGHTTP2_FRAME_HDLEN); in nghttp2_session_mem_recv()
6771 iframe->padlen = 0; in nghttp2_session_mem_recv()
6773 if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { in nghttp2_session_mem_recv()
6774 iframe->state = NGHTTP2_IB_EXPECT_CONTINUATION; in nghttp2_session_mem_recv()
6776 iframe->state = NGHTTP2_IB_IGN_CONTINUATION; in nghttp2_session_mem_recv()
6779 if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { in nghttp2_session_mem_recv()
6794 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
6795 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6799 iframe->payloadleft); in nghttp2_session_mem_recv()
6801 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6805 switch (iframe->frame.hd.type) { in nghttp2_session_mem_recv()
6827 assert(iframe->state == NGHTTP2_IB_IGN_ALL); in nghttp2_session_mem_recv()
6833 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6834 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6838 iframe->payloadleft); in nghttp2_session_mem_recv()
6840 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6845 inbound_frame_set_settings_entry(iframe); in nghttp2_session_mem_recv()
6847 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6848 inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); in nghttp2_session_mem_recv()
6858 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6868 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
6871 iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); in nghttp2_session_mem_recv()
6873 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6878 iframe->payloadleft); in nghttp2_session_mem_recv()
6880 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
6881 assert(nghttp2_buf_avail(&iframe->lbuf) > 0); in nghttp2_session_mem_recv()
6892 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6902 if (iframe->state == NGHTTP2_IB_EXPECT_CONTINUATION) { in nghttp2_session_mem_recv()
6913 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6916 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6920 nghttp2_frame_unpack_frame_hd(&cont_hd, iframe->sbuf.pos); in nghttp2_session_mem_recv()
6921 iframe->payloadleft = cont_hd.length; in nghttp2_session_mem_recv()
6927 cont_hd.stream_id != iframe->frame.hd.stream_id) { in nghttp2_session_mem_recv()
6930 iframe->frame.hd.stream_id, NGHTTP2_CONTINUATION, in nghttp2_session_mem_recv()
6944 iframe->frame.hd.flags = in nghttp2_session_mem_recv()
6945 (uint8_t)(iframe->frame.hd.flags | in nghttp2_session_mem_recv()
6947 iframe->frame.hd.length += cont_hd.length; in nghttp2_session_mem_recv()
6951 if (iframe->state == NGHTTP2_IB_EXPECT_CONTINUATION) { in nghttp2_session_mem_recv()
6952 iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; in nghttp2_session_mem_recv()
6960 iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; in nghttp2_session_mem_recv()
6967 readlen = inbound_frame_buf_read(iframe, in, last); in nghttp2_session_mem_recv()
6969 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
6972 iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf)); in nghttp2_session_mem_recv()
6974 if (nghttp2_buf_mark_avail(&iframe->sbuf)) { in nghttp2_session_mem_recv()
6984 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
6990 nghttp2_session_consume(session, iframe->frame.hd.stream_id, readlen); in nghttp2_session_mem_recv()
6996 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7000 stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
7004 iframe->payloadleft || in nghttp2_session_mem_recv()
7005 (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); in nghttp2_session_mem_recv()
7013 padlen = inbound_frame_compute_pad(iframe); in nghttp2_session_mem_recv()
7023 iframe->frame.data.padlen = (size_t)padlen; in nghttp2_session_mem_recv()
7025 iframe->state = NGHTTP2_IB_READ_DATA; in nghttp2_session_mem_recv()
7029 stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); in nghttp2_session_mem_recv()
7033 iframe->state = NGHTTP2_IB_IGN_DATA; in nghttp2_session_mem_recv()
7039 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7040 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7044 iframe->payloadleft); in nghttp2_session_mem_recv()
7055 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7061 iframe->payloadleft || in nghttp2_session_mem_recv()
7062 (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); in nghttp2_session_mem_recv()
7068 iframe, iframe->payloadleft, readlen); in nghttp2_session_mem_recv()
7079 rv = nghttp2_session_consume(session, iframe->frame.hd.stream_id, in nghttp2_session_mem_recv()
7086 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7105 if (iframe->state == NGHTTP2_IB_IGN_DATA) { in nghttp2_session_mem_recv()
7111 session, iframe->frame.hd.stream_id, NGHTTP2_PROTOCOL_ERROR); in nghttp2_session_mem_recv()
7116 iframe->state = NGHTTP2_IB_IGN_DATA; in nghttp2_session_mem_recv()
7122 session, iframe->frame.hd.flags, iframe->frame.hd.stream_id, in nghttp2_session_mem_recv()
7135 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7150 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7151 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7155 iframe->payloadleft); in nghttp2_session_mem_recv()
7166 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7179 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()
7185 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7197 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7198 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7202 iframe->payloadleft); in nghttp2_session_mem_recv()
7214 iframe->state = NGHTTP2_IB_IGN_PAYLOAD; in nghttp2_session_mem_recv()
7220 if (iframe->payloadleft > 0) { in nghttp2_session_mem_recv()
7235 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7237 iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); in nghttp2_session_mem_recv()
7239 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7244 iframe->payloadleft); in nghttp2_session_mem_recv()
7246 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7247 assert(nghttp2_buf_avail(&iframe->lbuf) > 0); in nghttp2_session_mem_recv()
7263 readlen = inbound_frame_payload_readlen(iframe, in, last); in nghttp2_session_mem_recv()
7266 iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); in nghttp2_session_mem_recv()
7268 iframe->payloadleft -= readlen; in nghttp2_session_mem_recv()
7273 iframe->payloadleft); in nghttp2_session_mem_recv()
7275 if (iframe->payloadleft) { in nghttp2_session_mem_recv()
7276 assert(nghttp2_buf_avail(&iframe->lbuf) > 0); in nghttp2_session_mem_recv()
7287 if (iframe->state == NGHTTP2_IB_IGN_ALL) { in nghttp2_session_mem_recv()