Adjustment for RFC 8441

This commit is contained in:
Tatsuhiro Tsujikawa 2018-09-23 11:22:30 +09:00
parent a19d8f5d31
commit b80dfaa8a0
3 changed files with 13 additions and 4 deletions

View File

@ -683,7 +683,7 @@ typedef enum {
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 0x06,
/**
* SETTINGS_ENABLE_CONNECT_PROTOCOL
* (https://tools.ietf.org/html/draft-ietf-httpbis-h2-websockets-00)
* (`RFC 8441 <https://tools.ietf.org/html/rfc8441>`_)
*/
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x08
} nghttp2_settings_id;

View File

@ -484,8 +484,8 @@ int nghttp2_http_on_request_headers(nghttp2_stream *stream,
return -1;
}
if ((stream->http_flags & NGHTTP2_HTTP_FLAG__PROTOCOL) &&
(!connect_protocol ||
(stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) == 0)) {
((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) == 0 ||
(stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0)) {
return -1;
}
if (!check_path(stream)) {

View File

@ -10916,8 +10916,12 @@ void test_nghttp2_http_mandatory_headers(void) {
MAKE_NV(":method", "GET"), MAKE_NV(":authority", "localhost"),
MAKE_NV(":protocol", "websocket")};
const nghttp2_nv connectprotonopath_reqnv[] = {
MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"),
MAKE_NV(":scheme", "https"), MAKE_NV(":method", "CONNECT"),
MAKE_NV(":authority", "localhost"), MAKE_NV(":protocol", "websocket")};
const nghttp2_nv connectprotonoauth_reqnv[] = {
MAKE_NV(":scheme", "http"), MAKE_NV(":path", "/"),
MAKE_NV(":method", "CONNECT"), MAKE_NV("host", "localhost"),
MAKE_NV(":protocol", "websocket")};
mem = nghttp2_mem_default();
@ -11098,6 +11102,11 @@ void test_nghttp2_http_mandatory_headers(void) {
connectprotonopath_reqnv,
ARRLEN(connectprotonopath_reqnv));
/* CONNECT method with :protocol requires :authority. */
check_nghttp2_http_recv_headers_fail(session, &deflater, 7, -1,
connectprotonoauth_reqnv,
ARRLEN(connectprotonoauth_reqnv));
nghttp2_hd_deflate_free(&deflater);
nghttp2_session_del(session);