-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LH: I reworked the test a little and added the same test for HTTP/2 so that both HTTP/1.1 and HTTP/2 get the issue fixed.
- Loading branch information
Showing
3 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%% This module implements a loop handler that streams endless data. | ||
|
||
-module(loop_handler_endless_h). | ||
|
||
-export([init/2]). | ||
-export([info/3]). | ||
|
||
init(Req0, #{delay := Delay} = Opts) -> | ||
case cowboy_req:header(<<"x-test-pid">>, Req0) of | ||
BinPid when is_binary(BinPid) -> | ||
Pid = list_to_pid(binary_to_list(BinPid)), | ||
Pid ! {Pid, self(), init}, | ||
ok; | ||
_ -> | ||
ok | ||
end, | ||
erlang:send_after(Delay, self(), timeout), | ||
Req = cowboy_req:stream_reply(200, Req0), | ||
{cowboy_loop, Req, Opts}. | ||
|
||
info(timeout, Req, State) -> | ||
cowboy_req:stream_body(<<0:1000/unit:8>>, nofin, Req), | ||
erlang:send_after(10, self(), timeout), | ||
{ok, Req, State}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters