From 97a3108576c6a9d64c03e1455654dba88367992a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 12 Jul 2014 12:09:43 +0200 Subject: Reply with 400 on header parsing crash This is a first step to improve the HTTP status codes returned by Cowboy on crashes. We will tweak it over time. Also fixes a small bug where two replies may have been sent when using loop handlers under rare conditions. --- test/handlers/input_crash_h.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/handlers/input_crash_h.erl (limited to 'test/handlers') diff --git a/test/handlers/input_crash_h.erl b/test/handlers/input_crash_h.erl new file mode 100644 index 0000000..668d053 --- /dev/null +++ b/test/handlers/input_crash_h.erl @@ -0,0 +1,10 @@ +%% This module crashes on request input data +%% depending on the given option. + +-module(input_crash_h). + +-export([init/3]). + +init(_, Req, content_length) -> + cowboy_error_h:ignore(cow_http_hd, number, 2), + cowboy_req:parse_header(<<"content-length">>, Req). -- cgit v1.2.3