diff options
author | Loïc Hoguin <[email protected]> | 2017-11-22 15:39:39 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-11-22 23:10:00 +0100 |
commit | c4e43ec26ad5193b9665f159d294d133a2d34a85 (patch) | |
tree | ef8a48c75a445e4b86e2fded44e409f6992cc81a /test/handlers | |
parent | 1af508c4cdad328a14fb889dfebf3fff23bc77d4 (diff) | |
download | cowboy-c4e43ec26ad5193b9665f159d294d133a2d34a85.tar.gz cowboy-c4e43ec26ad5193b9665f159d294d133a2d34a85.tar.bz2 cowboy-c4e43ec26ad5193b9665f159d294d133a2d34a85.zip |
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!
Diffstat (limited to 'test/handlers')
-rw-r--r-- | test/handlers/echo_h.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/handlers/echo_h.erl b/test/handlers/echo_h.erl index 18bdbe6..04c3cf5 100644 --- a/test/handlers/echo_h.erl +++ b/test/handlers/echo_h.erl @@ -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, |