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

Don't discard data following a Websocket upgrade request

While the protocol does not allow sending data before
receiving a successful Websocket upgrade response, we
do not want to discard that data if it does come in.
This commit is contained in:
Loïc Hoguin 2019-10-05 13:04:21 +02:00
parent 618c001291
commit c50d6aa09c
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
4 changed files with 81 additions and 60 deletions

View file

@ -602,9 +602,8 @@ sys_get_state_h1(Config) ->
{ok, Socket} = gen_tcp:connect("localhost", config(clear_port, Config), []),
timer:sleep(100),
Pid = get_remote_pid_tcp(Socket),
{State, Buffer} = sys:get_state(Pid),
State = sys:get_state(Pid),
state = element(1, State),
true = is_binary(Buffer),
ok.
sys_get_state_h2(Config) ->
@ -726,9 +725,8 @@ sys_replace_state_h1(Config) ->
{ok, Socket} = gen_tcp:connect("localhost", config(clear_port, Config), []),
timer:sleep(100),
Pid = get_remote_pid_tcp(Socket),
{State, Buffer} = sys:replace_state(Pid, fun(S) -> S end),
State = sys:replace_state(Pid, fun(S) -> S end),
state = element(1, State),
true = is_binary(Buffer),
ok.
sys_replace_state_h2(Config) ->