painting the bike shed
This commit is contained in:
parent
b44292a790
commit
04970142aa
@ -23,7 +23,7 @@
|
|||||||
| {timeout, RestData :: binary() | erlang:iovec()}
|
| {timeout, RestData :: binary() | erlang:iovec()}
|
||||||
| inet:posix().
|
| inet:posix().
|
||||||
|
|
||||||
-define(MAX_PAYLOAD_SIZE, (1 bsl 63)).
|
-define(MAX_PAYLOAD_SIZE, ((1 bsl 63) - 1)).
|
||||||
|
|
||||||
%% Frames
|
%% Frames
|
||||||
%% https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
|
%% https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
|
||||||
@ -716,7 +716,7 @@ payload_to_binary(X) -> unicode:characters_to_binary(X).
|
|||||||
message_to_frame(Data, Payload)
|
message_to_frame(Data, Payload)
|
||||||
when ((Data =:= text) orelse (Data =:= binary)),
|
when ((Data =:= text) orelse (Data =:= binary)),
|
||||||
is_binary(Payload),
|
is_binary(Payload),
|
||||||
(byte_size(Payload) < ?MAX_PAYLOAD_SIZE) ->
|
(byte_size(Payload) =< ?MAX_PAYLOAD_SIZE) ->
|
||||||
#frame{fin = true,
|
#frame{fin = true,
|
||||||
opcode = Data,
|
opcode = Data,
|
||||||
payload_length = byte_size(Payload),
|
payload_length = byte_size(Payload),
|
||||||
@ -817,5 +817,5 @@ render_payload_length(Len) when 0 =< Len, Len =< 125 ->
|
|||||||
<<Len:7>>;
|
<<Len:7>>;
|
||||||
render_payload_length(Len) when 126 =< Len, Len =< 2#1111_1111_1111_1111 ->
|
render_payload_length(Len) when 126 =< Len, Len =< 2#1111_1111_1111_1111 ->
|
||||||
<<126:7, Len:16>>;
|
<<126:7, Len:16>>;
|
||||||
render_payload_length(Len) when (1 bsl 16) =< Len, Len < ?MAX_PAYLOAD_SIZE ->
|
render_payload_length(Len) when (1 bsl 16) =< Len, Len =< ?MAX_PAYLOAD_SIZE ->
|
||||||
<<127:7, Len:64>>.
|
<<127:7, Len:64>>.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user