painting the bike shed

This commit is contained in:
Peter Harpending 2025-10-21 12:37:33 -07:00
parent b44292a790
commit 04970142aa

View File

@ -23,7 +23,7 @@
| {timeout, RestData :: binary() | erlang:iovec()}
| inet:posix().
-define(MAX_PAYLOAD_SIZE, (1 bsl 63)).
-define(MAX_PAYLOAD_SIZE, ((1 bsl 63) - 1)).
%% Frames
%% 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)
when ((Data =:= text) orelse (Data =:= binary)),
is_binary(Payload),
(byte_size(Payload) < ?MAX_PAYLOAD_SIZE) ->
(byte_size(Payload) =< ?MAX_PAYLOAD_SIZE) ->
#frame{fin = true,
opcode = Data,
payload_length = byte_size(Payload),
@ -817,5 +817,5 @@ render_payload_length(Len) when 0 =< Len, Len =< 125 ->
<<Len:7>>;
render_payload_length(Len) when 126 =< Len, Len =< 2#1111_1111_1111_1111 ->
<<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>>.