From 04eadae3813b5e24f43951e70b6ee67703031cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 16 Nov 2015 15:58:37 +0100 Subject: Fix crash when using IOlists with some Websocket frames Backported from Cowlib's patch from Rob Ashton . --- src/cowboy_websocket.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3