11cb0ef41Sopenharmony_ci/*
21cb0ef41Sopenharmony_ci * nghttp2 - HTTP/2 C Library
31cb0ef41Sopenharmony_ci *
41cb0ef41Sopenharmony_ci * Copyright (c) 2012 Tatsuhiro Tsujikawa
51cb0ef41Sopenharmony_ci *
61cb0ef41Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining
71cb0ef41Sopenharmony_ci * a copy of this software and associated documentation files (the
81cb0ef41Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
91cb0ef41Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
101cb0ef41Sopenharmony_ci * distribute, sublicense, and/or sell copies of the Software, and to
111cb0ef41Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
121cb0ef41Sopenharmony_ci * the following conditions:
131cb0ef41Sopenharmony_ci *
141cb0ef41Sopenharmony_ci * The above copyright notice and this permission notice shall be
151cb0ef41Sopenharmony_ci * included in all copies or substantial portions of the Software.
161cb0ef41Sopenharmony_ci *
171cb0ef41Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
181cb0ef41Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
191cb0ef41Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
201cb0ef41Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
211cb0ef41Sopenharmony_ci * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
221cb0ef41Sopenharmony_ci * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
231cb0ef41Sopenharmony_ci * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
241cb0ef41Sopenharmony_ci */
251cb0ef41Sopenharmony_ci#include "nghttp2_helper.h"
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci#include <assert.h>
281cb0ef41Sopenharmony_ci#include <string.h>
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci#include "nghttp2_net.h"
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_civoid nghttp2_put_uint16be(uint8_t *buf, uint16_t n) {
331cb0ef41Sopenharmony_ci  uint16_t x = htons(n);
341cb0ef41Sopenharmony_ci  memcpy(buf, &x, sizeof(uint16_t));
351cb0ef41Sopenharmony_ci}
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_civoid nghttp2_put_uint32be(uint8_t *buf, uint32_t n) {
381cb0ef41Sopenharmony_ci  uint32_t x = htonl(n);
391cb0ef41Sopenharmony_ci  memcpy(buf, &x, sizeof(uint32_t));
401cb0ef41Sopenharmony_ci}
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ciuint16_t nghttp2_get_uint16(const uint8_t *data) {
431cb0ef41Sopenharmony_ci  uint16_t n;
441cb0ef41Sopenharmony_ci  memcpy(&n, data, sizeof(uint16_t));
451cb0ef41Sopenharmony_ci  return ntohs(n);
461cb0ef41Sopenharmony_ci}
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ciuint32_t nghttp2_get_uint32(const uint8_t *data) {
491cb0ef41Sopenharmony_ci  uint32_t n;
501cb0ef41Sopenharmony_ci  memcpy(&n, data, sizeof(uint32_t));
511cb0ef41Sopenharmony_ci  return ntohl(n);
521cb0ef41Sopenharmony_ci}
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci/* Generated by gendowncasetbl.py */
551cb0ef41Sopenharmony_cistatic const uint8_t DOWNCASE_TBL[] = {
561cb0ef41Sopenharmony_ci    0 /* NUL  */,   1 /* SOH  */,   2 /* STX  */,   3 /* ETX  */,
571cb0ef41Sopenharmony_ci    4 /* EOT  */,   5 /* ENQ  */,   6 /* ACK  */,   7 /* BEL  */,
581cb0ef41Sopenharmony_ci    8 /* BS   */,   9 /* HT   */,   10 /* LF   */,  11 /* VT   */,
591cb0ef41Sopenharmony_ci    12 /* FF   */,  13 /* CR   */,  14 /* SO   */,  15 /* SI   */,
601cb0ef41Sopenharmony_ci    16 /* DLE  */,  17 /* DC1  */,  18 /* DC2  */,  19 /* DC3  */,
611cb0ef41Sopenharmony_ci    20 /* DC4  */,  21 /* NAK  */,  22 /* SYN  */,  23 /* ETB  */,
621cb0ef41Sopenharmony_ci    24 /* CAN  */,  25 /* EM   */,  26 /* SUB  */,  27 /* ESC  */,
631cb0ef41Sopenharmony_ci    28 /* FS   */,  29 /* GS   */,  30 /* RS   */,  31 /* US   */,
641cb0ef41Sopenharmony_ci    32 /* SPC  */,  33 /* !    */,  34 /* "    */,  35 /* #    */,
651cb0ef41Sopenharmony_ci    36 /* $    */,  37 /* %    */,  38 /* &    */,  39 /* '    */,
661cb0ef41Sopenharmony_ci    40 /* (    */,  41 /* )    */,  42 /* *    */,  43 /* +    */,
671cb0ef41Sopenharmony_ci    44 /* ,    */,  45 /* -    */,  46 /* .    */,  47 /* /    */,
681cb0ef41Sopenharmony_ci    48 /* 0    */,  49 /* 1    */,  50 /* 2    */,  51 /* 3    */,
691cb0ef41Sopenharmony_ci    52 /* 4    */,  53 /* 5    */,  54 /* 6    */,  55 /* 7    */,
701cb0ef41Sopenharmony_ci    56 /* 8    */,  57 /* 9    */,  58 /* :    */,  59 /* ;    */,
711cb0ef41Sopenharmony_ci    60 /* <    */,  61 /* =    */,  62 /* >    */,  63 /* ?    */,
721cb0ef41Sopenharmony_ci    64 /* @    */,  97 /* A    */,  98 /* B    */,  99 /* C    */,
731cb0ef41Sopenharmony_ci    100 /* D    */, 101 /* E    */, 102 /* F    */, 103 /* G    */,
741cb0ef41Sopenharmony_ci    104 /* H    */, 105 /* I    */, 106 /* J    */, 107 /* K    */,
751cb0ef41Sopenharmony_ci    108 /* L    */, 109 /* M    */, 110 /* N    */, 111 /* O    */,
761cb0ef41Sopenharmony_ci    112 /* P    */, 113 /* Q    */, 114 /* R    */, 115 /* S    */,
771cb0ef41Sopenharmony_ci    116 /* T    */, 117 /* U    */, 118 /* V    */, 119 /* W    */,
781cb0ef41Sopenharmony_ci    120 /* X    */, 121 /* Y    */, 122 /* Z    */, 91 /* [    */,
791cb0ef41Sopenharmony_ci    92 /* \    */,  93 /* ]    */,  94 /* ^    */,  95 /* _    */,
801cb0ef41Sopenharmony_ci    96 /* `    */,  97 /* a    */,  98 /* b    */,  99 /* c    */,
811cb0ef41Sopenharmony_ci    100 /* d    */, 101 /* e    */, 102 /* f    */, 103 /* g    */,
821cb0ef41Sopenharmony_ci    104 /* h    */, 105 /* i    */, 106 /* j    */, 107 /* k    */,
831cb0ef41Sopenharmony_ci    108 /* l    */, 109 /* m    */, 110 /* n    */, 111 /* o    */,
841cb0ef41Sopenharmony_ci    112 /* p    */, 113 /* q    */, 114 /* r    */, 115 /* s    */,
851cb0ef41Sopenharmony_ci    116 /* t    */, 117 /* u    */, 118 /* v    */, 119 /* w    */,
861cb0ef41Sopenharmony_ci    120 /* x    */, 121 /* y    */, 122 /* z    */, 123 /* {    */,
871cb0ef41Sopenharmony_ci    124 /* |    */, 125 /* }    */, 126 /* ~    */, 127 /* DEL  */,
881cb0ef41Sopenharmony_ci    128 /* 0x80 */, 129 /* 0x81 */, 130 /* 0x82 */, 131 /* 0x83 */,
891cb0ef41Sopenharmony_ci    132 /* 0x84 */, 133 /* 0x85 */, 134 /* 0x86 */, 135 /* 0x87 */,
901cb0ef41Sopenharmony_ci    136 /* 0x88 */, 137 /* 0x89 */, 138 /* 0x8a */, 139 /* 0x8b */,
911cb0ef41Sopenharmony_ci    140 /* 0x8c */, 141 /* 0x8d */, 142 /* 0x8e */, 143 /* 0x8f */,
921cb0ef41Sopenharmony_ci    144 /* 0x90 */, 145 /* 0x91 */, 146 /* 0x92 */, 147 /* 0x93 */,
931cb0ef41Sopenharmony_ci    148 /* 0x94 */, 149 /* 0x95 */, 150 /* 0x96 */, 151 /* 0x97 */,
941cb0ef41Sopenharmony_ci    152 /* 0x98 */, 153 /* 0x99 */, 154 /* 0x9a */, 155 /* 0x9b */,
951cb0ef41Sopenharmony_ci    156 /* 0x9c */, 157 /* 0x9d */, 158 /* 0x9e */, 159 /* 0x9f */,
961cb0ef41Sopenharmony_ci    160 /* 0xa0 */, 161 /* 0xa1 */, 162 /* 0xa2 */, 163 /* 0xa3 */,
971cb0ef41Sopenharmony_ci    164 /* 0xa4 */, 165 /* 0xa5 */, 166 /* 0xa6 */, 167 /* 0xa7 */,
981cb0ef41Sopenharmony_ci    168 /* 0xa8 */, 169 /* 0xa9 */, 170 /* 0xaa */, 171 /* 0xab */,
991cb0ef41Sopenharmony_ci    172 /* 0xac */, 173 /* 0xad */, 174 /* 0xae */, 175 /* 0xaf */,
1001cb0ef41Sopenharmony_ci    176 /* 0xb0 */, 177 /* 0xb1 */, 178 /* 0xb2 */, 179 /* 0xb3 */,
1011cb0ef41Sopenharmony_ci    180 /* 0xb4 */, 181 /* 0xb5 */, 182 /* 0xb6 */, 183 /* 0xb7 */,
1021cb0ef41Sopenharmony_ci    184 /* 0xb8 */, 185 /* 0xb9 */, 186 /* 0xba */, 187 /* 0xbb */,
1031cb0ef41Sopenharmony_ci    188 /* 0xbc */, 189 /* 0xbd */, 190 /* 0xbe */, 191 /* 0xbf */,
1041cb0ef41Sopenharmony_ci    192 /* 0xc0 */, 193 /* 0xc1 */, 194 /* 0xc2 */, 195 /* 0xc3 */,
1051cb0ef41Sopenharmony_ci    196 /* 0xc4 */, 197 /* 0xc5 */, 198 /* 0xc6 */, 199 /* 0xc7 */,
1061cb0ef41Sopenharmony_ci    200 /* 0xc8 */, 201 /* 0xc9 */, 202 /* 0xca */, 203 /* 0xcb */,
1071cb0ef41Sopenharmony_ci    204 /* 0xcc */, 205 /* 0xcd */, 206 /* 0xce */, 207 /* 0xcf */,
1081cb0ef41Sopenharmony_ci    208 /* 0xd0 */, 209 /* 0xd1 */, 210 /* 0xd2 */, 211 /* 0xd3 */,
1091cb0ef41Sopenharmony_ci    212 /* 0xd4 */, 213 /* 0xd5 */, 214 /* 0xd6 */, 215 /* 0xd7 */,
1101cb0ef41Sopenharmony_ci    216 /* 0xd8 */, 217 /* 0xd9 */, 218 /* 0xda */, 219 /* 0xdb */,
1111cb0ef41Sopenharmony_ci    220 /* 0xdc */, 221 /* 0xdd */, 222 /* 0xde */, 223 /* 0xdf */,
1121cb0ef41Sopenharmony_ci    224 /* 0xe0 */, 225 /* 0xe1 */, 226 /* 0xe2 */, 227 /* 0xe3 */,
1131cb0ef41Sopenharmony_ci    228 /* 0xe4 */, 229 /* 0xe5 */, 230 /* 0xe6 */, 231 /* 0xe7 */,
1141cb0ef41Sopenharmony_ci    232 /* 0xe8 */, 233 /* 0xe9 */, 234 /* 0xea */, 235 /* 0xeb */,
1151cb0ef41Sopenharmony_ci    236 /* 0xec */, 237 /* 0xed */, 238 /* 0xee */, 239 /* 0xef */,
1161cb0ef41Sopenharmony_ci    240 /* 0xf0 */, 241 /* 0xf1 */, 242 /* 0xf2 */, 243 /* 0xf3 */,
1171cb0ef41Sopenharmony_ci    244 /* 0xf4 */, 245 /* 0xf5 */, 246 /* 0xf6 */, 247 /* 0xf7 */,
1181cb0ef41Sopenharmony_ci    248 /* 0xf8 */, 249 /* 0xf9 */, 250 /* 0xfa */, 251 /* 0xfb */,
1191cb0ef41Sopenharmony_ci    252 /* 0xfc */, 253 /* 0xfd */, 254 /* 0xfe */, 255 /* 0xff */,
1201cb0ef41Sopenharmony_ci};
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_civoid nghttp2_downcase(uint8_t *s, size_t len) {
1231cb0ef41Sopenharmony_ci  size_t i;
1241cb0ef41Sopenharmony_ci  for (i = 0; i < len; ++i) {
1251cb0ef41Sopenharmony_ci    s[i] = DOWNCASE_TBL[s[i]];
1261cb0ef41Sopenharmony_ci  }
1271cb0ef41Sopenharmony_ci}
1281cb0ef41Sopenharmony_ci
1291cb0ef41Sopenharmony_ci/*
1301cb0ef41Sopenharmony_ci *   local_window_size
1311cb0ef41Sopenharmony_ci *   ^  *
1321cb0ef41Sopenharmony_ci *   |  *    recv_window_size
1331cb0ef41Sopenharmony_ci *   |  *  * ^
1341cb0ef41Sopenharmony_ci *   |  *  * |
1351cb0ef41Sopenharmony_ci *  0+++++++++
1361cb0ef41Sopenharmony_ci *   |  *  *   \
1371cb0ef41Sopenharmony_ci *   |  *  *   | This rage is hidden in flow control.  But it must be
1381cb0ef41Sopenharmony_ci *   v  *  *   / kept in order to restore it when window size is enlarged.
1391cb0ef41Sopenharmony_ci *   recv_reduction
1401cb0ef41Sopenharmony_ci *   (+ for negative direction)
1411cb0ef41Sopenharmony_ci *
1421cb0ef41Sopenharmony_ci *   recv_window_size could be negative if we decrease
1431cb0ef41Sopenharmony_ci *   local_window_size more than recv_window_size:
1441cb0ef41Sopenharmony_ci *
1451cb0ef41Sopenharmony_ci *   local_window_size
1461cb0ef41Sopenharmony_ci *   ^  *
1471cb0ef41Sopenharmony_ci *   |  *
1481cb0ef41Sopenharmony_ci *   |  *
1491cb0ef41Sopenharmony_ci *   0++++++++
1501cb0ef41Sopenharmony_ci *   |  *    ^ recv_window_size (negative)
1511cb0ef41Sopenharmony_ci *   |  *    |
1521cb0ef41Sopenharmony_ci *   v  *  *
1531cb0ef41Sopenharmony_ci *   recv_reduction
1541cb0ef41Sopenharmony_ci */
1551cb0ef41Sopenharmony_ciint nghttp2_adjust_local_window_size(int32_t *local_window_size_ptr,
1561cb0ef41Sopenharmony_ci                                     int32_t *recv_window_size_ptr,
1571cb0ef41Sopenharmony_ci                                     int32_t *recv_reduction_ptr,
1581cb0ef41Sopenharmony_ci                                     int32_t *delta_ptr) {
1591cb0ef41Sopenharmony_ci  if (*delta_ptr > 0) {
1601cb0ef41Sopenharmony_ci    int32_t recv_reduction_delta;
1611cb0ef41Sopenharmony_ci    int32_t delta;
1621cb0ef41Sopenharmony_ci    int32_t new_recv_window_size =
1631cb0ef41Sopenharmony_ci        nghttp2_max(0, *recv_window_size_ptr) - *delta_ptr;
1641cb0ef41Sopenharmony_ci
1651cb0ef41Sopenharmony_ci    if (new_recv_window_size >= 0) {
1661cb0ef41Sopenharmony_ci      *recv_window_size_ptr = new_recv_window_size;
1671cb0ef41Sopenharmony_ci      return 0;
1681cb0ef41Sopenharmony_ci    }
1691cb0ef41Sopenharmony_ci
1701cb0ef41Sopenharmony_ci    delta = -new_recv_window_size;
1711cb0ef41Sopenharmony_ci
1721cb0ef41Sopenharmony_ci    /* The delta size is strictly more than received bytes. Increase
1731cb0ef41Sopenharmony_ci       local_window_size by that difference |delta|. */
1741cb0ef41Sopenharmony_ci    if (*local_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta) {
1751cb0ef41Sopenharmony_ci      return NGHTTP2_ERR_FLOW_CONTROL;
1761cb0ef41Sopenharmony_ci    }
1771cb0ef41Sopenharmony_ci    *local_window_size_ptr += delta;
1781cb0ef41Sopenharmony_ci    /* If there is recv_reduction due to earlier window_size
1791cb0ef41Sopenharmony_ci       reduction, we have to adjust it too. */
1801cb0ef41Sopenharmony_ci    recv_reduction_delta = nghttp2_min(*recv_reduction_ptr, delta);
1811cb0ef41Sopenharmony_ci    *recv_reduction_ptr -= recv_reduction_delta;
1821cb0ef41Sopenharmony_ci    if (*recv_window_size_ptr < 0) {
1831cb0ef41Sopenharmony_ci      *recv_window_size_ptr += recv_reduction_delta;
1841cb0ef41Sopenharmony_ci    } else {
1851cb0ef41Sopenharmony_ci      /* If *recv_window_size_ptr > 0, then those bytes are going to
1861cb0ef41Sopenharmony_ci         be returned to the remote peer (by WINDOW_UPDATE with the
1871cb0ef41Sopenharmony_ci         adjusted *delta_ptr), so it is effectively 0 now.  We set to
1881cb0ef41Sopenharmony_ci         *recv_reduction_delta, because caller does not take into
1891cb0ef41Sopenharmony_ci         account it in *delta_ptr. */
1901cb0ef41Sopenharmony_ci      *recv_window_size_ptr = recv_reduction_delta;
1911cb0ef41Sopenharmony_ci    }
1921cb0ef41Sopenharmony_ci    /* recv_reduction_delta must be paid from *delta_ptr, since it was
1931cb0ef41Sopenharmony_ci       added in window size reduction (see below). */
1941cb0ef41Sopenharmony_ci    *delta_ptr -= recv_reduction_delta;
1951cb0ef41Sopenharmony_ci
1961cb0ef41Sopenharmony_ci    return 0;
1971cb0ef41Sopenharmony_ci  }
1981cb0ef41Sopenharmony_ci
1991cb0ef41Sopenharmony_ci  if (*local_window_size_ptr + *delta_ptr < 0 ||
2001cb0ef41Sopenharmony_ci      *recv_window_size_ptr < INT32_MIN - *delta_ptr ||
2011cb0ef41Sopenharmony_ci      *recv_reduction_ptr > INT32_MAX + *delta_ptr) {
2021cb0ef41Sopenharmony_ci    return NGHTTP2_ERR_FLOW_CONTROL;
2031cb0ef41Sopenharmony_ci  }
2041cb0ef41Sopenharmony_ci  /* Decreasing local window size. Note that we achieve this without
2051cb0ef41Sopenharmony_ci     noticing to the remote peer. To do this, we cut
2061cb0ef41Sopenharmony_ci     recv_window_size by -delta. This means that we don't send
2071cb0ef41Sopenharmony_ci     WINDOW_UPDATE for -delta bytes. */
2081cb0ef41Sopenharmony_ci  *local_window_size_ptr += *delta_ptr;
2091cb0ef41Sopenharmony_ci  *recv_window_size_ptr += *delta_ptr;
2101cb0ef41Sopenharmony_ci  *recv_reduction_ptr -= *delta_ptr;
2111cb0ef41Sopenharmony_ci  *delta_ptr = 0;
2121cb0ef41Sopenharmony_ci
2131cb0ef41Sopenharmony_ci  return 0;
2141cb0ef41Sopenharmony_ci}
2151cb0ef41Sopenharmony_ci
2161cb0ef41Sopenharmony_ciint nghttp2_increase_local_window_size(int32_t *local_window_size_ptr,
2171cb0ef41Sopenharmony_ci                                       int32_t *recv_window_size_ptr,
2181cb0ef41Sopenharmony_ci                                       int32_t *recv_reduction_ptr,
2191cb0ef41Sopenharmony_ci                                       int32_t *delta_ptr) {
2201cb0ef41Sopenharmony_ci  int32_t recv_reduction_delta;
2211cb0ef41Sopenharmony_ci  int32_t delta;
2221cb0ef41Sopenharmony_ci
2231cb0ef41Sopenharmony_ci  delta = *delta_ptr;
2241cb0ef41Sopenharmony_ci
2251cb0ef41Sopenharmony_ci  assert(delta >= 0);
2261cb0ef41Sopenharmony_ci
2271cb0ef41Sopenharmony_ci  /* The delta size is strictly more than received bytes. Increase
2281cb0ef41Sopenharmony_ci     local_window_size by that difference |delta|. */
2291cb0ef41Sopenharmony_ci  if (*local_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta) {
2301cb0ef41Sopenharmony_ci    return NGHTTP2_ERR_FLOW_CONTROL;
2311cb0ef41Sopenharmony_ci  }
2321cb0ef41Sopenharmony_ci
2331cb0ef41Sopenharmony_ci  *local_window_size_ptr += delta;
2341cb0ef41Sopenharmony_ci  /* If there is recv_reduction due to earlier window_size
2351cb0ef41Sopenharmony_ci     reduction, we have to adjust it too. */
2361cb0ef41Sopenharmony_ci  recv_reduction_delta = nghttp2_min(*recv_reduction_ptr, delta);
2371cb0ef41Sopenharmony_ci  *recv_reduction_ptr -= recv_reduction_delta;
2381cb0ef41Sopenharmony_ci
2391cb0ef41Sopenharmony_ci  *recv_window_size_ptr += recv_reduction_delta;
2401cb0ef41Sopenharmony_ci
2411cb0ef41Sopenharmony_ci  /* recv_reduction_delta must be paid from *delta_ptr, since it was
2421cb0ef41Sopenharmony_ci     added in window size reduction (see below). */
2431cb0ef41Sopenharmony_ci  *delta_ptr -= recv_reduction_delta;
2441cb0ef41Sopenharmony_ci
2451cb0ef41Sopenharmony_ci  return 0;
2461cb0ef41Sopenharmony_ci}
2471cb0ef41Sopenharmony_ci
2481cb0ef41Sopenharmony_ciint nghttp2_should_send_window_update(int32_t local_window_size,
2491cb0ef41Sopenharmony_ci                                      int32_t recv_window_size) {
2501cb0ef41Sopenharmony_ci  return recv_window_size > 0 && recv_window_size >= local_window_size / 2;
2511cb0ef41Sopenharmony_ci}
2521cb0ef41Sopenharmony_ci
2531cb0ef41Sopenharmony_ciconst char *nghttp2_strerror(int error_code) {
2541cb0ef41Sopenharmony_ci  switch (error_code) {
2551cb0ef41Sopenharmony_ci  case 0:
2561cb0ef41Sopenharmony_ci    return "Success";
2571cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INVALID_ARGUMENT:
2581cb0ef41Sopenharmony_ci    return "Invalid argument";
2591cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_BUFFER_ERROR:
2601cb0ef41Sopenharmony_ci    return "Out of buffer space";
2611cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_UNSUPPORTED_VERSION:
2621cb0ef41Sopenharmony_ci    return "Unsupported SPDY version";
2631cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_WOULDBLOCK:
2641cb0ef41Sopenharmony_ci    return "Operation would block";
2651cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_PROTO:
2661cb0ef41Sopenharmony_ci    return "Protocol error";
2671cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INVALID_FRAME:
2681cb0ef41Sopenharmony_ci    return "Invalid frame octets";
2691cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_EOF:
2701cb0ef41Sopenharmony_ci    return "EOF";
2711cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_DEFERRED:
2721cb0ef41Sopenharmony_ci    return "Data transfer deferred";
2731cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE:
2741cb0ef41Sopenharmony_ci    return "No more Stream ID available";
2751cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_STREAM_CLOSED:
2761cb0ef41Sopenharmony_ci    return "Stream was already closed or invalid";
2771cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_STREAM_CLOSING:
2781cb0ef41Sopenharmony_ci    return "Stream is closing";
2791cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_STREAM_SHUT_WR:
2801cb0ef41Sopenharmony_ci    return "The transmission is not allowed for this stream";
2811cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INVALID_STREAM_ID:
2821cb0ef41Sopenharmony_ci    return "Stream ID is invalid";
2831cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INVALID_STREAM_STATE:
2841cb0ef41Sopenharmony_ci    return "Invalid stream state";
2851cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_DEFERRED_DATA_EXIST:
2861cb0ef41Sopenharmony_ci    return "Another DATA frame has already been deferred";
2871cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_START_STREAM_NOT_ALLOWED:
2881cb0ef41Sopenharmony_ci    return "request HEADERS is not allowed";
2891cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_GOAWAY_ALREADY_SENT:
2901cb0ef41Sopenharmony_ci    return "GOAWAY has already been sent";
2911cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INVALID_HEADER_BLOCK:
2921cb0ef41Sopenharmony_ci    return "Invalid header block";
2931cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INVALID_STATE:
2941cb0ef41Sopenharmony_ci    return "Invalid state";
2951cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE:
2961cb0ef41Sopenharmony_ci    return "The user callback function failed due to the temporal error";
2971cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_FRAME_SIZE_ERROR:
2981cb0ef41Sopenharmony_ci    return "The length of the frame is invalid";
2991cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_HEADER_COMP:
3001cb0ef41Sopenharmony_ci    return "Header compression/decompression error";
3011cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_FLOW_CONTROL:
3021cb0ef41Sopenharmony_ci    return "Flow control error";
3031cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INSUFF_BUFSIZE:
3041cb0ef41Sopenharmony_ci    return "Insufficient buffer size given to function";
3051cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_PAUSE:
3061cb0ef41Sopenharmony_ci    return "Callback was paused by the application";
3071cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS:
3081cb0ef41Sopenharmony_ci    return "Too many inflight SETTINGS";
3091cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_PUSH_DISABLED:
3101cb0ef41Sopenharmony_ci    return "Server push is disabled by peer";
3111cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_DATA_EXIST:
3121cb0ef41Sopenharmony_ci    return "DATA or HEADERS frame has already been submitted for the stream";
3131cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_SESSION_CLOSING:
3141cb0ef41Sopenharmony_ci    return "The current session is closing";
3151cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_HTTP_HEADER:
3161cb0ef41Sopenharmony_ci    return "Invalid HTTP header field was received";
3171cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_HTTP_MESSAGING:
3181cb0ef41Sopenharmony_ci    return "Violation in HTTP messaging rule";
3191cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_REFUSED_STREAM:
3201cb0ef41Sopenharmony_ci    return "Stream was refused";
3211cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_INTERNAL:
3221cb0ef41Sopenharmony_ci    return "Internal error";
3231cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_CANCEL:
3241cb0ef41Sopenharmony_ci    return "Cancel";
3251cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_SETTINGS_EXPECTED:
3261cb0ef41Sopenharmony_ci    return "When a local endpoint expects to receive SETTINGS frame, it "
3271cb0ef41Sopenharmony_ci           "receives an other type of frame";
3281cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_NOMEM:
3291cb0ef41Sopenharmony_ci    return "Out of memory";
3301cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_CALLBACK_FAILURE:
3311cb0ef41Sopenharmony_ci    return "The user callback function failed";
3321cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_BAD_CLIENT_MAGIC:
3331cb0ef41Sopenharmony_ci    return "Received bad client magic byte string";
3341cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_FLOODED:
3351cb0ef41Sopenharmony_ci    return "Flooding was detected in this HTTP/2 session, and it must be "
3361cb0ef41Sopenharmony_ci           "closed";
3371cb0ef41Sopenharmony_ci  case NGHTTP2_ERR_TOO_MANY_SETTINGS:
3381cb0ef41Sopenharmony_ci    return "SETTINGS frame contained more than the maximum allowed entries";
3391cb0ef41Sopenharmony_ci  default:
3401cb0ef41Sopenharmony_ci    return "Unknown error code";
3411cb0ef41Sopenharmony_ci  }
3421cb0ef41Sopenharmony_ci}
3431cb0ef41Sopenharmony_ci
3441cb0ef41Sopenharmony_ci/* Generated by gennmchartbl.py */
3451cb0ef41Sopenharmony_cistatic const int VALID_HD_NAME_CHARS[] = {
3461cb0ef41Sopenharmony_ci    0 /* NUL  */, 0 /* SOH  */, 0 /* STX  */, 0 /* ETX  */,
3471cb0ef41Sopenharmony_ci    0 /* EOT  */, 0 /* ENQ  */, 0 /* ACK  */, 0 /* BEL  */,
3481cb0ef41Sopenharmony_ci    0 /* BS   */, 0 /* HT   */, 0 /* LF   */, 0 /* VT   */,
3491cb0ef41Sopenharmony_ci    0 /* FF   */, 0 /* CR   */, 0 /* SO   */, 0 /* SI   */,
3501cb0ef41Sopenharmony_ci    0 /* DLE  */, 0 /* DC1  */, 0 /* DC2  */, 0 /* DC3  */,
3511cb0ef41Sopenharmony_ci    0 /* DC4  */, 0 /* NAK  */, 0 /* SYN  */, 0 /* ETB  */,
3521cb0ef41Sopenharmony_ci    0 /* CAN  */, 0 /* EM   */, 0 /* SUB  */, 0 /* ESC  */,
3531cb0ef41Sopenharmony_ci    0 /* FS   */, 0 /* GS   */, 0 /* RS   */, 0 /* US   */,
3541cb0ef41Sopenharmony_ci    0 /* SPC  */, 1 /* !    */, 0 /* "    */, 1 /* #    */,
3551cb0ef41Sopenharmony_ci    1 /* $    */, 1 /* %    */, 1 /* &    */, 1 /* '    */,
3561cb0ef41Sopenharmony_ci    0 /* (    */, 0 /* )    */, 1 /* *    */, 1 /* +    */,
3571cb0ef41Sopenharmony_ci    0 /* ,    */, 1 /* -    */, 1 /* .    */, 0 /* /    */,
3581cb0ef41Sopenharmony_ci    1 /* 0    */, 1 /* 1    */, 1 /* 2    */, 1 /* 3    */,
3591cb0ef41Sopenharmony_ci    1 /* 4    */, 1 /* 5    */, 1 /* 6    */, 1 /* 7    */,
3601cb0ef41Sopenharmony_ci    1 /* 8    */, 1 /* 9    */, 0 /* :    */, 0 /* ;    */,
3611cb0ef41Sopenharmony_ci    0 /* <    */, 0 /* =    */, 0 /* >    */, 0 /* ?    */,
3621cb0ef41Sopenharmony_ci    0 /* @    */, 0 /* A    */, 0 /* B    */, 0 /* C    */,
3631cb0ef41Sopenharmony_ci    0 /* D    */, 0 /* E    */, 0 /* F    */, 0 /* G    */,
3641cb0ef41Sopenharmony_ci    0 /* H    */, 0 /* I    */, 0 /* J    */, 0 /* K    */,
3651cb0ef41Sopenharmony_ci    0 /* L    */, 0 /* M    */, 0 /* N    */, 0 /* O    */,
3661cb0ef41Sopenharmony_ci    0 /* P    */, 0 /* Q    */, 0 /* R    */, 0 /* S    */,
3671cb0ef41Sopenharmony_ci    0 /* T    */, 0 /* U    */, 0 /* V    */, 0 /* W    */,
3681cb0ef41Sopenharmony_ci    0 /* X    */, 0 /* Y    */, 0 /* Z    */, 0 /* [    */,
3691cb0ef41Sopenharmony_ci    0 /* \    */, 0 /* ]    */, 1 /* ^    */, 1 /* _    */,
3701cb0ef41Sopenharmony_ci    1 /* `    */, 1 /* a    */, 1 /* b    */, 1 /* c    */,
3711cb0ef41Sopenharmony_ci    1 /* d    */, 1 /* e    */, 1 /* f    */, 1 /* g    */,
3721cb0ef41Sopenharmony_ci    1 /* h    */, 1 /* i    */, 1 /* j    */, 1 /* k    */,
3731cb0ef41Sopenharmony_ci    1 /* l    */, 1 /* m    */, 1 /* n    */, 1 /* o    */,
3741cb0ef41Sopenharmony_ci    1 /* p    */, 1 /* q    */, 1 /* r    */, 1 /* s    */,
3751cb0ef41Sopenharmony_ci    1 /* t    */, 1 /* u    */, 1 /* v    */, 1 /* w    */,
3761cb0ef41Sopenharmony_ci    1 /* x    */, 1 /* y    */, 1 /* z    */, 0 /* {    */,
3771cb0ef41Sopenharmony_ci    1 /* |    */, 0 /* }    */, 1 /* ~    */, 0 /* DEL  */,
3781cb0ef41Sopenharmony_ci    0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */,
3791cb0ef41Sopenharmony_ci    0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */,
3801cb0ef41Sopenharmony_ci    0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
3811cb0ef41Sopenharmony_ci    0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */,
3821cb0ef41Sopenharmony_ci    0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */,
3831cb0ef41Sopenharmony_ci    0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */,
3841cb0ef41Sopenharmony_ci    0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */,
3851cb0ef41Sopenharmony_ci    0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
3861cb0ef41Sopenharmony_ci    0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */,
3871cb0ef41Sopenharmony_ci    0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */,
3881cb0ef41Sopenharmony_ci    0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */,
3891cb0ef41Sopenharmony_ci    0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */,
3901cb0ef41Sopenharmony_ci    0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
3911cb0ef41Sopenharmony_ci    0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */,
3921cb0ef41Sopenharmony_ci    0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */,
3931cb0ef41Sopenharmony_ci    0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */,
3941cb0ef41Sopenharmony_ci    0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */,
3951cb0ef41Sopenharmony_ci    0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
3961cb0ef41Sopenharmony_ci    0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */,
3971cb0ef41Sopenharmony_ci    0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */,
3981cb0ef41Sopenharmony_ci    0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */,
3991cb0ef41Sopenharmony_ci    0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */,
4001cb0ef41Sopenharmony_ci    0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
4011cb0ef41Sopenharmony_ci    0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */,
4021cb0ef41Sopenharmony_ci    0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */,
4031cb0ef41Sopenharmony_ci    0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */,
4041cb0ef41Sopenharmony_ci    0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */,
4051cb0ef41Sopenharmony_ci    0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
4061cb0ef41Sopenharmony_ci    0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */,
4071cb0ef41Sopenharmony_ci    0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */,
4081cb0ef41Sopenharmony_ci    0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */,
4091cb0ef41Sopenharmony_ci    0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */
4101cb0ef41Sopenharmony_ci};
4111cb0ef41Sopenharmony_ci
4121cb0ef41Sopenharmony_ciint nghttp2_check_header_name(const uint8_t *name, size_t len) {
4131cb0ef41Sopenharmony_ci  const uint8_t *last;
4141cb0ef41Sopenharmony_ci  if (len == 0) {
4151cb0ef41Sopenharmony_ci    return 0;
4161cb0ef41Sopenharmony_ci  }
4171cb0ef41Sopenharmony_ci  if (*name == ':') {
4181cb0ef41Sopenharmony_ci    if (len == 1) {
4191cb0ef41Sopenharmony_ci      return 0;
4201cb0ef41Sopenharmony_ci    }
4211cb0ef41Sopenharmony_ci    ++name;
4221cb0ef41Sopenharmony_ci    --len;
4231cb0ef41Sopenharmony_ci  }
4241cb0ef41Sopenharmony_ci  for (last = name + len; name != last; ++name) {
4251cb0ef41Sopenharmony_ci    if (!VALID_HD_NAME_CHARS[*name]) {
4261cb0ef41Sopenharmony_ci      return 0;
4271cb0ef41Sopenharmony_ci    }
4281cb0ef41Sopenharmony_ci  }
4291cb0ef41Sopenharmony_ci  return 1;
4301cb0ef41Sopenharmony_ci}
4311cb0ef41Sopenharmony_ci
4321cb0ef41Sopenharmony_ci/* Generated by genvchartbl.py */
4331cb0ef41Sopenharmony_cistatic const int VALID_HD_VALUE_CHARS[] = {
4341cb0ef41Sopenharmony_ci    0 /* NUL  */, 0 /* SOH  */, 0 /* STX  */, 0 /* ETX  */,
4351cb0ef41Sopenharmony_ci    0 /* EOT  */, 0 /* ENQ  */, 0 /* ACK  */, 0 /* BEL  */,
4361cb0ef41Sopenharmony_ci    0 /* BS   */, 1 /* HT   */, 0 /* LF   */, 0 /* VT   */,
4371cb0ef41Sopenharmony_ci    0 /* FF   */, 0 /* CR   */, 0 /* SO   */, 0 /* SI   */,
4381cb0ef41Sopenharmony_ci    0 /* DLE  */, 0 /* DC1  */, 0 /* DC2  */, 0 /* DC3  */,
4391cb0ef41Sopenharmony_ci    0 /* DC4  */, 0 /* NAK  */, 0 /* SYN  */, 0 /* ETB  */,
4401cb0ef41Sopenharmony_ci    0 /* CAN  */, 0 /* EM   */, 0 /* SUB  */, 0 /* ESC  */,
4411cb0ef41Sopenharmony_ci    0 /* FS   */, 0 /* GS   */, 0 /* RS   */, 0 /* US   */,
4421cb0ef41Sopenharmony_ci    1 /* SPC  */, 1 /* !    */, 1 /* "    */, 1 /* #    */,
4431cb0ef41Sopenharmony_ci    1 /* $    */, 1 /* %    */, 1 /* &    */, 1 /* '    */,
4441cb0ef41Sopenharmony_ci    1 /* (    */, 1 /* )    */, 1 /* *    */, 1 /* +    */,
4451cb0ef41Sopenharmony_ci    1 /* ,    */, 1 /* -    */, 1 /* .    */, 1 /* /    */,
4461cb0ef41Sopenharmony_ci    1 /* 0    */, 1 /* 1    */, 1 /* 2    */, 1 /* 3    */,
4471cb0ef41Sopenharmony_ci    1 /* 4    */, 1 /* 5    */, 1 /* 6    */, 1 /* 7    */,
4481cb0ef41Sopenharmony_ci    1 /* 8    */, 1 /* 9    */, 1 /* :    */, 1 /* ;    */,
4491cb0ef41Sopenharmony_ci    1 /* <    */, 1 /* =    */, 1 /* >    */, 1 /* ?    */,
4501cb0ef41Sopenharmony_ci    1 /* @    */, 1 /* A    */, 1 /* B    */, 1 /* C    */,
4511cb0ef41Sopenharmony_ci    1 /* D    */, 1 /* E    */, 1 /* F    */, 1 /* G    */,
4521cb0ef41Sopenharmony_ci    1 /* H    */, 1 /* I    */, 1 /* J    */, 1 /* K    */,
4531cb0ef41Sopenharmony_ci    1 /* L    */, 1 /* M    */, 1 /* N    */, 1 /* O    */,
4541cb0ef41Sopenharmony_ci    1 /* P    */, 1 /* Q    */, 1 /* R    */, 1 /* S    */,
4551cb0ef41Sopenharmony_ci    1 /* T    */, 1 /* U    */, 1 /* V    */, 1 /* W    */,
4561cb0ef41Sopenharmony_ci    1 /* X    */, 1 /* Y    */, 1 /* Z    */, 1 /* [    */,
4571cb0ef41Sopenharmony_ci    1 /* \    */, 1 /* ]    */, 1 /* ^    */, 1 /* _    */,
4581cb0ef41Sopenharmony_ci    1 /* `    */, 1 /* a    */, 1 /* b    */, 1 /* c    */,
4591cb0ef41Sopenharmony_ci    1 /* d    */, 1 /* e    */, 1 /* f    */, 1 /* g    */,
4601cb0ef41Sopenharmony_ci    1 /* h    */, 1 /* i    */, 1 /* j    */, 1 /* k    */,
4611cb0ef41Sopenharmony_ci    1 /* l    */, 1 /* m    */, 1 /* n    */, 1 /* o    */,
4621cb0ef41Sopenharmony_ci    1 /* p    */, 1 /* q    */, 1 /* r    */, 1 /* s    */,
4631cb0ef41Sopenharmony_ci    1 /* t    */, 1 /* u    */, 1 /* v    */, 1 /* w    */,
4641cb0ef41Sopenharmony_ci    1 /* x    */, 1 /* y    */, 1 /* z    */, 1 /* {    */,
4651cb0ef41Sopenharmony_ci    1 /* |    */, 1 /* }    */, 1 /* ~    */, 0 /* DEL  */,
4661cb0ef41Sopenharmony_ci    1 /* 0x80 */, 1 /* 0x81 */, 1 /* 0x82 */, 1 /* 0x83 */,
4671cb0ef41Sopenharmony_ci    1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, 1 /* 0x87 */,
4681cb0ef41Sopenharmony_ci    1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */,
4691cb0ef41Sopenharmony_ci    1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */,
4701cb0ef41Sopenharmony_ci    1 /* 0x90 */, 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */,
4711cb0ef41Sopenharmony_ci    1 /* 0x94 */, 1 /* 0x95 */, 1 /* 0x96 */, 1 /* 0x97 */,
4721cb0ef41Sopenharmony_ci    1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, 1 /* 0x9b */,
4731cb0ef41Sopenharmony_ci    1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */,
4741cb0ef41Sopenharmony_ci    1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */,
4751cb0ef41Sopenharmony_ci    1 /* 0xa4 */, 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */,
4761cb0ef41Sopenharmony_ci    1 /* 0xa8 */, 1 /* 0xa9 */, 1 /* 0xaa */, 1 /* 0xab */,
4771cb0ef41Sopenharmony_ci    1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, 1 /* 0xaf */,
4781cb0ef41Sopenharmony_ci    1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */,
4791cb0ef41Sopenharmony_ci    1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */,
4801cb0ef41Sopenharmony_ci    1 /* 0xb8 */, 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */,
4811cb0ef41Sopenharmony_ci    1 /* 0xbc */, 1 /* 0xbd */, 1 /* 0xbe */, 1 /* 0xbf */,
4821cb0ef41Sopenharmony_ci    1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, 1 /* 0xc3 */,
4831cb0ef41Sopenharmony_ci    1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */,
4841cb0ef41Sopenharmony_ci    1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */,
4851cb0ef41Sopenharmony_ci    1 /* 0xcc */, 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */,
4861cb0ef41Sopenharmony_ci    1 /* 0xd0 */, 1 /* 0xd1 */, 1 /* 0xd2 */, 1 /* 0xd3 */,
4871cb0ef41Sopenharmony_ci    1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, 1 /* 0xd7 */,
4881cb0ef41Sopenharmony_ci    1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */,
4891cb0ef41Sopenharmony_ci    1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */,
4901cb0ef41Sopenharmony_ci    1 /* 0xe0 */, 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */,
4911cb0ef41Sopenharmony_ci    1 /* 0xe4 */, 1 /* 0xe5 */, 1 /* 0xe6 */, 1 /* 0xe7 */,
4921cb0ef41Sopenharmony_ci    1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, 1 /* 0xeb */,
4931cb0ef41Sopenharmony_ci    1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */,
4941cb0ef41Sopenharmony_ci    1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */,
4951cb0ef41Sopenharmony_ci    1 /* 0xf4 */, 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */,
4961cb0ef41Sopenharmony_ci    1 /* 0xf8 */, 1 /* 0xf9 */, 1 /* 0xfa */, 1 /* 0xfb */,
4971cb0ef41Sopenharmony_ci    1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, 1 /* 0xff */
4981cb0ef41Sopenharmony_ci};
4991cb0ef41Sopenharmony_ci
5001cb0ef41Sopenharmony_ciint nghttp2_check_header_value(const uint8_t *value, size_t len) {
5011cb0ef41Sopenharmony_ci  const uint8_t *last;
5021cb0ef41Sopenharmony_ci  for (last = value + len; value != last; ++value) {
5031cb0ef41Sopenharmony_ci    if (!VALID_HD_VALUE_CHARS[*value]) {
5041cb0ef41Sopenharmony_ci      return 0;
5051cb0ef41Sopenharmony_ci    }
5061cb0ef41Sopenharmony_ci  }
5071cb0ef41Sopenharmony_ci  return 1;
5081cb0ef41Sopenharmony_ci}
5091cb0ef41Sopenharmony_ci
5101cb0ef41Sopenharmony_ciint nghttp2_check_header_value_rfc9113(const uint8_t *value, size_t len) {
5111cb0ef41Sopenharmony_ci  if (len == 0) {
5121cb0ef41Sopenharmony_ci    return 1;
5131cb0ef41Sopenharmony_ci  }
5141cb0ef41Sopenharmony_ci
5151cb0ef41Sopenharmony_ci  if (*value == ' ' || *value == '\t' || *(value + len - 1) == ' ' ||
5161cb0ef41Sopenharmony_ci      *(value + len - 1) == '\t') {
5171cb0ef41Sopenharmony_ci    return 0;
5181cb0ef41Sopenharmony_ci  }
5191cb0ef41Sopenharmony_ci
5201cb0ef41Sopenharmony_ci  return nghttp2_check_header_value(value, len);
5211cb0ef41Sopenharmony_ci}
5221cb0ef41Sopenharmony_ci
5231cb0ef41Sopenharmony_ci/* Generated by genmethodchartbl.py */
5241cb0ef41Sopenharmony_cistatic char VALID_METHOD_CHARS[] = {
5251cb0ef41Sopenharmony_ci    0 /* NUL  */, 0 /* SOH  */, 0 /* STX  */, 0 /* ETX  */,
5261cb0ef41Sopenharmony_ci    0 /* EOT  */, 0 /* ENQ  */, 0 /* ACK  */, 0 /* BEL  */,
5271cb0ef41Sopenharmony_ci    0 /* BS   */, 0 /* HT   */, 0 /* LF   */, 0 /* VT   */,
5281cb0ef41Sopenharmony_ci    0 /* FF   */, 0 /* CR   */, 0 /* SO   */, 0 /* SI   */,
5291cb0ef41Sopenharmony_ci    0 /* DLE  */, 0 /* DC1  */, 0 /* DC2  */, 0 /* DC3  */,
5301cb0ef41Sopenharmony_ci    0 /* DC4  */, 0 /* NAK  */, 0 /* SYN  */, 0 /* ETB  */,
5311cb0ef41Sopenharmony_ci    0 /* CAN  */, 0 /* EM   */, 0 /* SUB  */, 0 /* ESC  */,
5321cb0ef41Sopenharmony_ci    0 /* FS   */, 0 /* GS   */, 0 /* RS   */, 0 /* US   */,
5331cb0ef41Sopenharmony_ci    0 /* SPC  */, 1 /* !    */, 0 /* "    */, 1 /* #    */,
5341cb0ef41Sopenharmony_ci    1 /* $    */, 1 /* %    */, 1 /* &    */, 1 /* '    */,
5351cb0ef41Sopenharmony_ci    0 /* (    */, 0 /* )    */, 1 /* *    */, 1 /* +    */,
5361cb0ef41Sopenharmony_ci    0 /* ,    */, 1 /* -    */, 1 /* .    */, 0 /* /    */,
5371cb0ef41Sopenharmony_ci    1 /* 0    */, 1 /* 1    */, 1 /* 2    */, 1 /* 3    */,
5381cb0ef41Sopenharmony_ci    1 /* 4    */, 1 /* 5    */, 1 /* 6    */, 1 /* 7    */,
5391cb0ef41Sopenharmony_ci    1 /* 8    */, 1 /* 9    */, 0 /* :    */, 0 /* ;    */,
5401cb0ef41Sopenharmony_ci    0 /* <    */, 0 /* =    */, 0 /* >    */, 0 /* ?    */,
5411cb0ef41Sopenharmony_ci    0 /* @    */, 1 /* A    */, 1 /* B    */, 1 /* C    */,
5421cb0ef41Sopenharmony_ci    1 /* D    */, 1 /* E    */, 1 /* F    */, 1 /* G    */,
5431cb0ef41Sopenharmony_ci    1 /* H    */, 1 /* I    */, 1 /* J    */, 1 /* K    */,
5441cb0ef41Sopenharmony_ci    1 /* L    */, 1 /* M    */, 1 /* N    */, 1 /* O    */,
5451cb0ef41Sopenharmony_ci    1 /* P    */, 1 /* Q    */, 1 /* R    */, 1 /* S    */,
5461cb0ef41Sopenharmony_ci    1 /* T    */, 1 /* U    */, 1 /* V    */, 1 /* W    */,
5471cb0ef41Sopenharmony_ci    1 /* X    */, 1 /* Y    */, 1 /* Z    */, 0 /* [    */,
5481cb0ef41Sopenharmony_ci    0 /* \    */, 0 /* ]    */, 1 /* ^    */, 1 /* _    */,
5491cb0ef41Sopenharmony_ci    1 /* `    */, 1 /* a    */, 1 /* b    */, 1 /* c    */,
5501cb0ef41Sopenharmony_ci    1 /* d    */, 1 /* e    */, 1 /* f    */, 1 /* g    */,
5511cb0ef41Sopenharmony_ci    1 /* h    */, 1 /* i    */, 1 /* j    */, 1 /* k    */,
5521cb0ef41Sopenharmony_ci    1 /* l    */, 1 /* m    */, 1 /* n    */, 1 /* o    */,
5531cb0ef41Sopenharmony_ci    1 /* p    */, 1 /* q    */, 1 /* r    */, 1 /* s    */,
5541cb0ef41Sopenharmony_ci    1 /* t    */, 1 /* u    */, 1 /* v    */, 1 /* w    */,
5551cb0ef41Sopenharmony_ci    1 /* x    */, 1 /* y    */, 1 /* z    */, 0 /* {    */,
5561cb0ef41Sopenharmony_ci    1 /* |    */, 0 /* }    */, 1 /* ~    */, 0 /* DEL  */,
5571cb0ef41Sopenharmony_ci    0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */,
5581cb0ef41Sopenharmony_ci    0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */,
5591cb0ef41Sopenharmony_ci    0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
5601cb0ef41Sopenharmony_ci    0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */,
5611cb0ef41Sopenharmony_ci    0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */,
5621cb0ef41Sopenharmony_ci    0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */,
5631cb0ef41Sopenharmony_ci    0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */,
5641cb0ef41Sopenharmony_ci    0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
5651cb0ef41Sopenharmony_ci    0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */,
5661cb0ef41Sopenharmony_ci    0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */,
5671cb0ef41Sopenharmony_ci    0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */,
5681cb0ef41Sopenharmony_ci    0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */,
5691cb0ef41Sopenharmony_ci    0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
5701cb0ef41Sopenharmony_ci    0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */,
5711cb0ef41Sopenharmony_ci    0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */,
5721cb0ef41Sopenharmony_ci    0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */,
5731cb0ef41Sopenharmony_ci    0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */,
5741cb0ef41Sopenharmony_ci    0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
5751cb0ef41Sopenharmony_ci    0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */,
5761cb0ef41Sopenharmony_ci    0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */,
5771cb0ef41Sopenharmony_ci    0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */,
5781cb0ef41Sopenharmony_ci    0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */,
5791cb0ef41Sopenharmony_ci    0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
5801cb0ef41Sopenharmony_ci    0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */,
5811cb0ef41Sopenharmony_ci    0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */,
5821cb0ef41Sopenharmony_ci    0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */,
5831cb0ef41Sopenharmony_ci    0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */,
5841cb0ef41Sopenharmony_ci    0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
5851cb0ef41Sopenharmony_ci    0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */,
5861cb0ef41Sopenharmony_ci    0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */,
5871cb0ef41Sopenharmony_ci    0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */,
5881cb0ef41Sopenharmony_ci    0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */
5891cb0ef41Sopenharmony_ci};
5901cb0ef41Sopenharmony_ci
5911cb0ef41Sopenharmony_ciint nghttp2_check_method(const uint8_t *value, size_t len) {
5921cb0ef41Sopenharmony_ci  const uint8_t *last;
5931cb0ef41Sopenharmony_ci  if (len == 0) {
5941cb0ef41Sopenharmony_ci    return 0;
5951cb0ef41Sopenharmony_ci  }
5961cb0ef41Sopenharmony_ci  for (last = value + len; value != last; ++value) {
5971cb0ef41Sopenharmony_ci    if (!VALID_METHOD_CHARS[*value]) {
5981cb0ef41Sopenharmony_ci      return 0;
5991cb0ef41Sopenharmony_ci    }
6001cb0ef41Sopenharmony_ci  }
6011cb0ef41Sopenharmony_ci  return 1;
6021cb0ef41Sopenharmony_ci}
6031cb0ef41Sopenharmony_ci
6041cb0ef41Sopenharmony_ci/* Generated by genpathchartbl.py */
6051cb0ef41Sopenharmony_cistatic char VALID_PATH_CHARS[] = {
6061cb0ef41Sopenharmony_ci    0 /* NUL  */, 0 /* SOH  */, 0 /* STX  */, 0 /* ETX  */,
6071cb0ef41Sopenharmony_ci    0 /* EOT  */, 0 /* ENQ  */, 0 /* ACK  */, 0 /* BEL  */,
6081cb0ef41Sopenharmony_ci    0 /* BS   */, 0 /* HT   */, 0 /* LF   */, 0 /* VT   */,
6091cb0ef41Sopenharmony_ci    0 /* FF   */, 0 /* CR   */, 0 /* SO   */, 0 /* SI   */,
6101cb0ef41Sopenharmony_ci    0 /* DLE  */, 0 /* DC1  */, 0 /* DC2  */, 0 /* DC3  */,
6111cb0ef41Sopenharmony_ci    0 /* DC4  */, 0 /* NAK  */, 0 /* SYN  */, 0 /* ETB  */,
6121cb0ef41Sopenharmony_ci    0 /* CAN  */, 0 /* EM   */, 0 /* SUB  */, 0 /* ESC  */,
6131cb0ef41Sopenharmony_ci    0 /* FS   */, 0 /* GS   */, 0 /* RS   */, 0 /* US   */,
6141cb0ef41Sopenharmony_ci    0 /* SPC  */, 1 /* !    */, 1 /* "    */, 1 /* #    */,
6151cb0ef41Sopenharmony_ci    1 /* $    */, 1 /* %    */, 1 /* &    */, 1 /* '    */,
6161cb0ef41Sopenharmony_ci    1 /* (    */, 1 /* )    */, 1 /* *    */, 1 /* +    */,
6171cb0ef41Sopenharmony_ci    1 /* ,    */, 1 /* -    */, 1 /* .    */, 1 /* /    */,
6181cb0ef41Sopenharmony_ci    1 /* 0    */, 1 /* 1    */, 1 /* 2    */, 1 /* 3    */,
6191cb0ef41Sopenharmony_ci    1 /* 4    */, 1 /* 5    */, 1 /* 6    */, 1 /* 7    */,
6201cb0ef41Sopenharmony_ci    1 /* 8    */, 1 /* 9    */, 1 /* :    */, 1 /* ;    */,
6211cb0ef41Sopenharmony_ci    1 /* <    */, 1 /* =    */, 1 /* >    */, 1 /* ?    */,
6221cb0ef41Sopenharmony_ci    1 /* @    */, 1 /* A    */, 1 /* B    */, 1 /* C    */,
6231cb0ef41Sopenharmony_ci    1 /* D    */, 1 /* E    */, 1 /* F    */, 1 /* G    */,
6241cb0ef41Sopenharmony_ci    1 /* H    */, 1 /* I    */, 1 /* J    */, 1 /* K    */,
6251cb0ef41Sopenharmony_ci    1 /* L    */, 1 /* M    */, 1 /* N    */, 1 /* O    */,
6261cb0ef41Sopenharmony_ci    1 /* P    */, 1 /* Q    */, 1 /* R    */, 1 /* S    */,
6271cb0ef41Sopenharmony_ci    1 /* T    */, 1 /* U    */, 1 /* V    */, 1 /* W    */,
6281cb0ef41Sopenharmony_ci    1 /* X    */, 1 /* Y    */, 1 /* Z    */, 1 /* [    */,
6291cb0ef41Sopenharmony_ci    1 /* \    */, 1 /* ]    */, 1 /* ^    */, 1 /* _    */,
6301cb0ef41Sopenharmony_ci    1 /* `    */, 1 /* a    */, 1 /* b    */, 1 /* c    */,
6311cb0ef41Sopenharmony_ci    1 /* d    */, 1 /* e    */, 1 /* f    */, 1 /* g    */,
6321cb0ef41Sopenharmony_ci    1 /* h    */, 1 /* i    */, 1 /* j    */, 1 /* k    */,
6331cb0ef41Sopenharmony_ci    1 /* l    */, 1 /* m    */, 1 /* n    */, 1 /* o    */,
6341cb0ef41Sopenharmony_ci    1 /* p    */, 1 /* q    */, 1 /* r    */, 1 /* s    */,
6351cb0ef41Sopenharmony_ci    1 /* t    */, 1 /* u    */, 1 /* v    */, 1 /* w    */,
6361cb0ef41Sopenharmony_ci    1 /* x    */, 1 /* y    */, 1 /* z    */, 1 /* {    */,
6371cb0ef41Sopenharmony_ci    1 /* |    */, 1 /* }    */, 1 /* ~    */, 0 /* DEL  */,
6381cb0ef41Sopenharmony_ci    1 /* 0x80 */, 1 /* 0x81 */, 1 /* 0x82 */, 1 /* 0x83 */,
6391cb0ef41Sopenharmony_ci    1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, 1 /* 0x87 */,
6401cb0ef41Sopenharmony_ci    1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */,
6411cb0ef41Sopenharmony_ci    1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */,
6421cb0ef41Sopenharmony_ci    1 /* 0x90 */, 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */,
6431cb0ef41Sopenharmony_ci    1 /* 0x94 */, 1 /* 0x95 */, 1 /* 0x96 */, 1 /* 0x97 */,
6441cb0ef41Sopenharmony_ci    1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, 1 /* 0x9b */,
6451cb0ef41Sopenharmony_ci    1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */,
6461cb0ef41Sopenharmony_ci    1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */,
6471cb0ef41Sopenharmony_ci    1 /* 0xa4 */, 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */,
6481cb0ef41Sopenharmony_ci    1 /* 0xa8 */, 1 /* 0xa9 */, 1 /* 0xaa */, 1 /* 0xab */,
6491cb0ef41Sopenharmony_ci    1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, 1 /* 0xaf */,
6501cb0ef41Sopenharmony_ci    1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */,
6511cb0ef41Sopenharmony_ci    1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */,
6521cb0ef41Sopenharmony_ci    1 /* 0xb8 */, 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */,
6531cb0ef41Sopenharmony_ci    1 /* 0xbc */, 1 /* 0xbd */, 1 /* 0xbe */, 1 /* 0xbf */,
6541cb0ef41Sopenharmony_ci    1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, 1 /* 0xc3 */,
6551cb0ef41Sopenharmony_ci    1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */,
6561cb0ef41Sopenharmony_ci    1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */,
6571cb0ef41Sopenharmony_ci    1 /* 0xcc */, 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */,
6581cb0ef41Sopenharmony_ci    1 /* 0xd0 */, 1 /* 0xd1 */, 1 /* 0xd2 */, 1 /* 0xd3 */,
6591cb0ef41Sopenharmony_ci    1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, 1 /* 0xd7 */,
6601cb0ef41Sopenharmony_ci    1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */,
6611cb0ef41Sopenharmony_ci    1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */,
6621cb0ef41Sopenharmony_ci    1 /* 0xe0 */, 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */,
6631cb0ef41Sopenharmony_ci    1 /* 0xe4 */, 1 /* 0xe5 */, 1 /* 0xe6 */, 1 /* 0xe7 */,
6641cb0ef41Sopenharmony_ci    1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, 1 /* 0xeb */,
6651cb0ef41Sopenharmony_ci    1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */,
6661cb0ef41Sopenharmony_ci    1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */,
6671cb0ef41Sopenharmony_ci    1 /* 0xf4 */, 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */,
6681cb0ef41Sopenharmony_ci    1 /* 0xf8 */, 1 /* 0xf9 */, 1 /* 0xfa */, 1 /* 0xfb */,
6691cb0ef41Sopenharmony_ci    1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, 1 /* 0xff */
6701cb0ef41Sopenharmony_ci};
6711cb0ef41Sopenharmony_ci
6721cb0ef41Sopenharmony_ciint nghttp2_check_path(const uint8_t *value, size_t len) {
6731cb0ef41Sopenharmony_ci  const uint8_t *last;
6741cb0ef41Sopenharmony_ci  for (last = value + len; value != last; ++value) {
6751cb0ef41Sopenharmony_ci    if (!VALID_PATH_CHARS[*value]) {
6761cb0ef41Sopenharmony_ci      return 0;
6771cb0ef41Sopenharmony_ci    }
6781cb0ef41Sopenharmony_ci  }
6791cb0ef41Sopenharmony_ci  return 1;
6801cb0ef41Sopenharmony_ci}
6811cb0ef41Sopenharmony_ci
6821cb0ef41Sopenharmony_ci/* Generated by genauthoritychartbl.py */
6831cb0ef41Sopenharmony_cistatic char VALID_AUTHORITY_CHARS[] = {
6841cb0ef41Sopenharmony_ci    0 /* NUL  */, 0 /* SOH  */, 0 /* STX  */, 0 /* ETX  */,
6851cb0ef41Sopenharmony_ci    0 /* EOT  */, 0 /* ENQ  */, 0 /* ACK  */, 0 /* BEL  */,
6861cb0ef41Sopenharmony_ci    0 /* BS   */, 0 /* HT   */, 0 /* LF   */, 0 /* VT   */,
6871cb0ef41Sopenharmony_ci    0 /* FF   */, 0 /* CR   */, 0 /* SO   */, 0 /* SI   */,
6881cb0ef41Sopenharmony_ci    0 /* DLE  */, 0 /* DC1  */, 0 /* DC2  */, 0 /* DC3  */,
6891cb0ef41Sopenharmony_ci    0 /* DC4  */, 0 /* NAK  */, 0 /* SYN  */, 0 /* ETB  */,
6901cb0ef41Sopenharmony_ci    0 /* CAN  */, 0 /* EM   */, 0 /* SUB  */, 0 /* ESC  */,
6911cb0ef41Sopenharmony_ci    0 /* FS   */, 0 /* GS   */, 0 /* RS   */, 0 /* US   */,
6921cb0ef41Sopenharmony_ci    0 /* SPC  */, 1 /* !    */, 0 /* "    */, 0 /* #    */,
6931cb0ef41Sopenharmony_ci    1 /* $    */, 1 /* %    */, 1 /* &    */, 1 /* '    */,
6941cb0ef41Sopenharmony_ci    1 /* (    */, 1 /* )    */, 1 /* *    */, 1 /* +    */,
6951cb0ef41Sopenharmony_ci    1 /* ,    */, 1 /* -    */, 1 /* .    */, 0 /* /    */,
6961cb0ef41Sopenharmony_ci    1 /* 0    */, 1 /* 1    */, 1 /* 2    */, 1 /* 3    */,
6971cb0ef41Sopenharmony_ci    1 /* 4    */, 1 /* 5    */, 1 /* 6    */, 1 /* 7    */,
6981cb0ef41Sopenharmony_ci    1 /* 8    */, 1 /* 9    */, 1 /* :    */, 1 /* ;    */,
6991cb0ef41Sopenharmony_ci    0 /* <    */, 1 /* =    */, 0 /* >    */, 0 /* ?    */,
7001cb0ef41Sopenharmony_ci    1 /* @    */, 1 /* A    */, 1 /* B    */, 1 /* C    */,
7011cb0ef41Sopenharmony_ci    1 /* D    */, 1 /* E    */, 1 /* F    */, 1 /* G    */,
7021cb0ef41Sopenharmony_ci    1 /* H    */, 1 /* I    */, 1 /* J    */, 1 /* K    */,
7031cb0ef41Sopenharmony_ci    1 /* L    */, 1 /* M    */, 1 /* N    */, 1 /* O    */,
7041cb0ef41Sopenharmony_ci    1 /* P    */, 1 /* Q    */, 1 /* R    */, 1 /* S    */,
7051cb0ef41Sopenharmony_ci    1 /* T    */, 1 /* U    */, 1 /* V    */, 1 /* W    */,
7061cb0ef41Sopenharmony_ci    1 /* X    */, 1 /* Y    */, 1 /* Z    */, 1 /* [    */,
7071cb0ef41Sopenharmony_ci    0 /* \    */, 1 /* ]    */, 0 /* ^    */, 1 /* _    */,
7081cb0ef41Sopenharmony_ci    0 /* `    */, 1 /* a    */, 1 /* b    */, 1 /* c    */,
7091cb0ef41Sopenharmony_ci    1 /* d    */, 1 /* e    */, 1 /* f    */, 1 /* g    */,
7101cb0ef41Sopenharmony_ci    1 /* h    */, 1 /* i    */, 1 /* j    */, 1 /* k    */,
7111cb0ef41Sopenharmony_ci    1 /* l    */, 1 /* m    */, 1 /* n    */, 1 /* o    */,
7121cb0ef41Sopenharmony_ci    1 /* p    */, 1 /* q    */, 1 /* r    */, 1 /* s    */,
7131cb0ef41Sopenharmony_ci    1 /* t    */, 1 /* u    */, 1 /* v    */, 1 /* w    */,
7141cb0ef41Sopenharmony_ci    1 /* x    */, 1 /* y    */, 1 /* z    */, 0 /* {    */,
7151cb0ef41Sopenharmony_ci    0 /* |    */, 0 /* }    */, 1 /* ~    */, 0 /* DEL  */,
7161cb0ef41Sopenharmony_ci    0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */,
7171cb0ef41Sopenharmony_ci    0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */,
7181cb0ef41Sopenharmony_ci    0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
7191cb0ef41Sopenharmony_ci    0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */,
7201cb0ef41Sopenharmony_ci    0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */,
7211cb0ef41Sopenharmony_ci    0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */,
7221cb0ef41Sopenharmony_ci    0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */,
7231cb0ef41Sopenharmony_ci    0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
7241cb0ef41Sopenharmony_ci    0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */,
7251cb0ef41Sopenharmony_ci    0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */,
7261cb0ef41Sopenharmony_ci    0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */,
7271cb0ef41Sopenharmony_ci    0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */,
7281cb0ef41Sopenharmony_ci    0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
7291cb0ef41Sopenharmony_ci    0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */,
7301cb0ef41Sopenharmony_ci    0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */,
7311cb0ef41Sopenharmony_ci    0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */,
7321cb0ef41Sopenharmony_ci    0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */,
7331cb0ef41Sopenharmony_ci    0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
7341cb0ef41Sopenharmony_ci    0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */,
7351cb0ef41Sopenharmony_ci    0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */,
7361cb0ef41Sopenharmony_ci    0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */,
7371cb0ef41Sopenharmony_ci    0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */,
7381cb0ef41Sopenharmony_ci    0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
7391cb0ef41Sopenharmony_ci    0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */,
7401cb0ef41Sopenharmony_ci    0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */,
7411cb0ef41Sopenharmony_ci    0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */,
7421cb0ef41Sopenharmony_ci    0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */,
7431cb0ef41Sopenharmony_ci    0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
7441cb0ef41Sopenharmony_ci    0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */,
7451cb0ef41Sopenharmony_ci    0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */,
7461cb0ef41Sopenharmony_ci    0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */,
7471cb0ef41Sopenharmony_ci    0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */
7481cb0ef41Sopenharmony_ci};
7491cb0ef41Sopenharmony_ci
7501cb0ef41Sopenharmony_ciint nghttp2_check_authority(const uint8_t *value, size_t len) {
7511cb0ef41Sopenharmony_ci  const uint8_t *last;
7521cb0ef41Sopenharmony_ci  for (last = value + len; value != last; ++value) {
7531cb0ef41Sopenharmony_ci    if (!VALID_AUTHORITY_CHARS[*value]) {
7541cb0ef41Sopenharmony_ci      return 0;
7551cb0ef41Sopenharmony_ci    }
7561cb0ef41Sopenharmony_ci  }
7571cb0ef41Sopenharmony_ci  return 1;
7581cb0ef41Sopenharmony_ci}
7591cb0ef41Sopenharmony_ci
7601cb0ef41Sopenharmony_ciuint8_t *nghttp2_cpymem(uint8_t *dest, const void *src, size_t len) {
7611cb0ef41Sopenharmony_ci  if (len == 0) {
7621cb0ef41Sopenharmony_ci    return dest;
7631cb0ef41Sopenharmony_ci  }
7641cb0ef41Sopenharmony_ci
7651cb0ef41Sopenharmony_ci  memcpy(dest, src, len);
7661cb0ef41Sopenharmony_ci
7671cb0ef41Sopenharmony_ci  return dest + len;
7681cb0ef41Sopenharmony_ci}
7691cb0ef41Sopenharmony_ci
7701cb0ef41Sopenharmony_ciconst char *nghttp2_http2_strerror(uint32_t error_code) {
7711cb0ef41Sopenharmony_ci  switch (error_code) {
7721cb0ef41Sopenharmony_ci  case NGHTTP2_NO_ERROR:
7731cb0ef41Sopenharmony_ci    return "NO_ERROR";
7741cb0ef41Sopenharmony_ci  case NGHTTP2_PROTOCOL_ERROR:
7751cb0ef41Sopenharmony_ci    return "PROTOCOL_ERROR";
7761cb0ef41Sopenharmony_ci  case NGHTTP2_INTERNAL_ERROR:
7771cb0ef41Sopenharmony_ci    return "INTERNAL_ERROR";
7781cb0ef41Sopenharmony_ci  case NGHTTP2_FLOW_CONTROL_ERROR:
7791cb0ef41Sopenharmony_ci    return "FLOW_CONTROL_ERROR";
7801cb0ef41Sopenharmony_ci  case NGHTTP2_SETTINGS_TIMEOUT:
7811cb0ef41Sopenharmony_ci    return "SETTINGS_TIMEOUT";
7821cb0ef41Sopenharmony_ci  case NGHTTP2_STREAM_CLOSED:
7831cb0ef41Sopenharmony_ci    return "STREAM_CLOSED";
7841cb0ef41Sopenharmony_ci  case NGHTTP2_FRAME_SIZE_ERROR:
7851cb0ef41Sopenharmony_ci    return "FRAME_SIZE_ERROR";
7861cb0ef41Sopenharmony_ci  case NGHTTP2_REFUSED_STREAM:
7871cb0ef41Sopenharmony_ci    return "REFUSED_STREAM";
7881cb0ef41Sopenharmony_ci  case NGHTTP2_CANCEL:
7891cb0ef41Sopenharmony_ci    return "CANCEL";
7901cb0ef41Sopenharmony_ci  case NGHTTP2_COMPRESSION_ERROR:
7911cb0ef41Sopenharmony_ci    return "COMPRESSION_ERROR";
7921cb0ef41Sopenharmony_ci  case NGHTTP2_CONNECT_ERROR:
7931cb0ef41Sopenharmony_ci    return "CONNECT_ERROR";
7941cb0ef41Sopenharmony_ci  case NGHTTP2_ENHANCE_YOUR_CALM:
7951cb0ef41Sopenharmony_ci    return "ENHANCE_YOUR_CALM";
7961cb0ef41Sopenharmony_ci  case NGHTTP2_INADEQUATE_SECURITY:
7971cb0ef41Sopenharmony_ci    return "INADEQUATE_SECURITY";
7981cb0ef41Sopenharmony_ci  case NGHTTP2_HTTP_1_1_REQUIRED:
7991cb0ef41Sopenharmony_ci    return "HTTP_1_1_REQUIRED";
8001cb0ef41Sopenharmony_ci  default:
8011cb0ef41Sopenharmony_ci    return "unknown";
8021cb0ef41Sopenharmony_ci  }
8031cb0ef41Sopenharmony_ci}
804