aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src
diff options
context:
space:
mode:
authorZandra <[email protected]>2015-11-20 10:22:36 +0100
committerZandra <[email protected]>2015-11-20 10:22:36 +0100
commit94ea0c1218cfb8480d37775f0c2a82452c897360 (patch)
treea5c6c2600af2f72f422953e994ea7c8e8f1f8196 /lib/inets/src
parent00db647274f87aa87f4bb7245fc95a1effe72466 (diff)
parent25c9d0c38d659cc00db461d760f66369e9024c54 (diff)
downloadotp-94ea0c1218cfb8480d37775f0c2a82452c897360.tar.gz
otp-94ea0c1218cfb8480d37775f0c2a82452c897360.tar.bz2
otp-94ea0c1218cfb8480d37775f0c2a82452c897360.zip
Merge branch 'weisslj/fix-inets-crash-on-invalid-chunk-size' into maint
* weisslj/fix-inets-crash-on-invalid-chunk-size: inets: Terminate really gracefully on bad chunk OTP-13117
Diffstat (limited to 'lib/inets/src')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 1044cffe6f..e6dcfee818 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1113,8 +1113,8 @@ handle_http_body(Body, #state{headers = Headers,
case case_insensitive_header(TransferEnc) of
"chunked" ->
?hcrt("handle_http_body - chunked", []),
- case http_chunk:decode(Body, State#state.max_body_size,
- State#state.max_header_size) of
+ try http_chunk:decode(Body, State#state.max_body_size,
+ State#state.max_header_size) of
{Module, Function, Args} ->
?hcrt("handle_http_body - new mfa",
[{module, Module},
@@ -1139,6 +1139,13 @@ handle_http_body(Body, #state{headers = Headers,
handle_response(State#state{headers = NewHeaders,
body = NewBody2})
end
+ catch throw:{error, Reason} ->
+ NewState =
+ answer_request(Request,
+ httpc_response:error(Request,
+ Reason),
+ State),
+ {stop, normal, NewState}
end;
Enc when Enc =:= "identity"; Enc =:= undefined ->
?hcrt("handle_http_body - identity", []),