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

Fix crash when using IOlists with some Websocket frames

Backported from Cowlib's patch from Rob Ashton <robashton@codeofrob.com>.
This commit is contained in:
Loïc Hoguin 2015-11-16 15:58:37 +01:00
parent 26a648ef17
commit 04eadae381

View file

@ -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);