diff options
author | Loïc Hoguin <[email protected]> | 2015-11-16 15:58:37 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-11-16 15:58:37 +0100 |
commit | 04eadae3813b5e24f43951e70b6ee67703031cb8 (patch) | |
tree | b2c2365c83eabbd635c9fd7f1aa20ca2651e44c7 | |
parent | 26a648ef17f9db4270ab6515152ac07630657faa (diff) | |
download | cowboy-04eadae3813b5e24f43951e70b6ee67703031cb8.tar.gz cowboy-04eadae3813b5e24f43951e70b6ee67703031cb8.tar.bz2 cowboy-04eadae3813b5e24f43951e70b6ee67703031cb8.zip |
Fix crash when using IOlists with some Websocket frames
Backported from Cowlib's patch from Rob Ashton <[email protected]>.
-rw-r--r-- | src/cowboy_websocket.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index c0f94c4..9577086 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -570,7 +570,7 @@ websocket_dispatch(State, Req, HandlerState, _RemainingData, 8, %% Ping control frame. Send a pong back and forward the ping to the handler. websocket_dispatch(State=#state{socket=Socket, transport=Transport}, Req, HandlerState, RemainingData, 9, Payload) -> - Len = payload_length_to_binary(byte_size(Payload)), + Len = payload_length_to_binary(iolist_size(Payload)), Transport:send(Socket, << 1:1, 0:3, 10:4, 0:1, Len/bits, Payload/binary >>), handler_call(State, Req, HandlerState, RemainingData, websocket_handle, {ping, Payload}, fun websocket_data/4); |