From 6d6d7a1a67fc7e810122e0942f422190c975b45f Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 3 Mar 2017 14:31:10 +0100 Subject: Return HTTP code 413 when body in POST is too large. --- src/catlfish_web.erl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index 2ddd7ed..52441fc 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -91,6 +91,10 @@ loop(Req, Module) -> Req:respond({501, [], []}) end catch + exit:{body_too_large, What} -> + lager:info("HTTP POST body too large: ~p", [What]), + Req:respond({413, [{"Content-Type", "text/plain"}], + "Request Entity Too Large\n"}); Type:What -> [CrashFunction | Stack] = erlang:get_stacktrace(), lager:error("Crash in ~p for path ~p: ~p ~p~n~p~n~p~n", -- cgit v1.1