aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_server/httpd_request_handler.erl
diff options
context:
space:
mode:
authorZandra <[email protected]>2015-11-13 10:43:08 +0100
committerZandra <[email protected]>2015-11-13 10:43:08 +0100
commit0db6272323fd662cb43f5bb4d24f01daa8a6647d (patch)
tree2c65c4e9981aeedfb9b34978cf4fd6b7ac17db72 /lib/inets/src/http_server/httpd_request_handler.erl
parent98e1d3394514181648c64ab9e5f7a1af2573d658 (diff)
parent9dd0c95d56ec33bde9668bb47668aa27981ea18d (diff)
downloadotp-0db6272323fd662cb43f5bb4d24f01daa8a6647d.tar.gz
otp-0db6272323fd662cb43f5bb4d24f01daa8a6647d.tar.bz2
otp-0db6272323fd662cb43f5bb4d24f01daa8a6647d.zip
Merge branch 'maint-18' into maint
Diffstat (limited to 'lib/inets/src/http_server/httpd_request_handler.erl')
-rw-r--r--lib/inets/src/http_server/httpd_request_handler.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index e5d006c1fd..143d599edb 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -443,7 +443,7 @@ handle_body(#state{headers = Headers, body = Body, mod = ModData} = State,
MaxHeaderSize, MaxBodySize) ->
case Headers#http_request_h.'transfer-encoding' of
"chunked" ->
- case http_chunk:decode(Body, MaxBodySize, MaxHeaderSize) of
+ try http_chunk:decode(Body, MaxBodySize, MaxHeaderSize) of
{Module, Function, Args} ->
http_transport:setopts(ModData#mod.socket_type,
ModData#mod.socket,
@@ -455,6 +455,14 @@ handle_body(#state{headers = Headers, body = Body, mod = ModData} = State,
http_chunk:handle_headers(Headers, ChunkedHeaders),
handle_response(State#state{headers = NewHeaders,
body = NewBody})
+ catch
+ throw:Error ->
+ httpd_response:send_status(ModData, 400,
+ "Bad input"),
+ Reason = io_lib:format("Chunk decoding failed: ~p~n",
+ [Error]),
+ error_log(Reason, ModData),
+ {stop, normal, State#state{response_sent = true}}
end;
Encoding when is_list(Encoding) ->
httpd_response:send_status(ModData, 501,