0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Add more rfc7230 tests and better handle bad chunk sizes

Bad chunk sizes used to be accepted and could result in
a badly parsed body or a timeout. They are now properly
rejected.

Chunk extensions now have a hard limit of 129 characters.
I haven't heard of anyone using them and Cowboy does not
provide an interface for them, but we can always increase
or make configurable if it ever becomes necessary (but
I honestly doubt it).

Also a test from the old http suite could be removed. Yay!
This commit is contained in:
Loïc Hoguin 2017-11-22 15:39:39 +01:00
parent 1af508c4cd
commit c4e43ec26a
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
4 changed files with 296 additions and 109 deletions

View file

@ -22,6 +22,10 @@ echo(<<"read_body">>, Req0, Opts) ->
cowboy_req:inform(100, Req0),
cowboy_req:read_body(Req0);
<<"/full", _/bits>> -> read_body(Req0, <<>>);
<<"/length", _/bits>> ->
{_, _, Req1} = read_body(Req0, <<>>),
Length = cowboy_req:body_length(Req1),
{ok, integer_to_binary(Length), Req1};
<<"/opts", _/bits>> -> cowboy_req:read_body(Req0, Opts);
_ -> cowboy_req:read_body(Req0)
end,