mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix bugs related to HTTP/1.1 pipelining
The flow control is now only set to infinity when we are skipping the request body of the stream that is being terminated. This fixes a bug where it was set to infinity while reading a subsequent request's body, leading to a crash. The timeout is no longer reset on stream termination. Timeout handling is already done when receiving data from the socket and doing a reset on stream termination was leading to the wrong timeout being set or the right timeout being reset needlessly.
This commit is contained in:
parent
edea415da8
commit
752297b153
2 changed files with 21 additions and 19 deletions
|
@ -40,6 +40,7 @@ init_routes(_) -> [
|
|||
{"localhost", [
|
||||
{"/", hello_h, []},
|
||||
{"/echo/:key[/:arg]", echo_h, []},
|
||||
{"/full/:key[/:arg]", echo_h, []},
|
||||
{"/length/echo/:key", echo_h, []},
|
||||
{"/resp/:key[/:arg]", resp_h, []},
|
||||
{"/send_message", send_message_h, []},
|
||||
|
@ -1553,13 +1554,13 @@ pipeline(Config) ->
|
|||
ConnPid = gun_open(Config),
|
||||
Refs = [{
|
||||
gun:get(ConnPid, "/"),
|
||||
gun:delete(ConnPid, "/echo/method")
|
||||
gun:post(ConnPid, "/full/read_body", [], <<0:800000>>)
|
||||
} || _ <- lists:seq(1, 25)],
|
||||
_ = [begin
|
||||
{response, nofin, 200, _} = gun:await(ConnPid, Ref1),
|
||||
{ok, <<"Hello world!">>} = gun:await_body(ConnPid, Ref1),
|
||||
{response, nofin, 200, _} = gun:await(ConnPid, Ref2),
|
||||
{ok, <<"DELETE">>} = gun:await_body(ConnPid, Ref2)
|
||||
{ok, <<0:800000>>} = gun:await_body(ConnPid, Ref2)
|
||||
end || {Ref1, Ref2} <- Refs],
|
||||
ok.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue