aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2016-12-16 13:13:15 +0100
committerLoïc Hoguin <[email protected]>2017-01-03 17:47:23 +0100
commitf59c29dff02b1b79652e93dec76a5a26f207e628 (patch)
treee585cb8d4f7fc4df6fe274ae1bc1528b09395fd4 /src/cowboy_http.erl
parent1048bff929791f18b7425d9cc7871d78d63cf4f8 (diff)
downloadcowboy-f59c29dff02b1b79652e93dec76a5a26f207e628.tar.gz
cowboy-f59c29dff02b1b79652e93dec76a5a26f207e628.tar.bz2
cowboy-f59c29dff02b1b79652e93dec76a5a26f207e628.zip
Return status 431 if the request header field is too large
This commit changes Cowboy to follow RFC6585.
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl4
1 files changed, 2 insertions, 2 deletions
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};