Lines Matching refs:r

323 h2_send_rst_stream_state (request_st * const r, h2con * const h2c)  in h2_send_rst_stream_state()  argument
325 if (r->h2state != H2_STATE_HALF_CLOSED_REMOTE in h2_send_rst_stream_state()
326 && r->h2state != H2_STATE_CLOSED) { in h2_send_rst_stream_state()
330 r->state = CON_STATE_ERROR; in h2_send_rst_stream_state()
331 r->h2state = H2_STATE_CLOSED; in h2_send_rst_stream_state()
337 h2_send_rst_stream (request_st * const r, connection * const con, const request_h2error_t e) in h2_send_rst_stream() argument
339 h2_send_rst_stream_state(r, con->h2);/*(sets r->h2state = H2_STATE_CLOSED)*/ in h2_send_rst_stream()
340 h2_send_rst_stream_id(r->h2id, con, e); in h2_send_rst_stream()
351 request_st * const r = h2c->r[i]; in h2_send_goaway_rst_stream() local
352 if (r->h2state == H2_STATE_CLOSED) continue; in h2_send_goaway_rst_stream()
353 h2_send_rst_stream_state(r, h2c);/*(sets r->h2state = H2_STATE_CLOSED)*/ in h2_send_goaway_rst_stream()
356 h2_send_rst_stream_id(r->h2id, con, H2_E_PROTOCOL_ERROR); in h2_send_goaway_rst_stream()
431 const request_st * const r = h2c->r[i]; in h2_send_refused_stream() local
432 if (r->reqbody_length == r->reqbody_queue.bytes_in) { in h2_send_refused_stream()
511 request_st * const r = h2c->r[i]; in h2_recv_rst_stream() local
512 if (r->h2id != id) continue; in h2_recv_rst_stream()
513 if (r->h2state == H2_STATE_IDLE) { in h2_recv_rst_stream()
519 r->state = CON_STATE_ERROR; in h2_recv_rst_stream()
520 r->h2state = H2_STATE_CLOSED; in h2_recv_rst_stream()
580 h2_apply_priority_update (h2con * const h2c, const request_st * const r, const uint32_t rpos) in h2_apply_priority_update() argument
582 const request_st ** const rr = (const request_st **)h2c->r; in h2_apply_priority_update()
585 && (rr[npos-1]->h2_prio > r->h2_prio in h2_apply_priority_update()
586 || (rr[npos-1]->h2_prio == r->h2_prio in h2_apply_priority_update()
587 && rr[npos-1]->h2id > r->h2id))) in h2_apply_priority_update()
594 && (rr[npos+1]->h2_prio < r->h2_prio in h2_apply_priority_update()
595 || (rr[npos+1]->h2_prio == r->h2_prio in h2_apply_priority_update()
596 && rr[npos+1]->h2id < r->h2id))) in h2_apply_priority_update()
602 rr[npos] = r; in h2_apply_priority_update()
673 request_st * const r = h2c->r[i]; in h2_recv_priority_update() local
674 if (r->h2id != prid) continue; in h2_recv_priority_update()
676 if (r->h2_prio != prio) { in h2_recv_priority_update()
677 r->h2_prio = prio; in h2_recv_priority_update()
678 h2_apply_priority_update(h2c, r, i); in h2_recv_priority_update()
728 request_st * const r = h2c->r[i]; in h2_recv_priority() local
729 if (r->h2id != id) continue; in h2_recv_priority()
732 h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR); in h2_recv_priority()
736 else if (r->h2_prio != weight) { in h2_recv_priority()
737 r->h2_prio = weight; in h2_recv_priority()
738 h2_apply_priority_update(h2c, r, i); in h2_recv_priority()
763 request_st *r = NULL; in h2_recv_window_update() local
765 r = &con->request; in h2_recv_window_update()
769 request_st * const rr = h2c->r[i]; in h2_recv_window_update()
771 r = rr; in h2_recv_window_update()
779 if (NULL == r) { in h2_recv_window_update()
794 if (r->h2state == H2_STATE_CLOSED in h2_recv_window_update()
795 || r->h2state == H2_STATE_HALF_CLOSED_LOCAL) return; in h2_recv_window_update()
797 if (0 == v || r->h2_swin > INT32_MAX - v) { in h2_recv_window_update()
804 h2_send_rst_stream(r, con, e); in h2_recv_window_update()
807 r->h2_swin += v; in h2_recv_window_update()
837 h2_send_window_update_unit (connection * const con, request_st * const r, const uint32_t len) in h2_send_window_update_unit() argument
839 r->h2_rwin_fudge -= (int16_t)len; in h2_send_window_update_unit()
840 if (r->h2_rwin_fudge < 0) { in h2_send_window_update_unit()
841 r->h2_rwin_fudge += 16384; in h2_send_window_update_unit()
842 h2_send_window_update(con, r->h2id, 16384); /*(r->h2_rwin)*/ in h2_send_window_update_unit()
889 request_st * const r = h2c->r[i]; in h2_parse_frame_settings() local
890 const int32_t swin = r->h2_swin; in h2_parse_frame_settings()
891 if (r->h2state == H2_STATE_HALF_CLOSED_LOCAL in h2_parse_frame_settings()
892 || r->h2state == H2_STATE_CLOSED) continue; in h2_parse_frame_settings()
896 h2_send_rst_stream(r, con, H2_E_FLOW_CONTROL_ERROR); in h2_parse_frame_settings()
899 r->h2_swin += diff; in h2_parse_frame_settings()
962 h2_recv_end_data (request_st * const r, connection * const con, const uint32_t alen) in h2_recv_end_data() argument
964 chunkqueue * const reqbody_queue = &r->reqbody_queue; in h2_recv_end_data()
965 r->h2state = (r->h2state == H2_STATE_OPEN) in h2_recv_end_data()
968 if (r->reqbody_length == -1) in h2_recv_end_data()
969 r->reqbody_length = reqbody_queue->bytes_in + (off_t)alen; in h2_recv_end_data()
970 else if (r->reqbody_length != reqbody_queue->bytes_in + (off_t)alen) { in h2_recv_end_data()
972 h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR); in h2_recv_end_data()
1022 request_st *r = NULL; in h2_recv_data() local
1024 request_st * const rr = h2c->r[i]; in h2_recv_data()
1026 r = rr; in h2_recv_data()
1030 if (NULL == r) { in h2_recv_data()
1054 if (r->h2state == H2_STATE_CLOSED in h2_recv_data()
1055 || r->h2state == H2_STATE_HALF_CLOSED_REMOTE) { in h2_recv_data()
1062 if (r->h2_rwin <= 0 && 0 != alen) {/*(always proceed if 0==alen)*/ in h2_recv_data()
1065 if (r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_BUFMIN) { in h2_recv_data()
1085 chunkqueue * const dst = &r->reqbody_queue; in h2_recv_data()
1087 if (r->reqbody_length >= 0 && r->reqbody_length < dst->bytes_in + alen) { in h2_recv_data()
1090 alen = r->reqbody_length - dst->bytes_in; in h2_recv_data()
1093 h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR); in h2_recv_data()
1100 chunkqueue * const rq = &r->read_queue; in h2_recv_data()
1106 if (!h2_recv_end_data(r, con, alen)) { in h2_recv_data()
1113 else if (0 == r->conf.max_request_size) in h2_recv_data()
1117 const off_t max_request_size = (off_t)r->conf.max_request_size << 10; in h2_recv_data()
1119 int32_t rwin = r->h2_rwin - (int32_t)len; in h2_recv_data()
1123 else if (-n > 65536 || 0 == r->http_status) { in h2_recv_data()
1124 if (0 == r->http_status) { in h2_recv_data()
1125 r->http_status = 413; /* Payload Too Large */ in h2_recv_data()
1126 r->handler_module = NULL; in h2_recv_data()
1127 log_error(r->conf.errh, __FILE__, __LINE__, in h2_recv_data()
1155 h2_send_window_update_unit(con, r, wupd); in h2_recv_data()
1175 log_error_st * const errh = r->conf.errh; in h2_recv_data()
1177 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_recv_data()
1352 request_st *r = NULL; in h2_recv_trailers_r() local
1354 request_st * const rr = h2c->r[i]; in h2_recv_trailers_r()
1356 r = rr; in h2_recv_trailers_r()
1359 if (NULL == r) { in h2_recv_trailers_r()
1363 if (r->h2state != H2_STATE_OPEN in h2_recv_trailers_r()
1364 && r->h2state != H2_STATE_HALF_CLOSED_LOCAL) { in h2_recv_trailers_r()
1365 h2_send_rst_stream(r, con, H2_E_STREAM_CLOSED); in h2_recv_trailers_r()
1373 h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR); in h2_recv_trailers_r()
1377 return h2_recv_end_data(r, con, 0) ? r : NULL; in h2_recv_trailers_r()
1382 h2_parse_headers_frame (request_st * const restrict r, const unsigned char *psrc, const uint32_t pl… in h2_parse_headers_frame() argument
1384 h2con * const h2c = r->con->h2; in h2_parse_headers_frame()
1392 hpctx.max_request_field_size = r->conf.max_request_field_size; in h2_parse_headers_frame()
1393 hpctx.http_parseopts = r->conf.http_parseopts; in h2_parse_headers_frame()
1394 const int log_request_header = r->conf.log_request_header; in h2_parse_headers_frame()
1399 buffer * const tb = r->tmp_buf; in h2_parse_headers_frame()
1430 log_error(r->conf.errh, __FILE__, __LINE__, in h2_parse_headers_frame()
1431 "fd:%d id:%u rqst: %.*s: %.*s", r->con->fd, r->h2id, in h2_parse_headers_frame()
1434 const int http_status = http_request_parse_header(r, &hpctx); in h2_parse_headers_frame()
1436 if (r->http_status == 0) /*might be set if processing trailers*/ in h2_parse_headers_frame()
1437 r->http_status = http_status; in h2_parse_headers_frame()
1448 r->http_status = 431; /* Request Header Fields Too Large */ in h2_parse_headers_frame()
1450 r->h2_rwin = 0; /*(out-of-sync with peer, but is error case)*/ in h2_parse_headers_frame()
1467 h2_send_rst_stream(r, r->con, err); in h2_parse_headers_frame()
1470 h2c->h2_cid = r->h2id; in h2_parse_headers_frame()
1471 h2_send_goaway_e(r->con, err); in h2_parse_headers_frame()
1473 h2_retire_stream(r, r->con); in h2_parse_headers_frame()
1477 r->state = CON_STATE_ERROR; in h2_parse_headers_frame()
1478 r->h2state = H2_STATE_CLOSED; in h2_parse_headers_frame()
1485 r->rqst_header_len += hpctx.hlen; in h2_parse_headers_frame()
1487 chunkqueue * const rq = &r->read_queue; in h2_parse_headers_frame()
1491 if (0 == r->http_status && LSHPACK_OK == rc && !trailers) { in h2_parse_headers_frame()
1493 r->http_status = in h2_parse_headers_frame()
1494 http_request_validate_pseudohdrs(r, hpctx.scheme, in h2_parse_headers_frame()
1496 if (0 == r->http_status) in h2_parse_headers_frame()
1497 http_request_headers_process_h2(r, r->con->proto_default_port); in h2_parse_headers_frame()
1512 request_st *r = NULL; in h2_recv_headers() local
1530 if (h2c->rused == sizeof(h2c->r)/sizeof(*h2c->r)) in h2_recv_headers()
1539 r = h2_init_stream(h2r, con); in h2_recv_headers()
1540 r->h2id = id; in h2_recv_headers()
1541 r->h2state = (s[4] & H2_FLAG_END_STREAM) in h2_recv_headers()
1544 r->state = CON_STATE_REQUEST_END; in h2_recv_headers()
1556 r->start_hp.tv_sec = log_epoch_secs; in h2_recv_headers()
1557 if (r->conf.high_precision_timestamps) in h2_recv_headers()
1558 log_clock_gettime_realtime(&r->start_hp); in h2_recv_headers()
1561 r = h2_recv_trailers_r(con, h2c, id, s[4]); /* (cold code path) */ in h2_recv_headers()
1562 if (NULL == r) in h2_recv_headers()
1577 h2_retire_stream(r, con); in h2_recv_headers()
1579 r->state = CON_STATE_ERROR; in h2_recv_headers()
1580 r->h2state = H2_STATE_CLOSED; in h2_recv_headers()
1589 h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR); in h2_recv_headers()
1591 h2_retire_stream(r, con); in h2_recv_headers()
1600 r->h2_prio = ((weight < 8 ? weight : 7) << 1) | !0; in h2_recv_headers()
1606 h2_parse_headers_frame(r, psrc, alen, trailers); in h2_recv_headers()
1622 r->http_status = 0; in h2_recv_headers()
1623 h2_retire_stream(r, con); in h2_recv_headers()
1629 if (!light_btst(r->rqst_htags, HTTP_HEADER_CONTENT_LENGTH)) in h2_recv_headers()
1630 r->reqbody_length = (s[4] & H2_FLAG_END_STREAM) ? 0 : -1; in h2_recv_headers()
1632 else if (r->reqbody_length > 0 && (s[4] & H2_FLAG_END_STREAM)) { in h2_recv_headers()
1635 r->http_status = 400; /* Bad Request */ in h2_recv_headers()
1640 if (r->reqbody_length /*(see h2_init_con() for session window)*/ in h2_recv_headers()
1641 && !(r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_BUFMIN)) in h2_recv_headers()
1644 if (light_btst(r->rqst_htags, HTTP_HEADER_PRIORITY)) { in h2_recv_headers()
1646 http_header_request_get(r, HTTP_HEADER_PRIORITY, in h2_recv_headers()
1648 r->h2_prio = h2_parse_priority_update(BUF_PTR_LEN(prio)); in h2_recv_headers()
1655 r->h2_prio = x; in h2_recv_headers()
1660 const uint32_t len = buffer_clen(&r->target); in h2_recv_headers()
1661 const char * const p = r->target.ptr+len-4; in h2_recv_headers()
1663 r->h2_prio = (2 << 1) | !0; /*(urgency=2, incremental=0)*/ in h2_recv_headers()
1664 http_header_response_set(r, HTTP_HEADER_PRIORITY, in h2_recv_headers()
1671 h2_apply_priority_update(h2c, r, h2c->rused-1); in h2_recv_headers()
1686 if (__builtin_expect( (400 == r->http_status), 0)) { in h2_recv_headers()
1687 h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR); in h2_recv_headers()
1688 h2_retire_stream(r, con); in h2_recv_headers()
1698 r->http_status = 0; in h2_recv_headers()
1699 h2_retire_stream(r, con); in h2_recv_headers()
2028 h2_send_hpack (request_st * const r, connection * const con, const char *data, uint32_t dlen, const… in h2_send_hpack() argument
2042 headers.u[2] = htonl(r->h2id); in h2_send_hpack()
2050 ++r->h2state; in h2_send_hpack()
2052 r->h2state = (r->h2state == H2_STATE_HALF_CLOSED_REMOTE) in h2_send_hpack()
2103 h2_log_response_header_lsx(request_st * const r, const lsxpack_header_t * const lsx) in h2_log_response_header_lsx() argument
2105 log_error(r->conf.errh, __FILE__, __LINE__, in h2_log_response_header_lsx()
2106 "fd:%d id:%u resp: %.*s: %.*s", r->con->fd, r->h2id, in h2_log_response_header_lsx()
2114 h2_log_response_header(request_st * const r, const int len, const char * const hdr) in h2_log_response_header() argument
2116 log_error(r->conf.errh, __FILE__, __LINE__, in h2_log_response_header()
2117 "fd:%d id:%u resp: %.*s", r->con->fd, r->h2id, len, hdr); in h2_log_response_header()
2122 h2_send_headers (request_st * const r, connection * const con) in h2_send_headers() argument
2126 con->keep_alive_idle = r->conf.max_keep_alive_idle; in h2_send_headers()
2131 if (304 == r->http_status in h2_send_headers()
2132 && light_btst(r->resp_htags, HTTP_HEADER_CONTENT_ENCODING)) in h2_send_headers()
2133 http_header_response_unset(r, HTTP_HEADER_CONTENT_ENCODING, in h2_send_headers()
2137 buffer * const tb = r->tmp_buf; in h2_send_headers()
2146 const int log_response_header = r->conf.log_response_header; in h2_send_headers()
2147 const int resp_header_repeated = r->resp_header_repeated; in h2_send_headers()
2157 if (__builtin_expect( (200 == r->http_status), 1)) { in h2_send_headers()
2161 int x = r->http_status; /*(expect status < 1000; should be [100-599])*/ in h2_send_headers()
2182 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers()
2187 h2_log_response_header(r, 12, status); in h2_send_headers()
2191 (data_string * const *)r->resp_headers.data; in h2_send_headers()
2192 for (uint32_t i = 0, used = r->resp_headers.used; i < used; ++i) { in h2_send_headers()
2205 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers()
2223 if ((k[0] & 0xdf) == 'X' && http_response_omit_header(r, ds)) { in h2_send_headers()
2256 h2_log_response_header_lsx(r, &lsx); in h2_send_headers()
2261 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers()
2267 if (!light_btst(r->resp_htags, HTTP_HEADER_DATE)) { in h2_send_headers()
2289 h2_log_response_header(r, 35, tstr); in h2_send_headers()
2294 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers()
2299 if (!light_btst(r->resp_htags, HTTP_HEADER_SERVER) && r->conf.server_tag) { in h2_send_headers()
2301 const uint32_t vlen = buffer_clen(r->conf.server_tag); in h2_send_headers()
2306 lsx.buf = r->conf.server_tag->ptr; in h2_send_headers()
2314 h2_log_response_header_lsx(r, &lsx); in h2_send_headers()
2319 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers()
2325 r->resp_header_len = alen; in h2_send_headers()
2327 chunkqueue * const wq = &r->write_queue; in h2_send_headers()
2333 (r->resp_body_finished && chunkqueue_is_empty(&r->write_queue)) in h2_send_headers()
2336 h2_send_hpack(r, con, tb->ptr, dlen, flags); in h2_send_headers()
2343 h2_send_headers_block (request_st * const r, connection * const con, const char * const hdrs, const… in h2_send_headers_block() argument
2353 log_error(r->conf.errh, __FILE__, __LINE__, in h2_send_headers_block()
2363 buffer * const tb = r->tmp_buf; in h2_send_headers_block()
2386 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers_block()
2424 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_headers_block()
2429 h2_send_hpack(r, con, tb->ptr, dlen, flags); in h2_send_headers_block()
2434 h2_send_1xx_block (request_st * const r, connection * const con, const char * const hdrs, const uin… in h2_send_1xx_block() argument
2436 h2_send_headers_block(r, con, hdrs, hlen, 0); in h2_send_1xx_block()
2441 h2_send_1xx (request_st * const r, connection * const con) in h2_send_1xx() argument
2446 buffer_append_int(b, r->http_status); in h2_send_1xx()
2447 for (uint32_t i = 0; i < r->resp_headers.used; ++i) { in h2_send_1xx()
2448 const data_string * const ds = (data_string *)r->resp_headers.data[i]; in h2_send_1xx()
2457 h2_send_1xx_block(r, con, BUF_PTR_LEN(b)); in h2_send_1xx()
2465 h2_send_100_continue (request_st * const r, connection * const con) in h2_send_100_continue() argument
2478 h2_send_1xx_block(r, con, CONST_STR_LEN(":status: 100\r\n\r\n")); in h2_send_100_continue()
2483 h2_send_end_stream_data (request_st * const r, connection * const con);
2488 h2_send_end_stream_trailers (request_st * const r, connection * const con, const buffer * const tra… in h2_send_end_stream_trailers() argument
2503 h2_send_end_stream_data(r, con); in h2_send_end_stream_trailers()
2512 h2_send_end_stream_data(r, con); in h2_send_end_stream_trailers()
2522 h2_send_headers_block(r, con, BUF_PTR_LEN(trailers), H2_FLAG_END_STREAM); in h2_send_end_stream_trailers()
2528 h2_send_cqheaders (request_st * const r, connection * const con)
2534 chunk * const c = r->write_queue.first;
2536 uint32_t flags = (r->resp_body_finished && NULL == c->next)
2539 h2_send_headers_block(r, con, c->mem->ptr + c->offset, len, flags);
2540 chunkqueue_mark_written(&r->write_queue, len);
2548 h2_send_data (request_st * const r, connection * const con, const char *data, uint32_t dlen)
2564 dataframe.u[2] = htonl(r->h2id);
2572 if (r->h2_swin < 0) return 0;
2574 if ((int32_t)dlen > r->h2_swin) dlen = (uint32_t)r->h2_swin;
2577 r->h2_swin -= (int32_t)dlen;
2622 h2_send_cqdata (request_st * const r, connection * const con, chunkqueue * const cq, uint32_t dlen) in h2_send_cqdata() argument
2638 dataframe.u[2] = htonl(r->h2id); in h2_send_cqdata()
2646 if (r->h2_swin < 0) return 0; in h2_send_cqdata()
2648 if ((int32_t)dlen > r->h2_swin) dlen = (uint32_t)r->h2_swin; in h2_send_cqdata()
2681 if (0 == chunkqueue_peek_data(cq, &data, &blen, r->conf.errh) in h2_send_cqdata()
2711 r->h2_swin -= (int32_t)sent; in h2_send_cqdata()
2719 h2_send_end_stream_data (request_st * const r, connection * const con) in h2_send_end_stream_data() argument
2721 if (r->h2state != H2_STATE_HALF_CLOSED_LOCAL) { in h2_send_end_stream_data()
2734 dataframe.u[2] = htonl(r->h2id); in h2_send_end_stream_data()
2740 if (r->h2state != H2_STATE_HALF_CLOSED_REMOTE) { in h2_send_end_stream_data()
2745 h2_send_rst_stream_id(r->h2id, con, H2_E_NO_ERROR); in h2_send_end_stream_data()
2747 r->h2state = H2_STATE_CLOSED; in h2_send_end_stream_data()
2752 h2_send_end_stream (request_st * const r, connection * const con) in h2_send_end_stream() argument
2754 if (r->h2state == H2_STATE_CLOSED) return; in h2_send_end_stream()
2755 if (r->state != CON_STATE_ERROR && r->resp_body_finished) { in h2_send_end_stream()
2757 if (r->gw_dechunk && r->gw_dechunk->done in h2_send_end_stream()
2758 && !buffer_is_unset(&r->gw_dechunk->b)) in h2_send_end_stream()
2759 h2_send_end_stream_trailers(r, con, &r->gw_dechunk->b); in h2_send_end_stream()
2761 h2_send_end_stream_data(r, con); in h2_send_end_stream()
2764 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_send_end_stream()
2784 force_assert(h2c->rused < sizeof(h2c->r)/sizeof(*h2c->r)); in h2_init_stream()
2786 request_st * const r = request_acquire(con); in h2_init_stream() local
2789 h2c->r[h2c->rused++] = r; in h2_init_stream()
2790 r->h2_rwin = 65536; /* must keep in sync with h2_init_con() */ in h2_init_stream()
2791 r->h2_swin = h2c->s_initial_window_size; in h2_init_stream()
2792 r->h2_rwin_fudge = 0; in h2_init_stream()
2796 r->h2_prio = (3 << 1) | !0; /*(default urgency=3, incremental=0)*/ in h2_init_stream()
2797 r->http_version = HTTP_VERSION_2; in h2_init_stream()
2802 r->conditional_is_valid = h2r->conditional_is_valid; in h2_init_stream()
2803 memcpy(r->cond_cache, h2r->cond_cache, used * sizeof(cond_cache_t)); in h2_init_stream()
2806 memcpy(r->cond_match, h2r->cond_match, in h2_init_stream()
2810 r->server_name = h2r->server_name; in h2_init_stream()
2811 memcpy(&r->conf, &h2r->conf, sizeof(request_config)); in h2_init_stream()
2814 return r; in h2_init_stream()
2819 h2_release_stream (request_st * const r, connection * const con) in h2_release_stream() argument
2821 if (r->http_status) { in h2_release_stream()
2823 plugins_call_handle_request_done(r); in h2_release_stream()
2833 con->read_queue->bytes_in -= r->read_queue.bytes_in; in h2_release_stream()
2834 con->write_queue->bytes_out -= r->write_queue.bytes_out; in h2_release_stream()
2840 request_release(r); in h2_release_stream()
2845 h2_retire_stream (request_st *r, connection * const con) in h2_retire_stream() argument
2847 if (r == NULL) return; /*(should not happen)*/ in h2_retire_stream()
2849 request_st ** const ar = h2c->r; in h2_retire_stream()
2851 while (i < rused && ar[i] != r) ++i; in h2_retire_stream()
2857 h2c->r[(h2c->rused = rused)] = NULL; in h2_retire_stream()
2858 h2_release_stream(r, con); in h2_retire_stream()
2874 request_st * const r = h2c->r[i]; in h2_retire_con() local
2875 h2_send_rst_stream(r, con, H2_E_INTERNAL_ERROR); in h2_retire_con()
2876 h2_release_stream(r, con); in h2_retire_con()
2897 request_st * const r = h2c->r[i]; in h2_retire_con() local
2898 h2_release_stream(r, con); in h2_retire_con()
2945 request_st * const r = h2_init_stream(h2r, con); in h2_con_upgrade_h2c() local
2948 r->state = CON_STATE_REQUEST_END; in h2_con_upgrade_h2c()
2949 r->http_status = 0; in h2_con_upgrade_h2c()
2950 r->http_method = h2r->http_method; in h2_con_upgrade_h2c()
2951 r->h2state = H2_STATE_HALF_CLOSED_REMOTE; in h2_con_upgrade_h2c()
2952 r->h2id = 1; in h2_con_upgrade_h2c()
2953 r->rqst_htags = h2r->rqst_htags; in h2_con_upgrade_h2c()
2955 r->rqst_header_len = h2r->rqst_header_len; in h2_con_upgrade_h2c()
2957 r->rqst_headers = h2r->rqst_headers; /* copy struct */ in h2_con_upgrade_h2c()
2959 r->uri = h2r->uri; /* copy struct */ in h2_con_upgrade_h2c()
2961 r->physical = h2r->physical; /* copy struct */ in h2_con_upgrade_h2c()
2962 r->env = h2r->env; /* copy struct */ in h2_con_upgrade_h2c()
2971 r->reqbody_length = h2r->reqbody_length; /* currently always 0 */ in h2_con_upgrade_h2c()
2972 r->te_chunked = h2r->te_chunked; /* must be 0 */ in h2_con_upgrade_h2c()
2973 r->resp_body_scratchpad = h2r->resp_body_scratchpad; /*(not started yet)*/ in h2_con_upgrade_h2c()
2974 swap(&r->reqbody_queue,&h2r->reqbody_queue);/*currently always empty queue*/ in h2_con_upgrade_h2c()
2976 r->http_host = h2r->http_host; in h2_con_upgrade_h2c()
2979 r->server_name = h2r->server_name; in h2_con_upgrade_h2c()
2982 r->target = h2r->target; /* copy struct */ in h2_con_upgrade_h2c()
2983 r->target_orig = h2r->target_orig; /* copy struct */ in h2_con_upgrade_h2c()
2985 r->pathinfo = h2r->pathinfo; /* copy struct */ in h2_con_upgrade_h2c()
2986 r->server_name_buf = h2r->server_name_buf; /* copy struct */ in h2_con_upgrade_h2c()
3002 r->loops_per_request = h2r->loops_per_request; in h2_con_upgrade_h2c()
3003 r->async_callback = h2r->async_callback; in h2_con_upgrade_h2c()
3005 r->keep_alive = h2r->keep_alive; in h2_con_upgrade_h2c()
3006 r->tmp_buf = h2r->tmp_buf; /* shared; same as srv->tmp_buf */ in h2_con_upgrade_h2c()
3007 r->start_hp = h2r->start_hp; /* copy struct */ in h2_con_upgrade_h2c()
3017 h2_check_con_upgrade_h2c (request_st * const r) in h2_check_con_upgrade_h2c() argument
3022 buffer *upgrade = http_header_request_get(r, HTTP_HEADER_UPGRADE, in h2_check_con_upgrade_h2c()
3025 http_connection = http_header_request_get(r, HTTP_HEADER_CONNECTION, in h2_check_con_upgrade_h2c()
3028 http_header_request_unset(r, HTTP_HEADER_UPGRADE, in h2_check_con_upgrade_h2c()
3032 if (r->http_version != HTTP_VERSION_1_1) { in h2_check_con_upgrade_h2c()
3033 http_header_request_unset(r, HTTP_HEADER_UPGRADE, in h2_check_con_upgrade_h2c()
3043 http2_settings = http_header_request_get(r, HTTP_HEADER_HTTP2_SETTINGS, in h2_check_con_upgrade_h2c()
3046 if (0 == r->reqbody_length) { in h2_check_con_upgrade_h2c()
3047 buffer * const b = r->tmp_buf; in h2_check_con_upgrade_h2c()
3049 if (r->conf.h2proto > 1/*(must be enabled with server.h2c feature)*/ in h2_check_con_upgrade_h2c()
3050 && !r->con->is_ssl_sock /*(disallow h2c over TLS socket)*/ in h2_check_con_upgrade_h2c()
3056 h2_con_upgrade_h2c(r, b); in h2_check_con_upgrade_h2c()
3057 r->http_version = HTTP_VERSION_2; in h2_check_con_upgrade_h2c()
3066 http_header_request_unset(r, HTTP_HEADER_HTTP2_SETTINGS, in h2_check_con_upgrade_h2c()
3070 http_header_request_unset(r, HTTP_HEADER_UPGRADE, in h2_check_con_upgrade_h2c()
3073 return (r->http_version == HTTP_VERSION_2); in h2_check_con_upgrade_h2c()