0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Fix an rfc7540 test to have a different error reason

This commit is contained in:
Loïc Hoguin 2018-04-27 20:19:02 +02:00
parent 9a29aea148
commit 5d5a00c863
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764

View file

@ -2173,9 +2173,11 @@ reject_streamid_0(Config) ->
{ok, << _:24, 7:8, _:72, 1:32 >>} = gen_tcp:recv(Socket, 17, 6000), {ok, << _:24, 7:8, _:72, 1:32 >>} = gen_tcp:recv(Socket, 17, 6000),
ok. ok.
%% See the comment for reject_streamid_lower for the rationale behind
%% having a STREAM_CLOSED connection error.
http_upgrade_reject_reuse_streamid_1(Config) -> http_upgrade_reject_reuse_streamid_1(Config) ->
doc("Attempts to reuse streamid 1 after upgrading to HTTP/2 " doc("Attempts to reuse streamid 1 after upgrading to HTTP/2 "
"must be rejected with a PROTOCOL_ERROR connection error. (RFC7540 5.1.1)"), "must be rejected with a STREAM_CLOSED connection error. (RFC7540 5.1.1)"),
{ok, Socket} = gen_tcp:connect("localhost", config(port, Config), [binary, {active, false}]), {ok, Socket} = gen_tcp:connect("localhost", config(port, Config), [binary, {active, false}]),
ok = gen_tcp:send(Socket, [ ok = gen_tcp:send(Socket, [
"GET / HTTP/1.1\r\n" "GET / HTTP/1.1\r\n"
@ -2218,8 +2220,8 @@ http_upgrade_reject_reuse_streamid_1(Config) ->
{<<":path">>, <<"/">>} {<<":path">>, <<"/">>}
]), ]),
ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)), ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)),
%% Receive a PROTOCOL_ERROR connection error. %% Receive a STREAM_CLOSED connection error.
{ok, << _:24, 7:8, _:72, 1:32 >>} = gen_tcp:recv(Socket, 17, 6000), {ok, << _:24, 7:8, _:72, 5:32 >>} = gen_tcp:recv(Socket, 17, 6000),
ok. ok.
%% The RFC gives us various error codes to return for this case, %% The RFC gives us various error codes to return for this case,