summaryrefslogtreecommitdiff
path: root/lib/inets/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/inets/src')
-rw-r--r--lib/inets/src/http_client/httpc_response.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/inets/src/http_client/httpc_response.erl b/lib/inets/src/http_client/httpc_response.erl
index f177aac8f2..8142eb8bce 100644
--- a/lib/inets/src/http_client/httpc_response.erl
+++ b/lib/inets/src/http_client/httpc_response.erl
@@ -426,7 +426,7 @@ format_response({{"HTTP/0.9", _, _} = StatusLine, _, Body}) ->
format_response({StatusLine, Headers, Body = <<>>}) ->
{{StatusLine, http_response:header_list(Headers), Body}, <<>>};
-format_response({StatusLine, Headers, Body}) ->
+format_response({{"HTTP/1.0", _, _} = StatusLine, Headers, Body}) ->
Length = list_to_integer(Headers#http_response_h.'content-length'),
{NewBody, Data} =
case Length of
@@ -440,6 +440,20 @@ format_response({StatusLine, Headers, Body}) ->
_ -> %% Connection prematurely ended.
{Body, <<>>}
end,
+ {{StatusLine, http_response:header_list(Headers), NewBody}, Data};
+
+format_response({{"HTTP/1.1", _, _} = StatusLine, Headers, Body}) ->
+ Length = list_to_integer(Headers#http_response_h.'content-length'),
+ {NewBody, Data} =
+ case Length of
+ -1 -> % When no lenght indicator is provided
+ {Body, <<>>};
+ Length when (Length =< size(Body)) ->
+ <<BodyThisReq:Length/binary, Next/binary>> = Body,
+ {BodyThisReq, Next};
+ _ -> %% Connection prematurely ended.
+ {Body, <<>>}
+ end,
{{StatusLine, http_response:header_list(Headers), NewBody}, Data}.
%%--------------------------------------------------------------------------