mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
zero-length header names MUST issue a stream error
This commit is contained in:
parent
9a2d35c2e8
commit
157f64b49b
1 changed files with 5 additions and 0 deletions
|
@ -247,6 +247,9 @@ control_frame(State=#state{middlewares=Middlewares, env=Env,
|
||||||
loop(State#state{last_streamid=StreamID,
|
loop(State#state{last_streamid=StreamID,
|
||||||
children=[#child{streamid=StreamID, pid=Pid,
|
children=[#child{streamid=StreamID, pid=Pid,
|
||||||
input=IsFin, output=nofin}|Children]});
|
input=IsFin, output=nofin}|Children]});
|
||||||
|
{error, badname} ->
|
||||||
|
rst_stream(State, StreamID, protocol_error),
|
||||||
|
loop(State#state{last_streamid=StreamID});
|
||||||
{error, special} ->
|
{error, special} ->
|
||||||
rst_stream(State, StreamID, protocol_error),
|
rst_stream(State, StreamID, protocol_error),
|
||||||
loop(State#state{last_streamid=StreamID})
|
loop(State#state{last_streamid=StreamID})
|
||||||
|
@ -344,6 +347,8 @@ syn_stream_headers(<<>>, 0, Acc, Special=#special_headers{
|
||||||
true ->
|
true ->
|
||||||
{ok, lists:reverse(Acc), Special}
|
{ok, lists:reverse(Acc), Special}
|
||||||
end;
|
end;
|
||||||
|
syn_stream_headers(<< 0:32, _Rest/bits >>, _NbHeaders, _Acc, _Special) ->
|
||||||
|
{error, badname};
|
||||||
syn_stream_headers(<< NameLen:32, Rest/bits >>, NbHeaders, Acc, Special) ->
|
syn_stream_headers(<< NameLen:32, Rest/bits >>, NbHeaders, Acc, Special) ->
|
||||||
<< Name:NameLen/binary, ValueLen:32, Rest2/bits >> = Rest,
|
<< Name:NameLen/binary, ValueLen:32, Rest2/bits >> = Rest,
|
||||||
<< Value:ValueLen/binary, Rest3/bits >> = Rest2,
|
<< Value:ValueLen/binary, Rest3/bits >> = Rest2,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue