aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Ashton <[email protected]>2015-04-09 18:01:38 +0100
committerRob Ashton <[email protected]>2015-04-09 18:01:38 +0100
commit95a41e6c941c12f34592f3fed911fd405e787b24 (patch)
treeadc3b5f6ac2e4c3fb7c51a84c38819848e08ad3c
parent5ddecbc121f812aec53d9df91829448d8e94e44c (diff)
downloadcowlib-95a41e6c941c12f34592f3fed911fd405e787b24.tar.gz
cowlib-95a41e6c941c12f34592f3fed911fd405e787b24.tar.bz2
cowlib-95a41e6c941c12f34592f3fed911fd405e787b24.zip
WS accepts iodata, so byte_size won't work unless we flatten
-rw-r--r--src/cow_ws.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cow_ws.erl b/src/cow_ws.erl
index c89c17a..c025b38 100644
--- a/src/cow_ws.erl
+++ b/src/cow_ws.erl
@@ -580,7 +580,7 @@ masked_frame({binary, Payload}, _) ->
[<< 1:1, 0:3, 2:4, 1:1, Len/bits >>, MaskKeyBin, mask(iolist_to_binary(Payload), MaskKey, <<>>)].
payload_length(Payload) ->
- case byte_size(Payload) of
+ case iolist_size(Payload) of
N when N =< 125 -> << N:7 >>;
N when N =< 16#ffff -> << 126:7, N:16 >>;
N when N =< 16#7fffffffffffffff -> << 127:7, N:64 >>