diff options
author | Loïc Hoguin <[email protected]> | 2025-03-28 14:29:06 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-03-28 14:29:06 +0100 |
commit | 694fed991b4611147f2da73a183d3b8768f4b45d (patch) | |
tree | 9d99228500aee90925bb1733e0791d9c6e2d7bb3 /test | |
parent | e10c8f9762ada26457c03a7c3a391ef8e4745d15 (diff) | |
download | gun-694fed991b4611147f2da73a183d3b8768f4b45d.tar.gz gun-694fed991b4611147f2da73a183d3b8768f4b45d.tar.bz2 gun-694fed991b4611147f2da73a183d3b8768f4b45d.zip |
Reject Websocket frames sent over HTTP
Diffstat (limited to 'test')
-rw-r--r-- | test/gun_SUITE.erl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl index 1c9ba23..766b1e7 100644 --- a/test/gun_SUITE.erl +++ b/test/gun_SUITE.erl @@ -730,6 +730,18 @@ transform_header_name(_) -> 1 = length(HostLines), gun:close(Pid). +ws_send_http(_) -> + {ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]), + {ok, {_, Port}} = inet:sockname(ListenSocket), + {ok, ConnPid} = gun:open("localhost", Port, #{ + protocols => [http] + }), + {ok, _ClientSocket} = gen_tcp:accept(ListenSocket, 5000), + {ok, http} = gun:await_up(ConnPid), + gun:ws_send(ConnPid, make_ref(), ping), + {error, {connection_error, {badstate, _}}} = gun:await(ConnPid, undefined), + gun:close(ConnPid). + unix_socket_connect(_) -> case os:type() of {win32, _} -> |