Don't allow 101 HTTP status code because HTTP/2 removes HTTP Upgrade
This commit is contained in:
parent
4add618a3f
commit
842509dab6
|
@ -244,7 +244,7 @@ static int http_response_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
|
|||
return NGHTTP2_ERR_HTTP_HEADER;
|
||||
}
|
||||
stream->status_code = (int16_t)parse_uint(nv->value->base, nv->value->len);
|
||||
if (stream->status_code == -1) {
|
||||
if (stream->status_code == -1 || stream->status_code == 101) {
|
||||
return NGHTTP2_ERR_HTTP_HEADER;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -10437,6 +10437,7 @@ void test_nghttp2_http_mandatory_headers(void) {
|
|||
MAKE_NV("content-length", "0")};
|
||||
const nghttp2_nv clnonzero204_resnv[] = {MAKE_NV(":status", "204"),
|
||||
MAKE_NV("content-length", "100")};
|
||||
const nghttp2_nv status101_resnv[] = {MAKE_NV(":status", "101")};
|
||||
|
||||
/* test case for request */
|
||||
const nghttp2_nv nopath_reqnv[] = {MAKE_NV(":scheme", "https"),
|
||||
|
@ -10551,6 +10552,12 @@ void test_nghttp2_http_mandatory_headers(void) {
|
|||
session, &deflater, 21, NGHTTP2_STREAM_OPENING, clnonzero204_resnv,
|
||||
ARRLEN(clnonzero204_resnv));
|
||||
|
||||
/* status code 101 should not be used in HTTP/2 because it is used
|
||||
for HTTP Upgrade which HTTP/2 removes. */
|
||||
check_nghttp2_http_recv_headers_fail(session, &deflater, 23,
|
||||
NGHTTP2_STREAM_OPENING, status101_resnv,
|
||||
ARRLEN(status101_resnv));
|
||||
|
||||
nghttp2_hd_deflate_free(&deflater);
|
||||
|
||||
nghttp2_session_del(session);
|
||||
|
|
Loading…
Reference in New Issue