aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client
diff options
context:
space:
mode:
authorSergey Sinkovskiy <[email protected]>2014-04-30 09:57:51 +0300
committerKirilll Zaborsky <[email protected]>2014-04-30 14:28:43 +0400
commitcf3c624dc66a42d9d7bec904d8be3b8c4cce38ae (patch)
tree43abfd2c3df19ddcd2870e9a51aac37bdad90d1e /lib/inets/src/http_client
parent8acc644e162bad52f7ab81c76c0cad15628e4f3d (diff)
downloadotp-cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae.tar.gz
otp-cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae.tar.bz2
otp-cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae.zip
inets: Fix streaming with single chunk body
Receiving HTTP response with chunked transfer encoding in a single TCP message should produce stream messages for response body when streaming mode is used for httpc.
Diffstat (limited to 'lib/inets/src/http_client')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 80c8b2439e..32d20b62d1 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1116,8 +1116,16 @@ handle_http_body(Body, #state{headers = Headers,
{new_body, NewBody}]),
NewHeaders = http_chunk:handle_headers(Headers,
ChunkedHeaders),
- handle_response(State#state{headers = NewHeaders,
- body = NewBody})
+ case Body of
+ <<>> ->
+ handle_response(State#state{headers = NewHeaders,
+ body = NewBody});
+ _ ->
+ {NewBody2, NewRequest} =
+ stream(NewBody, Request, Code),
+ handle_response(State#state{headers = NewHeaders,
+ body = NewBody2})
+ end
end;
Encoding when is_list(Encoding) ->
?hcrt("handle_http_body - encoding", [{encoding, Encoding}]),