Allow client sending :protocol optimistically
This commit is contained in:
parent
a42faf1cc2
commit
651e147711
|
@ -457,9 +457,9 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) {
|
if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) {
|
||||||
return http_request_on_header(
|
return http_request_on_header(stream, nv, trailer,
|
||||||
stream, nv, trailer,
|
session->server &&
|
||||||
session->server && session->local_settings.enable_connect_protocol);
|
session->pending_enable_connect_protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
return http_response_on_header(stream, nv, trailer);
|
return http_response_on_header(stream, nv, trailer);
|
||||||
|
|
|
@ -3748,7 +3748,7 @@ static int session_after_header_block_received(nghttp2_session *session) {
|
||||||
if (subject_stream) {
|
if (subject_stream) {
|
||||||
rv = nghttp2_http_on_request_headers(
|
rv = nghttp2_http_on_request_headers(
|
||||||
subject_stream, frame,
|
subject_stream, frame,
|
||||||
session->server && session->local_settings.enable_connect_protocol);
|
session->server && session->pending_enable_connect_protocol);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(frame->hd.type == NGHTTP2_HEADERS);
|
assert(frame->hd.type == NGHTTP2_HEADERS);
|
||||||
|
@ -3756,7 +3756,7 @@ static int session_after_header_block_received(nghttp2_session *session) {
|
||||||
case NGHTTP2_HCAT_REQUEST:
|
case NGHTTP2_HCAT_REQUEST:
|
||||||
rv = nghttp2_http_on_request_headers(
|
rv = nghttp2_http_on_request_headers(
|
||||||
stream, frame,
|
stream, frame,
|
||||||
session->server && session->local_settings.enable_connect_protocol);
|
session->server && session->pending_enable_connect_protocol);
|
||||||
break;
|
break;
|
||||||
case NGHTTP2_HCAT_RESPONSE:
|
case NGHTTP2_HCAT_RESPONSE:
|
||||||
case NGHTTP2_HCAT_PUSH_RESPONSE:
|
case NGHTTP2_HCAT_PUSH_RESPONSE:
|
||||||
|
@ -7080,6 +7080,13 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = niv; i > 0; --i) {
|
||||||
|
if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL) {
|
||||||
|
session->pending_enable_connect_protocol = (uint8_t)iv[i - 1].value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,9 @@ struct nghttp2_session {
|
||||||
/* Unacked local ENABLE_PUSH value. We use this to refuse
|
/* Unacked local ENABLE_PUSH value. We use this to refuse
|
||||||
PUSH_PROMISE before SETTINGS ACK is received. */
|
PUSH_PROMISE before SETTINGS ACK is received. */
|
||||||
uint8_t pending_enable_push;
|
uint8_t pending_enable_push;
|
||||||
|
/* Unacked local ENABLE_CONNECT_PROTOCOL value. We use this to
|
||||||
|
accept :protocol header field before SETTINGS_ACK is received. */
|
||||||
|
uint8_t pending_enable_connect_protocol;
|
||||||
/* Nonzero if the session is server side. */
|
/* Nonzero if the session is server side. */
|
||||||
uint8_t server;
|
uint8_t server;
|
||||||
/* Flags indicating GOAWAY is sent and/or received. The flags are
|
/* Flags indicating GOAWAY is sent and/or received. The flags are
|
||||||
|
|
|
@ -11082,7 +11082,7 @@ void test_nghttp2_http_mandatory_headers(void) {
|
||||||
/* enable SETTINGS_CONNECT_PROTOCOL */
|
/* enable SETTINGS_CONNECT_PROTOCOL */
|
||||||
nghttp2_session_server_new(&session, &callbacks, &ud);
|
nghttp2_session_server_new(&session, &callbacks, &ud);
|
||||||
|
|
||||||
session->local_settings.enable_connect_protocol = 1;
|
session->pending_enable_connect_protocol = 1;
|
||||||
|
|
||||||
nghttp2_hd_deflate_init(&deflater, mem);
|
nghttp2_hd_deflate_init(&deflater, mem);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue