Skip to content

Commit 1f5d225

Browse files
committed
fix: invert priority-data check in HEADERS frame encoder
The condition guarding HEADERS priority encoding was backwards: it checked is_falsy(StreamDep) (true when undefined) instead of not is_falsy(StreamDep) (true when present). So priority data was silently dropped from every HEADERS frame that carried it, while the PRIORITY flag was never set. Found by adding HEADERS property tests to prop_gen_http_parser_h2.
1 parent b8c87df commit 1f5d225

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/gen_http_parser_h2.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ encode(
3535
} = _Frame
3636
) ->
3737
{Payload, Flags1} =
38-
case is_falsy(StreamDep) andalso is_falsy(Weight) andalso is_boolean(IsExclusive) of
38+
case (not is_falsy(StreamDep)) andalso (not is_falsy(Weight)) of
3939
true ->
40-
IsExclussiveInt = boolean_to_integer(IsExclusive),
40+
ExclusiveBit = boolean_to_integer(IsExclusive =:= true),
4141
{
42-
[<<IsExclussiveInt:1, StreamDep:31>>, Weight - 1, Hbf],
42+
[<<ExclusiveBit:1, StreamDep:31>>, Weight - 1, Hbf],
4343
set_flags(Flags, headers, [priority])
4444
};
45-
_Other ->
45+
false ->
4646
{Hbf, Flags}
4747
end,
4848

0 commit comments

Comments
 (0)