Lines Matching refs:h2n
136 wsi->h2.h2n->our_set = wsi->a.vhost->h2.set;
137 wsi->h2.h2n->peer_set = lws_h2_defaults;
220 struct lws_h2_netconn *h2n = nwsi->h2.h2n;
237 if (sid <= h2n->highest_sid_opened) {
239 sid, (int)h2n->highest_sid_opened);
246 parent_wsi->h2.h2n->our_set.s[H2SET_MAX_CONCURRENT_STREAMS]) {
275 h2n->highest_sid_opened = sid;
278 if (sid >= h2n->highest_sid)
279 h2n->highest_sid = sid + 2;
284 wsi->txc.tx_cr = (int32_t)nwsi->h2.h2n->peer_set.s[H2SET_INITIAL_WINDOW_SIZE];
286 (int32_t)nwsi->h2.h2n->our_set.s[H2SET_INITIAL_WINDOW_SIZE];
332 parent_wsi->h2.h2n->our_set.s[H2SET_MAX_CONCURRENT_STREAMS]) {
348 wsi->mux.my_sid = nwsi->h2.h2n->highest_sid;
349 nwsi->h2.h2n->highest_sid += 2;
354 lws_wsi_tag(wsi), (int)wsi->mux.my_sid, (int)nwsi->h2.h2n->highest_sid);
358 wsi->txc.tx_cr = (int32_t)nwsi->h2.h2n->peer_set.s[H2SET_INITIAL_WINDOW_SIZE];
360 nwsi->h2.h2n->our_set.s[H2SET_INITIAL_WINDOW_SIZE];
391 struct lws_h2_netconn *h2n = wsi->h2.h2n;
394 if (!h2n) {
395 lwsl_warn("%s: no valid h2n\n", __func__);
399 if (h2n->sent_preface)
408 h2n->sent_preface = 1;
413 h2n->count = 0;
432 struct lws_h2_netconn *h2n = nwsi->h2.h2n;
434 if (!h2n) {
435 lwsl_warn("%s: null h2n\n", __func__);
440 pps->next = h2n->pps;
441 h2n->pps = pps;
450 struct lws_h2_netconn *h2n = wsi->h2.h2n;
453 if (h2n->type == LWS_H2_FRAME_TYPE_COUNT)
463 pps->u.ga.highest_sid = h2n->highest_sid;
467 h2n->type = LWS_H2_FRAME_TYPE_COUNT; /* ie, IGNORE */
476 struct lws_h2_netconn *h2n = nwsi->h2.h2n;
479 if (!h2n)
482 if (!wsi->h2_stream_carries_ws && h2n->type == LWS_H2_FRAME_TYPE_COUNT)
497 h2n->type = LWS_H2_FRAME_TYPE_COUNT; /* ie, IGNORE */
712 *buf++ = (uint8_t)(wsi->h2.h2n->our_set.s[n] >> 24);
713 *buf++ = (uint8_t)(wsi->h2.h2n->our_set.s[n] >> 16);
714 *buf++ = (uint8_t)(wsi->h2.h2n->our_set.s[n] >> 8);
715 *buf = (uint8_t)wsi->h2.h2n->our_set.s[n];
722 struct lws_h2_netconn *h2n = wsi->h2.h2n;
728 if (!h2n)
733 lws_start_foreach_llp(struct lws_h2_protocol_send **, pps1, h2n->pps) {
755 if (h2n->our_set.s[n] != lws_h2_defaults.s[n]) {
758 wsi->h2.h2n->our_set.s[n]);
761 m += (int)sizeof(h2n->one_setting);
824 h2n->swsi = __lws_wsi_server_new(wsi->a.vhost, wsi, 1);
829 if (!h2n->swsi)
833 h2n->swsi->http.ah = wsi->http.ah;
837 h2n->swsi->http.ah);
838 h2n->swsi->txc.tx_cr = (int32_t)
839 h2n->our_set.s[H2SET_INITIAL_WINDOW_SIZE];
841 lws_wsi_tag(h2n->swsi),
842 (int)h2n->swsi->txc.tx_cr);
843 h2n->swsi->h2.initialized = 1;
845 h2n->swsi->h2.END_STREAM = 1;
849 if (lws_http_action(h2n->swsi))
892 h2n->we_told_goaway = 1;
966 struct lws_h2_netconn *h2n = wsi->h2.h2n;
973 h2n->count = 0;
974 h2n->swsi = wsi;
976 h2n->sid = h2n->sid & 0x7fffffff;
978 if (h2n->sid && !(h2n->sid & 1)) {
980 lws_snprintf(pes, sizeof(pes), "Even Stream ID 0x%x", (unsigned int)h2n->sid);
993 if (h2n->sid)
994 h2n->swsi = lws_wsi_mux_from_id(wsi, h2n->sid);
997 lws_wsi_tag(wsi), lws_wsi_tag(h2n->swsi), h2n->type,
998 h2n->flags, (unsigned int)h2n->sid, (unsigned int)h2n->length);
1000 if (h2n->we_told_goaway && h2n->sid > h2n->highest_sid)
1001 h2n->type = LWS_H2_FRAME_TYPE_COUNT; /* ie, IGNORE */
1003 if (h2n->type >= LWS_H2_FRAME_TYPE_COUNT) {
1004 lwsl_info("%s: ignoring unknown frame type %d (len %d)\n", __func__, h2n->type, (unsigned int)h2n->length);
1006 h2n->type = LWS_H2_FRAME_TYPE_COUNT;
1014 if (h2n->length > h2n->our_set.s[H2SET_MAX_FRAME_SIZE]) {
1020 (unsigned int)h2n->length);
1026 if (h2n->swsi)
1028 __func__, lws_wsi_tag(h2n->swsi),
1029 h2_state_names[h2n->swsi->h2.h2_state], h2n->type);
1032 if (h2n->type == LWS_H2_FRAME_TYPE_DATA) {
1033 if (h2n->sid <= h2n->highest_sid_opened
1039 h2n->flags);
1041 h2n->type = LWS_H2_FRAME_TYPE_COUNT;
1044 __func__, (int)h2n->length, (int)h2n->sid, (int)h2n->highest_sid_opened);
1046 // if (h2n->sid > h2n->highest_sid_opened) {
1054 if (h2n->sid > h2n->highest_sid_opened &&
1055 h2n->type != LWS_H2_FRAME_TYPE_HEADERS &&
1056 h2n->type != LWS_H2_FRAME_TYPE_PRIORITY) {
1059 __func__, lws_wsi_tag(h2n->swsi), (unsigned int)h2n->sid, h2n->type);
1066 if (h2n->swsi && h2n->sid && h2n->type != LWS_H2_FRAME_TYPE_COUNT &&
1067 !(http2_rx_validity[h2n->swsi->h2.h2_state] & (1 << h2n->type))) {
1069 __func__, lws_wsi_tag(h2n->swsi),
1070 h2_state_names[h2n->swsi->h2.h2_state], h2n->type,
1071 http2_rx_validity[h2n->swsi->h2.h2_state]);
1073 if (h2n->swsi->h2.h2_state == LWS_H2_STATE_CLOSED ||
1074 h2n->swsi->h2.h2_state == LWS_H2_STATE_HALF_CLOSED_REMOTE)
1083 if (h2n->cont_exp && h2n->type != LWS_H2_FRAME_TYPE_COUNT &&
1084 (h2n->cont_exp_sid != h2n->sid ||
1085 h2n->type != LWS_H2_FRAME_TYPE_CONTINUATION)) {
1087 __func__, (unsigned int)h2n->cont_exp_sid, h2n->type,
1088 (unsigned int)h2n->sid);
1089 h2n->cont_exp = 0;
1090 if (h2n->cont_exp_headers)
1099 switch (h2n->type) {
1102 if (!h2n->sid) {
1108 (unsigned int)h2n->sid, h2n->flags,
1109 (unsigned int)h2n->length);
1111 if (!h2n->swsi) {
1116 lwsl_info("DATA rx on state %d\n", h2n->swsi->h2.h2_state);
1119 h2n->swsi->h2.h2_state == LWS_H2_STATE_HALF_CLOSED_REMOTE ||
1120 h2n->swsi->h2.h2_state == LWS_H2_STATE_CLOSED) {
1125 if (h2n->length == 0)
1132 if (!h2n->sid) {
1137 if (h2n->length != 5) {
1153 if (!h2n->sid)
1155 if (!h2n->swsi) {
1156 if (h2n->sid <= h2n->highest_sid_opened)
1162 if (h2n->length != 4) {
1167 lws_h2_state(h2n->swsi, LWS_H2_STATE_CLOSED);
1173 if (h2n->sid) {
1179 if (!(h2n->flags & LWS_H2_FLAG_SETTINGS_ACK)) {
1180 if (h2n->length % 6) {
1186 if (h2n->type == LWS_H2_FRAME_TYPE_COUNT)
1207 if (h2n->length) {
1214 if (h2n->sid) {
1219 if (h2n->length != 8) {
1227 (unsigned int)h2n->sid, (int)h2n->cont_exp,
1228 (int)h2n->cont_exp_sid);
1230 if (!h2n->cont_exp ||
1231 h2n->cont_exp_sid != h2n->sid ||
1232 !h2n->sid ||
1233 !h2n->swsi) {
1239 if (h2n->swsi->h2.END_HEADERS) {
1249 (unsigned int)h2n->sid);
1250 if (!h2n->sid) {
1255 if (h2n->swsi && !h2n->swsi->h2.END_STREAM &&
1256 h2n->swsi->h2.END_HEADERS &&
1257 !(h2n->flags & LWS_H2_FLAG_END_STREAM)) {
1265 if (h2n->sid) {
1266 h2n->swsi = lws_wsi_mux_from_id(wsi, h2n->sid);
1269 (unsigned int)h2n->sid,
1270 lws_wsi_tag(h2n->swsi));
1271 if (!h2n->swsi)
1278 if (!h2n->swsi) {
1281 wsi->h2.h2n->our_set.s[H2SET_MAX_CONCURRENT_STREAMS]) {
1296 h2n->swsi = __lws_wsi_server_new(wsi->a.vhost, wsi,
1297 h2n->sid);
1302 if (!h2n->swsi) {
1309 if (h2n->sid >= h2n->highest_sid)
1310 h2n->highest_sid = h2n->sid + 2;
1312 h2n->swsi->h2.initialized = 1;
1314 if (lws_h2_update_peer_txcredit(h2n->swsi,
1315 h2n->swsi->mux.my_sid, 4 * 65536))
1323 if (!h2n->swsi->http.ah)
1324 if (lws_header_table_attach(h2n->swsi, 0)) {
1340 if (w->mux.my_sid < h2n->sid &&
1346 h2n->cont_exp = !(h2n->flags & LWS_H2_FLAG_END_HEADERS);
1347 h2n->cont_exp_sid = h2n->sid;
1348 h2n->cont_exp_headers = 1;
1349 // lws_header_table_reset(h2n->swsi, 0);
1352 if (lws_check_opt(h2n->swsi->a.vhost->options,
1360 lws_mux_mark_immortal(h2n->swsi);
1362 __func__, lws_wsi_tag(h2n->swsi));
1365 h2n->swsi->h2.END_STREAM =
1366 !!(h2n->flags & LWS_H2_FLAG_END_STREAM);
1368 h2n->swsi->h2.END_STREAM);
1372 h2n->swsi->h2.END_HEADERS =
1373 !!(h2n->flags & LWS_H2_FLAG_END_HEADERS);
1374 lwsl_info("%s: %s: END_HEADERS %d\n", __func__, lws_wsi_tag(h2n->swsi),
1375 h2n->swsi->h2.END_HEADERS);
1376 if (h2n->swsi->h2.END_HEADERS)
1377 h2n->cont_exp = 0;
1378 lwsl_debug("END_HEADERS %d\n", h2n->swsi->h2.END_HEADERS);
1386 if (h2n->length != 4) {
1394 if (h2n->length == 0)
1397 lwsl_debug("%s: going on to deal with unknown frame remaining len %d\n", __func__, (unsigned int)h2n->length);
1400 lwsl_info("%s: ILLEGAL FRAME TYPE %d\n", __func__, h2n->type);
1401 h2n->type = LWS_H2_FRAME_TYPE_COUNT; /* ie, IGNORE */
1404 if (h2n->length == 0)
1405 h2n->frame_state = 0;
1444 struct lws_h2_netconn *h2n = wsi->h2.h2n;
1449 h2n->frame_state = 0;
1450 h2n->count = 0;
1452 if (h2n->sid)
1453 h2n->swsi = lws_wsi_mux_from_id(wsi, h2n->sid);
1455 if (h2n->sid > h2n->highest_sid)
1456 h2n->highest_sid = h2n->sid;
1458 if (h2n->collected_priority && (h2n->dep & ~(1u << 31)) == h2n->sid) {
1463 switch (h2n->type) {
1469 !(h2n->flags & LWS_H2_FLAG_SETTINGS_ACK)) {
1485 h2n->swsi = __lws_wsi_server_new(wsi->a.vhost, wsi, 1);
1490 if (!h2n->swsi)
1492 h2n->sid = 1;
1494 assert(lws_wsi_mux_from_id(wsi, 1) == h2n->swsi);
1500 lws_role_transition(h2n->swsi, LWSIFR_CLIENT,
1505 h2n->swsi->http.ah = wsi->http.ah;
1507 lws_fi_import(&h2n->swsi->fic, &wsi->fic);
1509 h2n->swsi->client_mux_substream = 1;
1510 h2n->swsi->client_h2_alpn = 1;
1512 h2n->swsi->flags = wsi->flags;
1518 h2n->swsi->conmon = wsi->conmon;
1519 h2n->swsi->conmon_datum = wsi->conmon_datum;
1520 h2n->swsi->sa46_peer = wsi->sa46_peer;
1529 h2n->swsi->for_ss = 1;
1533 h->wsi = h2n->swsi;
1537 h2n->swsi->a.protocol = wsi->a.protocol;
1538 if (h2n->swsi->user_space &&
1539 !h2n->swsi->user_space_externally_allocated)
1540 lws_free(h2n->swsi->user_space);
1541 h2n->swsi->user_space = wsi->user_space;
1542 h2n->swsi->user_space_externally_allocated =
1544 h2n->swsi->a.opaque_user_data = wsi->a.opaque_user_data;
1546 h2n->swsi->txc.manual_initial_tx_credit =
1550 lws_strncpy(h2n->swsi->alpn, wsi->alpn,
1556 if (h2n->swsi->http.ah)
1557 h2n->swsi->http.ah->wsi = h2n->swsi;
1561 lws_wsi_tag(wsi), lws_wsi_tag(h2n->swsi));
1562 h2n->swsi->txc.tx_cr = (int32_t)
1563 h2n->peer_set.s[H2SET_INITIAL_WINDOW_SIZE];
1565 __func__, lws_wsi_tag(h2n->swsi),
1566 (int)h2n->swsi->txc.tx_cr);
1567 h2n->swsi->h2.initialized = 1;
1572 h2n->peer_set.s[H2SET_INITIAL_WINDOW_SIZE];
1580 lws_callback_on_writable(h2n->swsi);
1603 if (!h2n->swsi)
1608 if (h2n->last_action_dyntable_resize) {
1614 if (!h2n->swsi->h2.END_HEADERS) {
1617 h2n->cont_exp_sid = h2n->sid;
1618 h2n->cont_exp = 1;
1624 if (h2n->hpack != HPKS_TYPE) {
1627 h2n->hpack, h2n->type,
1628 (unsigned int)h2n->hpack_len);
1635 switch (h2n->swsi->h2.h2_state) {
1637 lws_h2_state(h2n->swsi, LWS_H2_STATE_OPEN);
1640 lws_h2_state(h2n->swsi, LWS_H2_STATE_HALF_CLOSED_LOCAL);
1644 lwsl_info("http req, %s, h2n->swsi=%s\n", lws_wsi_tag(wsi),
1645 lws_wsi_tag(h2n->swsi));
1646 h2n->swsi->hdr_parsing_completed = 1;
1649 if (h2n->swsi->client_mux_substream &&
1650 lws_client_interpret_server_handshake(h2n->swsi)) {
1665 if (lws_hdr_extant(h2n->swsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {
1666 const char *simp = lws_hdr_simple_ptr(h2n->swsi,
1671 h2n->swsi->http.rx_content_length = (unsigned long long)atoll(simp);
1672 h2n->swsi->http.rx_content_remain =
1673 h2n->swsi->http.rx_content_length;
1674 h2n->swsi->http.content_length_given = 1;
1676 (long long)h2n->swsi->http.rx_content_length);
1691 len = lws_hdr_total_length(h2n->swsi, (enum lws_token_indexes)n);
1697 if (lws_hdr_copy(h2n->swsi, buf, sizeof buf,
1711 if (h2n->swsi->h2.h2_state == LWS_H2_STATE_HALF_CLOSED_REMOTE ||
1712 h2n->swsi->h2.h2_state == LWS_H2_STATE_CLOSED) {
1718 switch (h2n->swsi->h2.h2_state) {
1720 lws_h2_state(h2n->swsi, LWS_H2_STATE_OPEN);
1723 if (h2n->swsi->h2.END_STREAM)
1724 lws_h2_state(h2n->swsi,
1728 if (h2n->swsi->h2.END_STREAM)
1732 lws_h2_state(h2n->swsi, LWS_H2_STATE_CLOSED);
1747 if (h2n->swsi->h2.h2_state == LWS_H2_STATE_CLOSED &&
1748 h2n->swsi->client_mux_substream) {
1750 lws_h2_rst_stream(h2n->swsi, H2_ERR_NO_ERROR,
1753 if (lws_http_transaction_completed_client(h2n->swsi))
1758 if (h2n->swsi->client_mux_substream) {
1761 h2_state_names[h2n->swsi->h2.h2_state]);
1766 if (!lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_PATH) ||
1767 !lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_METHOD) ||
1768 !lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_SCHEME) ||
1769 lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_STATUS) ||
1770 lws_hdr_extant(h2n->swsi, WSI_TOKEN_CONNECTION)) {
1776 if (lws_hdr_extant(h2n->swsi, WSI_TOKEN_TE)) {
1777 n = lws_hdr_total_length(h2n->swsi, WSI_TOKEN_TE);
1780 !lws_hdr_simple_ptr(h2n->swsi, WSI_TOKEN_TE) ||
1781 strncmp(lws_hdr_simple_ptr(h2n->swsi, WSI_TOKEN_TE),
1790 lws_http_compression_validate(h2n->swsi);
1793 p = lws_hdr_simple_ptr(h2n->swsi, WSI_TOKEN_HTTP_COLON_METHOD);
1800 h2n->swsi->http.ah->frag_index[method_index[n]] =
1801 h2n->swsi->http.ah->frag_index[
1808 (unsigned int)h2n->swsi->wsistate);
1809 lwsi_set_state(h2n->swsi, LRS_DEFERRING_ACTION);
1810 lws_callback_on_writable(h2n->swsi);
1815 lwsl_info("%s: DATA flags 0x%x\n", __func__, h2n->flags);
1816 if (!h2n->swsi)
1819 if (lws_hdr_total_length(h2n->swsi,
1821 h2n->swsi->h2.END_STREAM &&
1822 h2n->swsi->http.rx_content_length &&
1823 h2n->swsi->http.rx_content_remain) {
1824 lws_h2_rst_stream(h2n->swsi, H2_ERR_PROTOCOL_ERROR,
1829 if (h2n->swsi->h2.END_STREAM &&
1830 h2n->swsi->h2.h2_state == LWS_H2_STATE_OPEN)
1831 lws_h2_state(h2n->swsi,
1834 if (h2n->swsi->h2.END_STREAM &&
1835 h2n->swsi->h2.h2_state == LWS_H2_STATE_HALF_CLOSED_LOCAL)
1836 lws_h2_state(h2n->swsi, LWS_H2_STATE_CLOSED);
1844 if (h2n->swsi->client_mux_substream &&
1845 (h2n->flags & LWS_H2_FLAG_END_STREAM)) {
1847 __func__, lws_wsi_tag(h2n->swsi));
1849 if (h2n->swsi->h2.h2_state == LWS_H2_STATE_OPEN) {
1850 lws_h2_state(h2n->swsi,
1852 // lws_h2_rst_stream(h2n->swsi, H2_ERR_NO_ERROR,
1855 // if (lws_http_transaction_completed_client(h2n->swsi))
1859 //if (h2n->swsi->h2.h2_state == LWS_H2_STATE_HALF_CLOSED_LOCAL)
1861 lws_h2_state(h2n->swsi, LWS_H2_STATE_CLOSED);
1863 lws_h2_rst_stream(h2n->swsi, H2_ERR_NO_ERROR,
1866 if (lws_http_transaction_completed_client(h2n->swsi))
1874 if (h2n->flags & LWS_H2_FLAG_SETTINGS_ACK)
1885 memcpy(pps->u.ping.ping_payload, h2n->ping_payload, 8);
1895 h2n->hpack_e_dep &= ~(1u << 31);
1897 (unsigned int)h2n->sid,
1898 (unsigned int)h2n->hpack_e_dep,
1899 (unsigned int)h2n->hpack_e_dep);
1901 if (h2n->sid)
1902 eff_wsi = h2n->swsi;
1905 if (h2n->sid > h2n->highest_sid_opened)
1913 (uint64_t)eff_wsi->txc.tx_cr + (uint64_t)h2n->hpack_e_dep >
1915 h2n->hpack_e_dep = (uint32_t)(0x7fffffff - eff_wsi->txc.tx_cr);
1917 if ((uint64_t)eff_wsi->txc.tx_cr + (uint64_t)h2n->hpack_e_dep >
1921 (unsigned long long)h2n->hpack_e_dep,
1922 (unsigned long long)eff_wsi->txc.tx_cr + (unsigned long long)h2n->hpack_e_dep);
1923 if (h2n->sid)
1924 lws_h2_rst_stream(h2n->swsi,
1933 if (!h2n->hpack_e_dep) {
1939 eff_wsi->txc.tx_cr += (int32_t)h2n->hpack_e_dep;
1942 (int32_t)h2n->hpack_e_dep);
1973 (unsigned int)h2n->goaway_last_sid,
1974 (unsigned int)h2n->goaway_err, h2n->goaway_str);
1980 (unsigned int)h2n->sid,
1981 (unsigned int)h2n->hpack_e_dep);
2011 struct lws_h2_netconn *h2n = wsi->h2.h2n;
2016 if (!h2n)
2025 if (preface[h2n->count++] != c)
2028 if (preface[h2n->count])
2034 h2n->count = 0;
2052 if (h2n->frame_state != LWS_H2_FRAME_HEADER_LENGTH)
2058 h2n->count++;
2060 if (h2n->type == LWS_H2_FRAME_TYPE_COUNT) { /* IGNORING FRAME */
2061 //lwsl_debug("%s: consuming for ignored %u %u\n", __func__, (unsigned int)h2n->count, (unsigned int)h2n->length);
2066 if (h2n->flags & LWS_H2_FLAG_PADDED &&
2067 !h2n->pad_length) {
2072 h2n->padding = c;
2073 h2n->pad_length = 1;
2074 h2n->preamble++;
2076 if (h2n->padding > h2n->length - 1)
2083 if (h2n->flags & LWS_H2_FLAG_PRIORITY &&
2084 !h2n->collected_priority) {
2089 if (h2n->preamble++ - h2n->pad_length < 4) {
2090 h2n->dep = ((h2n->dep) << 8) | c;
2093 h2n->weight_temp = c;
2094 h2n->collected_priority = 1;
2096 (unsigned int)h2n->dep,
2097 h2n->weight_temp);
2100 if (h2n->padding && h2n->count >
2101 (h2n->length - h2n->padding)) {
2111 switch(h2n->type) {
2114 n = (int)(h2n->count - 1u - h2n->preamble) %
2116 h2n->one_setting[n] = c;
2119 lws_h2_settings(wsi, &h2n->peer_set,
2120 h2n->one_setting,
2126 if (!h2n->swsi)
2128 if (lws_hpack_interpret(h2n->swsi, c)) {
2136 switch (h2n->inside++) {
2141 h2n->goaway_last_sid <<= 8;
2142 h2n->goaway_last_sid |= c;
2143 h2n->goaway_str[0] = '\0';
2150 h2n->goaway_err <<= 8;
2151 h2n->goaway_err |= c;
2155 if (h2n->inside - 9 <
2156 sizeof(h2n->goaway_str) - 1)
2157 h2n->goaway_str[
2158 h2n->inside - 9] = (char)c;
2159 h2n->goaway_str[
2160 sizeof(h2n->goaway_str) - 1] = '\0';
2168 // __func__, h2n->flags);
2181 if (!h2n->swsi)
2185 &h2n->swsi->buflist, NULL))
2189 if (lwsi_role_http(h2n->swsi) &&
2190 lwsi_state(h2n->swsi) == LRS_ESTABLISHED) {
2191 lwsi_set_state(h2n->swsi, LRS_BODY);
2193 __func__, lws_wsi_tag(h2n->swsi));
2202 if (lws_hdr_total_length(h2n->swsi,
2204 h2n->swsi->http.rx_content_length &&
2205 h2n->swsi->http.rx_content_remain <
2206 h2n->length && /* last */
2207 h2n->inside < h2n->length) {
2210 (unsigned long)h2n->swsi->http.rx_content_remain,
2212 (unsigned long)h2n->inside, (unsigned long)h2n->length);
2227 if (n > (int)(h2n->length - h2n->count + 1)) {
2228 if (h2n->count > h2n->length)
2230 n = (int)(h2n->length - h2n->count) + 1;
2235 if (h2n->swsi->client_mux_substream) {
2236 if (!h2n->swsi->a.protocol) {
2238 __func__, lws_wsi_tag(h2n->swsi));
2241 h2n->swsi->txc.peer_tx_cr_est -= n;
2243 lws_wsi_txc_describe(&h2n->swsi->txc,
2245 h2n->swsi->mux.my_sid);
2247 h2n->swsi->a.protocol->callback,
2248 h2n->swsi,
2250 h2n->swsi->user_space,
2255 h2n->inside += (unsigned int)n;
2256 h2n->count += (unsigned int)n - 1;
2267 if (lwsi_state(h2n->swsi) == LRS_DEFERRING_ACTION) {
2269 &h2n->swsi->buflist, in - 1, (unsigned int)n);
2283 h2n->inside += (unsigned int)n;
2284 h2n->count += (unsigned int)n - 1;
2290 h2n->swsi->outer_will_close = 1;
2297 n = lws_read_h1(h2n->swsi, in - 1, (unsigned int)n);
2299 h2n->swsi->outer_will_close = 0;
2305 (!n && h2n->swsi->http.content_length_given && !lws_buflist_next_segment_len(
2309 (unsigned int)h2n->count,
2310 (unsigned int)h2n->length);
2311 in += h2n->length - h2n->count;
2312 h2n->inside = h2n->length;
2313 h2n->count = h2n->length - 1;
2322 (unsigned int)h2n->count,
2323 (unsigned int)h2n->length);
2326 h2n->inside += (unsigned int)n;
2327 h2n->count += (unsigned int)n - 1;
2329 h2n->swsi->txc.peer_tx_cr_est -= n;
2335 if (!(h2n->swsi->flags & LCCSCF_H2_MANUAL_RXFLOW))
2349 lws_h2_update_peer_txcredit_thresh(h2n->swsi,
2350 h2n->sid, m, m);
2361 h2n->swsi->txc.manual = 1;
2367 if (h2n->count <= 4) {
2368 h2n->dep <<= 8;
2369 h2n->dep |= c;
2372 h2n->weight_temp = c;
2374 (unsigned int)h2n->dep, h2n->weight_temp);
2376 if ((h2n->dep & ~(1u << 31)) == h2n->sid) {
2384 h2n->hpack_e_dep <<= 8;
2385 h2n->hpack_e_dep |= c;
2392 if (h2n->flags & LWS_H2_FLAG_SETTINGS_ACK) { // ack
2394 if (h2n->count > 8)
2396 h2n->ping_payload[h2n->count - 1] = c;
2401 h2n->hpack_e_dep <<= 8;
2402 h2n->hpack_e_dep |= c;
2406 //lwsl_debug("%s: consuming for ignored %u %u\n", __func__, (unsigned int)h2n->count, (unsigned int)h2n->length);
2407 h2n->count++;
2412 __func__, h2n->type);
2418 if (h2n->count > h2n->length) {
2420 __func__, (unsigned int)h2n->count,
2421 (unsigned int)h2n->length, h2n->type);
2424 if (h2n->count != h2n->length)
2442 if (h2n->frame_state <= 8) {
2444 switch (h2n->frame_state++) {
2446 h2n->pad_length = 0;
2447 h2n->collected_priority = 0;
2448 h2n->padding = 0;
2449 h2n->preamble = 0;
2450 h2n->length = c;
2451 h2n->inside = 0;
2455 h2n->length <<= 8;
2456 h2n->length |= c;
2459 h2n->type = c;
2462 h2n->flags = c;
2469 h2n->sid <<= 8;
2470 h2n->sid |= c;
2475 if (h2n->frame_state == LWS_H2_FRAME_HEADER_LENGTH &&
2481 if (h2n->type == LWS_H2_FRAME_TYPE_COUNT) { /* IGNORING FRAME */
2482 //lwsl_debug("%s: consuming for ignored %u %u\n", __func__, (unsigned int)h2n->count, (unsigned int)h2n->length);
2483 h2n->count++;
2495 lws_close_free_wsi(h2n->swsi, 0, "close_swsi_and_return");
2496 h2n->swsi = NULL;
2497 h2n->frame_state = 0;
2498 h2n->count = 0;
2530 unsigned int sid = nwsi->h2.h2n->highest_sid_opened + 2;
2542 wsi->mux.my_sid = nwsi->h2.h2n->highest_sid_opened = sid;