0
Fork 0
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:
José Valim 2016-12-16 13:13:15 +01:00 committed by Loïc Hoguin
parent 1048bff929
commit f59c29dff0
No known key found for this signature in database
GPG key ID: 71366FF21851DF03
2 changed files with 16 additions and 2 deletions

View file

@ -307,6 +307,20 @@ echo_body(Config) ->
end || Size <- lists:seq(MTU - 500, MTU)],
ok.
%% Check if sending request whose header name is bigger than 64 bytes causes 431
echo_body_max_header_name_length(Config) ->
ConnPid = gun_open(Config),
Ref = gun:post(ConnPid, "/echo/body", [{binary:copy(<<$a>>, 32768), <<"bad">>}], << "echo=name" >>),
{response, fin, 431, _} = gun:await(ConnPid, Ref),
ok.
%% Check if sending request whose header name is bigger than 64 bytes causes 431
echo_body_max_header_value_length(Config) ->
ConnPid = gun_open(Config),
Ref = gun:post(ConnPid, "/echo/body", [{<<"bad">>, binary:copy(<<$a>>, 32768)}], << "echo=name" >>),
{response, fin, 431, _} = gun:await(ConnPid, Ref),
ok.
%% Check if sending request whose size is bigger than 1000000 bytes causes 413
echo_body_max_length(Config) ->
ConnPid = gun_open(Config),