From f59c29dff02b1b79652e93dec76a5a26f207e628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 16 Dec 2016 13:13:15 +0100 Subject: Return status 431 if the request header field is too large This commit changes Cowboy to follow RFC6585. --- src/cowboy_http.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cowboy_http.erl') diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index da64bea..fda768d 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -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}; -- cgit v1.2.3