diff options
author | Loïc Hoguin <[email protected]> | 2017-02-26 13:24:15 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-02-26 13:24:15 +0100 |
commit | bb83a6ce33288c04250497318565ac499282c720 (patch) | |
tree | 8956731dc4c6d370f2156e3e10b0f93517ea72df /test/rfc7540_SUITE.erl | |
parent | a3636adcac15f0eea4151dca8a28a915eadaa1ed (diff) | |
download | cowboy-bb83a6ce33288c04250497318565ac499282c720.tar.gz cowboy-bb83a6ce33288c04250497318565ac499282c720.tar.bz2 cowboy-bb83a6ce33288c04250497318565ac499282c720.zip |
Unknown HTTP/2 frames are ignored
Diffstat (limited to 'test/rfc7540_SUITE.erl')
-rw-r--r-- | test/rfc7540_SUITE.erl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl index d99e9f2..9d25bdd 100644 --- a/test/rfc7540_SUITE.erl +++ b/test/rfc7540_SUITE.erl @@ -809,6 +809,31 @@ prior_knowledge(Config) -> %% * Prior knowledge handshake fails (3.4) %% * ALPN selects HTTP/1.1 (3.3) +%% Frame format. + +ignore_unknown_frames(Config) -> + doc("Frames of unknown type must be ignored and discarded. (RFC7540 4.1)"), + {ok, Socket} = do_handshake(Config), + %% Send a POST request with a single DATA frame, + %% and an unknown frame type interleaved. + {HeadersBlock, _} = cow_hpack:encode([ + {<<":method">>, <<"POST">>}, + {<<":scheme">>, <<"http">>}, + {<<":authority">>, <<"localhost">>}, %% @todo Correct port number. + {<<":path">>, <<"/echo/read_body">>} + ]), + ok = gen_tcp:send(Socket, [ + cow_http2:headers(1, nofin, HeadersBlock), + << 10:24, 99:8, 0:40, 0:80 >>, + cow_http2:data(1, fin, << 0:100/unit:8 >>) + ]), + %% Receive a response with the same DATA frame. + {ok, << SkipLen:24, 1:8, _:8, 1:32 >>} = gen_tcp:recv(Socket, 9, 1000), + {ok, _} = gen_tcp:recv(Socket, SkipLen, 1000), + {ok, << 100:24, 0:8, 1:8, 1:32 >>} = gen_tcp:recv(Socket, 9, 1000), + {ok, << 0:100/unit:8 >>} = gen_tcp:recv(Socket, 100, 1000), + ok. + %% Frame size. max_frame_size_allow_exactly_default(Config) -> |