mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 05:00:24 +00:00
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.
This commit is contained in:
parent
20f598f373
commit
97a3108576
8 changed files with 55 additions and 26 deletions
10
test/handlers/input_crash_h.erl
Normal file
10
test/handlers/input_crash_h.erl
Normal file
|
@ -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).
|
Loading…
Add table
Add a link
Reference in a new issue