mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix a bug in HTTP/2 where connection gets closed prematurely
When the user code was sending a response fully without reading the request body, the connection could get closed when receiving DATA frames for that body. We now ask the client to stop sending data via a NO_ERROR RST_STREAM, and linger any stream that has been reset so that we can skip any pending frames from that stream. This fixes a number of intermittent failures in req_SUITE, which now passes reliably. In addition a small number of rfc7540_SUITE test cases have been corrected as they were incorrect.
This commit is contained in:
parent
133d359674
commit
e7114577bb
2 changed files with 68 additions and 31 deletions
|
@ -2032,7 +2032,7 @@ stream_closed_accept_priority(Config) ->
|
|||
{<<":authority">>, <<"localhost">>}, %% @todo Correct port number.
|
||||
{<<":path">>, <<"/">>}
|
||||
]),
|
||||
ok = gen_tcp:send(Socket, cow_http2:headers(1, nofin, HeadersBlock)),
|
||||
ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)),
|
||||
%% Receive the response.
|
||||
{ok, << Length1:24, 1:8, _:40 >>} = gen_tcp:recv(Socket, 9, 6000),
|
||||
{ok, _} = gen_tcp:recv(Socket, Length1, 6000),
|
||||
|
@ -2055,7 +2055,7 @@ stream_closed_accept_rst_stream(Config) ->
|
|||
{<<":authority">>, <<"localhost">>}, %% @todo Correct port number.
|
||||
{<<":path">>, <<"/">>}
|
||||
]),
|
||||
ok = gen_tcp:send(Socket, cow_http2:headers(1, nofin, HeadersBlock)),
|
||||
ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)),
|
||||
%% Receive the response.
|
||||
{ok, << Length1:24, 1:8, _:40 >>} = gen_tcp:recv(Socket, 9, 6000),
|
||||
{ok, _} = gen_tcp:recv(Socket, Length1, 6000),
|
||||
|
@ -2084,7 +2084,7 @@ stream_closed_accept_window_update(Config) ->
|
|||
{<<":authority">>, <<"localhost">>}, %% @todo Correct port number.
|
||||
{<<":path">>, <<"/">>}
|
||||
]),
|
||||
ok = gen_tcp:send(Socket, cow_http2:headers(1, nofin, HeadersBlock)),
|
||||
ok = gen_tcp:send(Socket, cow_http2:headers(1, fin, HeadersBlock)),
|
||||
%% Receive the response.
|
||||
{ok, << Length1:24, 1:8, _:40 >>} = gen_tcp:recv(Socket, 9, 6000),
|
||||
{ok, _} = gen_tcp:recv(Socket, Length1, 6000),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue