mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Test proxy disconnection
This commit is contained in:
parent
286c10637a
commit
20cf68e2b7
1 changed files with 17 additions and 0 deletions
|
@ -71,6 +71,23 @@ init_dispatch() ->
|
|||
|
||||
%% Tests.
|
||||
|
||||
fail_gracefully_on_disconnect(Config) ->
|
||||
doc("Probing a port does not generate a crash"),
|
||||
{ok, Socket} = gen_tcp:connect("localhost", config(port, Config),
|
||||
[binary, {active, false}, {packet, raw}]),
|
||||
timer:sleep(100),
|
||||
Pid = ct_helper:get_remote_pid_tcp(Socket),
|
||||
Ref = erlang:monitor(process, Pid),
|
||||
gen_tcp:close(Socket),
|
||||
receive
|
||||
{'DOWN', Ref, process, Pid, {shutdown, closed}} ->
|
||||
ok;
|
||||
{'DOWN', Ref, process, Pid, Reason} ->
|
||||
error(Reason)
|
||||
after 500 ->
|
||||
error(timeout)
|
||||
end.
|
||||
|
||||
v1_proxy_header(Config) ->
|
||||
doc("Confirm we can read the proxy header at the start of the connection."),
|
||||
ProxyInfo = #{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue