aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cow_http2.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cow_http2.erl b/src/cow_http2.erl
index 29b2dce..7f2d75b 100644
--- a/src/cow_http2.erl
+++ b/src/cow_http2.erl
@@ -184,7 +184,7 @@ parse(<< Len:24, 4:8, _:7, 0:1, _:1, 0:31, _/bits >>) when Len rem 6 =/= 0 ->
{connection_error, frame_size_error, 'SETTINGS frames MUST have a length multiple of 6. (RFC7540 6.5)'};
parse(<< Len:24, 4:8, _:7, 0:1, _:1, 0:31, Rest/bits >>) when byte_size(Rest) >= Len ->
parse_settings_payload(Rest, Len, #{});
-parse(<< _:24, 4:8, _/bits >>) ->
+parse(<< _:24, 4:8, _:8, _:1, StreamID:31, _/bits >>) when StreamID =/= 0 ->
{connection_error, protocol_error, 'SETTINGS frames MUST NOT be associated with a stream. (RFC7540 6.5)'};
%%
%% PUSH_PROMISE frames.
@@ -278,6 +278,12 @@ parse_windows_update_test() ->
{ok, {window_update, 12345}, <<>>} = parse(WindowUpdate),
{ok, {window_update, 12345}, << 42 >>} = parse(<< WindowUpdate/binary, 42 >>),
ok.
+
+parse_settings_test() ->
+ more = parse(<< 0:24, 4:8, 1:8, 0:8 >>),
+ {ok, settings_ack, <<>>} = parse(<< 0:24, 4:8, 1:8, 0:32 >>),
+ {connection_error, protocol_error, _} = parse(<< 0:24, 4:8, 1:8, 0:1, 1:31 >>),
+ ok.
-endif.
parse_fin(0) -> nofin;