mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Return status 431 if the request header field is too large
This commit changes Cowboy to follow RFC6585.
This commit is contained in:
parent
1048bff929
commit
f59c29dff0
2 changed files with 16 additions and 2 deletions
|
@ -454,7 +454,7 @@ parse_header(Buffer, State=#state{opts=Opts, in_state=PS}, Headers) ->
|
|||
NumHeaders = maps:size(Headers),
|
||||
case match_colon(Buffer, 0) of
|
||||
nomatch when byte_size(Buffer) > MaxLength ->
|
||||
error_terminate(400, State, {connection_error, limit_reached,
|
||||
error_terminate(431, State, {connection_error, limit_reached,
|
||||
''}); %% @todo
|
||||
nomatch when NumHeaders >= MaxHeaders ->
|
||||
error_terminate(400, State, {connection_error, limit_reached,
|
||||
|
@ -497,7 +497,7 @@ parse_hd_before_value(Buffer, State=#state{opts=Opts, in_state=PS}, H, N) ->
|
|||
MaxLength = maps:get(max_header_value_length, Opts, 4096),
|
||||
case match_eol(Buffer, 0) of
|
||||
nomatch when byte_size(Buffer) > MaxLength ->
|
||||
error_terminate(400, State, {connection_error, limit_reached,
|
||||
error_terminate(431, State, {connection_error, limit_reached,
|
||||
''}); %% @todo
|
||||
nomatch ->
|
||||
{more, State#state{in_state=PS#ps_header{headers=H, name=N}}, Buffer};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue