diff options
author | Loïc Hoguin <[email protected]> | 2011-10-01 19:08:32 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-10-01 19:08:32 +0200 |
commit | 986630d9ad70a1ae82954a7bfedc976a1b8b7294 (patch) | |
tree | d045fdee118f8441b20a51a23d131f0cc492b356 /src | |
parent | b79e9fbeb4eb5e80eb23f60ef71371addbcb2355 (diff) | |
download | cowboy-986630d9ad70a1ae82954a7bfedc976a1b8b7294.tar.gz cowboy-986630d9ad70a1ae82954a7bfedc976a1b8b7294.tar.bz2 cowboy-986630d9ad70a1ae82954a7bfedc976a1b8b7294.zip |
Get rid of a binary construct in cowboy_http_websocket
Thanks to @nivertech for pointing it out in ticket #61.
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_http_websocket.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cowboy_http_websocket.erl b/src/cowboy_http_websocket.erl index 1164684..2a1f3e4 100644 --- a/src/cowboy_http_websocket.erl +++ b/src/cowboy_http_websocket.erl @@ -358,7 +358,7 @@ handler_call(State=#state{handler=Handler, opts=Opts}, Req, HandlerState, %% hixie-76 text frame. websocket_send({text, Payload}, #state{version=0}, #http_req{socket=Socket, transport=Transport}) -> - Transport:send(Socket, << 0, Payload/binary, 255 >>); + Transport:send(Socket, [0, Payload, 255]); %% Ignore all unknown frame types for compatibility with hixie 76. websocket_send(_Any, #state{version=0}, _Req) -> ignore; @@ -370,9 +370,9 @@ websocket_send({Type, Payload}, _State, ping -> 9; pong -> 10 end, - Len = hybi_payload_length(byte_size(Payload)), - Transport:send(Socket, << 1:1, 0:3, Opcode:4, - 0:1, Len/bits, Payload/binary >>). + Len = hybi_payload_length(iolist_size(Payload)), + Transport:send(Socket, [<< 1:1, 0:3, Opcode:4, 0:1, Len/bits >>, + Payload]). -spec websocket_close(#state{}, #http_req{}, any(), {atom(), atom()}) -> ok. websocket_close(State=#state{version=0}, Req=#http_req{socket=Socket, |