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

Test proxy disconnection

This commit is contained in:
Nelson Vides 2021-05-13 11:56:34 +02:00
parent 286c10637a
commit 20cf68e2b7
No known key found for this signature in database
GPG key ID: D63DE880D7BA9432

View file

@ -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 = #{