diff options
author | Kirilll Zaborsky <[email protected]> | 2014-05-16 17:23:43 +0400 |
---|---|---|
committer | Kirilll Zaborsky <[email protected]> | 2014-05-16 23:05:44 +0400 |
commit | a027c412d7cb6cf6ad00422b7dfd8534bf8c212b (patch) | |
tree | 79c043216c409ee30b92ef3196c66b0b62f0e416 /lib/inets/src | |
parent | cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae (diff) | |
download | otp-a027c412d7cb6cf6ad00422b7dfd8534bf8c212b.tar.gz otp-a027c412d7cb6cf6ad00422b7dfd8534bf8c212b.tar.bz2 otp-a027c412d7cb6cf6ad00422b7dfd8534bf8c212b.zip |
inets: Fix HTTP 1.0 body end on closed connection
Receiving HTTP response with no Content-length header and
with body ending on closed connection should give the complete
response body contents up to the last byte received.
Diffstat (limited to 'lib/inets/src')
-rw-r--r-- | lib/inets/src/http_client/httpc_handler.erl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl index 32d20b62d1..93bcb6c3e8 100644 --- a/lib/inets/src/http_client/httpc_handler.erl +++ b/lib/inets/src/http_client/httpc_handler.erl @@ -1226,6 +1226,7 @@ handle_response(#state{request = Request, handle_queue(State#state{request = undefined}, Data); {ok, Msg, Data} -> ?hcrd("handle response - ok", []), + stream_remaining_body(Body, Request, StatusLine), end_stream(StatusLine, Request), NewState = maybe_send_answer(Request, Msg, State), handle_queue(NewState, Data); @@ -1634,6 +1635,10 @@ start_stream(_StatusLine, _Headers, Request) -> ?hcrt("start stream - no op", []), {ok, Request}. +stream_remaining_body(<<>>, _, _) -> + ok; +stream_remaining_body(Body, Request, {_, Code, _}) -> + stream(Body, Request, Code). %% Note the end stream message is handled by httpc_response and will %% be sent by answer_request |