summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-03-03 14:31:10 +0100
committerLinus Nordberg <linus@nordu.net>2017-03-03 14:31:10 +0100
commit6d6d7a1a67fc7e810122e0942f422190c975b45f (patch)
tree6c53e3fac66fdc85e77b5e8d47e8fe2bbf6469c3
parent163fdaeaf8fc1bc43923420309ba4a6b3ef51e11 (diff)
Return HTTP code 413 when body in POST is too large.
-rw-r--r--src/catlfish_web.erl4
1 files changed, 4 insertions, 0 deletions
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",