GeezerVison is showing github.com — deps: update nghttp2 to 1.34.0 · nodejs/node@95bdf37
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/includes/nghttp2/nghttp2.h +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -680,7 +680,12 @@ typedef enum { | 680 | 680 | /** | 681 | 681 | * SETTINGS_MAX_HEADER_LIST_SIZE | 682 | 682 | */ | 683 | | - NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 0x06 | | 683 | + NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 0x06, | | 684 | + /** | | 685 | + * SETTINGS_ENABLE_CONNECT_PROTOCOL | | 686 | + * (`RFC 8441 <https://tools.ietf.org/html/rfc8441>`_) | | 687 | + */ | | 688 | + NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x08 | 684 | 689 | } nghttp2_settings_id; | 685 | 690 | /* Note: If we add SETTINGS, update the capacity of | 686 | 691 | NGHTTP2_INBOUND_NUM_IV as well */ | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | * @macro | 30 | 30 | * Version number of the nghttp2 library release | 31 | 31 | */ | 32 | | -#define NGHTTP2_VERSION "1.33.0" | | 32 | +#define NGHTTP2_VERSION "1.34.0" | 33 | 33 |
| 34 | 34 | /** | 35 | 35 | * @macro | 36 | 36 | * Numerical representation of the version number of the nghttp2 library | 37 | 37 | * release. This is a 24 bit number with 8 bits for major number, 8 bits | 38 | 38 | * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. | 39 | 39 | */ | 40 | | -#define NGHTTP2_VERSION_NUM 0x012100 | | 40 | +#define NGHTTP2_VERSION_NUM 0x012200 | 41 | 41 |
| 42 | 42 | #endif /* NGHTTP2VER_H */ |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_frame.c +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1050,6 +1050,11 @@ int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) { | 1050 | 1050 | break; | 1051 | 1051 | case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: | 1052 | 1052 | break; | | 1053 | + case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: | | 1054 | + if (iv[i].value != 0 && iv[i].value != 1) { | | 1055 | + return 0; | | 1056 | + } | | 1057 | + break; | 1053 | 1058 | } | 1054 | 1059 | } | 1055 | 1060 | return 1; | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_hd.c +15-5Lines changed: 15 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 45 | 45 | /* 3rd parameter is nghttp2_token value for header field name. We use | 46 | 46 | first enum value if same header names are repeated (e.g., | 47 | 47 | :status). */ | 48 | | -static nghttp2_hd_static_entry static_table[] = { | | 48 | +static const nghttp2_hd_static_entry static_table[] = { | 49 | 49 | MAKE_STATIC_ENT(":authority", "", 0, 3153725150u), | 50 | 50 | MAKE_STATIC_ENT(":method", "GET", 1, 695666056u), | 51 | 51 | MAKE_STATIC_ENT(":method", "POST", 1, 695666056u), | @@ -271,6 +271,15 @@ static int32_t lookup_token(const uint8_t *name, size_t namelen) { | 271 | 271 | break; | 272 | 272 | } | 273 | 273 | break; | | 274 | + case 9: | | 275 | + switch (name[8]) { | | 276 | + case 'l': | | 277 | + if (memeq(":protoco", name, 8)) { | | 278 | + return NGHTTP2_TOKEN__PROTOCOL; | | 279 | + } | | 280 | + break; | | 281 | + } | | 282 | + break; | 274 | 283 | case 10: | 275 | 284 | switch (name[9]) { | 276 | 285 | case 'e': | @@ -1159,7 +1168,7 @@ static search_result search_static_table(const nghttp2_nv *nv, int32_t token, | 1159 | 1168 | int name_only) { | 1160 | 1169 | search_result res = {token, 0}; | 1161 | 1170 | int i; | 1162 | | - nghttp2_hd_static_entry *ent; | | 1171 | + const nghttp2_hd_static_entry *ent; | 1163 | 1172 |
| 1164 | 1173 | if (name_only) { | 1165 | 1174 | return res; | @@ -1184,7 +1193,7 @@ static search_result search_hd_table(nghttp2_hd_context *context, | 1184 | 1193 | int indexing_mode, nghttp2_hd_map *map, | 1185 | 1194 | uint32_t hash) { | 1186 | 1195 | search_result res = {-1, 0}; | 1187 | | - nghttp2_hd_entry *ent; | | 1196 | + const nghttp2_hd_entry *ent; | 1188 | 1197 | int exact_match; | 1189 | 1198 | int name_only = indexing_mode == NGHTTP2_HD_NEVER_INDEXING; | 1190 | 1199 |
| @@ -1289,8 +1298,9 @@ nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t idx) { | 1289 | 1298 | return hd_ringbuf_get(&context->hd_table, idx - NGHTTP2_STATIC_TABLE_LENGTH) | 1290 | 1299 | ->nv; | 1291 | 1300 | } else { | 1292 | | - nghttp2_hd_static_entry *ent = &static_table[idx]; | 1293 | | - nghttp2_hd_nv nv = {&ent->name, &ent->value, ent->token, | | 1301 | + const nghttp2_hd_static_entry *ent = &static_table[idx]; | | 1302 | + nghttp2_hd_nv nv = {(nghttp2_rcbuf *)&ent->name, | | 1303 | + (nghttp2_rcbuf *)&ent->value, ent->token, | 1294 | 1304 | NGHTTP2_NV_FLAG_NONE}; | 1295 | 1305 | return nv; | 1296 | 1306 | } | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_hd.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -111,6 +111,7 @@ typedef enum { | 111 | 111 | NGHTTP2_TOKEN_KEEP_ALIVE, | 112 | 112 | NGHTTP2_TOKEN_PROXY_CONNECTION, | 113 | 113 | NGHTTP2_TOKEN_UPGRADE, | | 114 | + NGHTTP2_TOKEN__PROTOCOL, | 114 | 115 | } nghttp2_token; | 115 | 116 |
| 116 | 117 | struct nghttp2_hd_entry; | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_helper.c +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -340,7 +340,7 @@ const char *nghttp2_strerror(int error_code) { | 340 | 340 | } | 341 | 341 |
| 342 | 342 | /* Generated by gennmchartbl.py */ | 343 | | -static int VALID_HD_NAME_CHARS[] = { | | 343 | +static const int VALID_HD_NAME_CHARS[] = { | 344 | 344 | 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, | 345 | 345 | 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, | 346 | 346 | 0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */, | @@ -428,7 +428,7 @@ int nghttp2_check_header_name(const uint8_t *name, size_t len) { | 428 | 428 | } | 429 | 429 |
| 430 | 430 | /* Generated by genvchartbl.py */ | 431 | | -static int VALID_HD_VALUE_CHARS[] = { | | 431 | +static const int VALID_HD_VALUE_CHARS[] = { | 432 | 432 | 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, | 433 | 433 | 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, | 434 | 434 | 0 /* BS */, 1 /* HT */, 0 /* LF */, 0 /* VT */, | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_http.c +24-15Lines changed: 24 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -113,7 +113,7 @@ static int check_path(nghttp2_stream *stream) { | 113 | 113 | } | 114 | 114 |
| 115 | 115 | static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, | 116 | | - int trailer) { | | 116 | + int trailer, int connect_protocol) { | 117 | 117 | if (nv->name->base[0] == ':') { | 118 | 118 | if (trailer || | 119 | 119 | (stream->http_flags & NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED)) { | @@ -146,10 +146,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, | 146 | 146 | return NGHTTP2_ERR_HTTP_HEADER; | 147 | 147 | } | 148 | 148 | stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT; | 149 | | - if (stream->http_flags & | 150 | | - (NGHTTP2_HTTP_FLAG__PATH | NGHTTP2_HTTP_FLAG__SCHEME)) { | 151 | | - return NGHTTP2_ERR_HTTP_HEADER; | 152 | | - } | 153 | 149 | } | 154 | 150 | break; | 155 | 151 | case 'S': | @@ -162,9 +158,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, | 162 | 158 | } | 163 | 159 | break; | 164 | 160 | case NGHTTP2_TOKEN__PATH: | 165 | | - if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { | 166 | | - return NGHTTP2_ERR_HTTP_HEADER; | 167 | | - } | 168 | 161 | if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__PATH)) { | 169 | 162 | return NGHTTP2_ERR_HTTP_HEADER; | 170 | 163 | } | @@ -175,9 +168,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, | 175 | 168 | } | 176 | 169 | break; | 177 | 170 | case NGHTTP2_TOKEN__SCHEME: | 178 | | - if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { | 179 | | - return NGHTTP2_ERR_HTTP_HEADER; | 180 | | - } | 181 | 171 | if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__SCHEME)) { | 182 | 172 | return NGHTTP2_ERR_HTTP_HEADER; | 183 | 173 | } | @@ -186,6 +176,15 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, | 186 | 176 | stream->http_flags |= NGHTTP2_HTTP_FLAG_SCHEME_HTTP; | 187 | 177 | } | 188 | 178 | break; | | 179 | + case NGHTTP2_TOKEN__PROTOCOL: | | 180 | + if (!connect_protocol) { | | 181 | + return NGHTTP2_ERR_HTTP_HEADER; | | 182 | + } | | 183 | + | | 184 | + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__PROTOCOL)) { | | 185 | + return NGHTTP2_ERR_HTTP_HEADER; | | 186 | + } | | 187 | + break; | 189 | 188 | case NGHTTP2_TOKEN_HOST: | 190 | 189 | if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_HOST)) { | 191 | 190 | return NGHTTP2_ERR_HTTP_HEADER; | @@ -265,7 +264,7 @@ static int http_response_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, | 265 | 264 | return NGHTTP2_ERR_REMOVE_HTTP_HEADER; | 266 | 265 | } | 267 | 266 | if (stream->status_code / 100 == 1 || | 268 | | - (stream->status_code == 200 && | | 267 | + (stream->status_code / 100 == 2 && | 269 | 268 | (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT))) { | 270 | 269 | return NGHTTP2_ERR_HTTP_HEADER; | 271 | 270 | } | @@ -458,16 +457,21 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, | 458 | 457 | } | 459 | 458 |
| 460 | 459 | if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) { | 461 | | - return http_request_on_header(stream, nv, trailer); | | 460 | + return http_request_on_header(stream, nv, trailer, | | 461 | + session->server && | | 462 | + session->pending_enable_connect_protocol); | 462 | 463 | } | 463 | 464 |
| 464 | 465 | return http_response_on_header(stream, nv, trailer); | 465 | 466 | } | 466 | 467 |
| 467 | 468 | int nghttp2_http_on_request_headers(nghttp2_stream *stream, | 468 | 469 | nghttp2_frame *frame) { | 469 | | - if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { | 470 | | - if ((stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) { | | 470 | + if (!(stream->http_flags & NGHTTP2_HTTP_FLAG__PROTOCOL) && | | 471 | + (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT)) { | | 472 | + if ((stream->http_flags & | | 473 | + (NGHTTP2_HTTP_FLAG__SCHEME | NGHTTP2_HTTP_FLAG__PATH)) || | | 474 | + (stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) { | 471 | 475 | return -1; | 472 | 476 | } | 473 | 477 | stream->content_length = -1; | @@ -478,6 +482,11 @@ int nghttp2_http_on_request_headers(nghttp2_stream *stream, | 478 | 482 | (NGHTTP2_HTTP_FLAG__AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) { | 479 | 483 | return -1; | 480 | 484 | } | | 485 | + if ((stream->http_flags & NGHTTP2_HTTP_FLAG__PROTOCOL) && | | 486 | + ((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) == 0 || | | 487 | + (stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0)) { | | 488 | + return -1; | | 489 | + } | 481 | 490 | if (!check_path(stream)) { | 482 | 491 | return -1; | 483 | 492 | } | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_session.c +35Lines changed: 35 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4361,6 +4361,9 @@ int nghttp2_session_update_local_settings(nghttp2_session *session, | 4361 | 4361 | case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: | 4362 | 4362 | session->local_settings.max_header_list_size = iv[i].value; | 4363 | 4363 | break; | | 4364 | + case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: | | 4365 | + session->local_settings.enable_connect_protocol = iv[i].value; | | 4366 | + break; | 4364 | 4367 | } | 4365 | 4368 | } | 4366 | 4369 |
| @@ -4499,6 +4502,26 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, | 4499 | 4502 |
| 4500 | 4503 | session->remote_settings.max_header_list_size = entry->value; | 4501 | 4504 |
| | 4505 | + break; | | 4506 | + case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: | | 4507 | + | | 4508 | + if (entry->value != 0 && entry->value != 1) { | | 4509 | + return session_handle_invalid_connection( | | 4510 | + session, frame, NGHTTP2_ERR_PROTO, | | 4511 | + "SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL"); | | 4512 | + } | | 4513 | + | | 4514 | + if (!session->server && | | 4515 | + session->remote_settings.enable_connect_protocol && | | 4516 | + entry->value == 0) { | | 4517 | + return session_handle_invalid_connection( | | 4518 | + session, frame, NGHTTP2_ERR_PROTO, | | 4519 | + "SETTINGS: server attempted to disable " | | 4520 | + "SETTINGS_ENABLE_CONNECT_PROTOCOL"); | | 4521 | + } | | 4522 | + | | 4523 | + session->remote_settings.enable_connect_protocol = entry->value; | | 4524 | + | 4502 | 4525 | break; | 4503 | 4526 | } | 4504 | 4527 | } | @@ -5250,6 +5273,7 @@ static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) { | 5250 | 5273 | case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: | 5251 | 5274 | case NGHTTP2_SETTINGS_MAX_FRAME_SIZE: | 5252 | 5275 | case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: | | 5276 | + case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: | 5253 | 5277 | break; | 5254 | 5278 | default: | 5255 | 5279 | DEBUGF("recv: unknown settings id=0x%02x\n", iv.settings_id); | @@ -7052,6 +7076,13 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags, | 7052 | 7076 | } | 7053 | 7077 | } | 7054 | 7078 |
| | 7079 | + for (i = niv; i > 0; --i) { | | 7080 | + if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL) { | | 7081 | + session->pending_enable_connect_protocol = (uint8_t)iv[i - 1].value; | | 7082 | + break; | | 7083 | + } | | 7084 | + } | | 7085 | + | 7055 | 7086 | return 0; | 7056 | 7087 | } | 7057 | 7088 |
| @@ -7360,6 +7391,8 @@ uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session, | 7360 | 7391 | return session->remote_settings.max_frame_size; | 7361 | 7392 | case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: | 7362 | 7393 | return session->remote_settings.max_header_list_size; | | 7394 | + case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: | | 7395 | + return session->remote_settings.enable_connect_protocol; | 7363 | 7396 | } | 7364 | 7397 |
| 7365 | 7398 | assert(0); | @@ -7381,6 +7414,8 @@ uint32_t nghttp2_session_get_local_settings(nghttp2_session *session, | 7381 | 7414 | return session->local_settings.max_frame_size; | 7382 | 7415 | case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: | 7383 | 7416 | return session->local_settings.max_header_list_size; | | 7417 | + case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL: | | 7418 | + return session->local_settings.enable_connect_protocol; | 7384 | 7419 | } | 7385 | 7420 |
| 7386 | 7421 | assert(0); | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_session.h +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -164,6 +164,7 @@ typedef struct { | 164 | 164 | uint32_t initial_window_size; | 165 | 165 | uint32_t max_frame_size; | 166 | 166 | uint32_t max_header_list_size; | | 167 | + uint32_t enable_connect_protocol; | 167 | 168 | } nghttp2_settings_storage; | 168 | 169 |
| 169 | 170 | typedef enum { | @@ -321,6 +322,9 @@ struct nghttp2_session { | 321 | 322 | /* Unacked local ENABLE_PUSH value. We use this to refuse | 322 | 323 | PUSH_PROMISE before SETTINGS ACK is received. */ | 323 | 324 | uint8_t pending_enable_push; | | 325 | + /* Unacked local ENABLE_CONNECT_PROTOCOL value. We use this to | | 326 | + accept :protocol header field before SETTINGS_ACK is received. */ | | 327 | + uint8_t pending_enable_connect_protocol; | 324 | 328 | /* Nonzero if the session is server side. */ | 325 | 329 | uint8_t server; | 326 | 330 | /* Flags indicating GOAWAY is sent and/or received. The flags are | |
Collapse file Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_stream.h +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -130,7 +130,8 @@ typedef enum { | 130 | 130 | /* "http" or "https" scheme */ | 131 | 131 | NGHTTP2_HTTP_FLAG_SCHEME_HTTP = 1 << 13, | 132 | 132 | /* set if final response is expected */ | 133 | | - NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE = 1 << 14 | | 133 | + NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE = 1 << 14, | | 134 | + NGHTTP2_HTTP_FLAG__PROTOCOL = 1 << 15, | 134 | 135 | } nghttp2_http_flag; | 135 | 136 |
| 136 | 137 | struct nghttp2_stream { | |
|