Skip to content

Commit ddc197f

Browse files
author
Dean Michael Berris
committed
Merge branch 'master' of github.com:mikhailberis/cpp-netlib into 0.7-devel
2 parents 7d24500 + 7602c3e commit ddc197f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

boost/network/protocol/http/impl/sync_connection_base.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ namespace boost { namespace network { namespace http { namespace impl {
168168
} while (!stopping);
169169
} else throw std::runtime_error("Unsupported Transfer-Encoding.");
170170
} else {
171-
size_t length = lexical_cast<size_t>(boost::begin(content_length_range)->second);
172-
size_t bytes_read = 0;
171+
size_t already_read = response_buffer.size( );
172+
if ( already_read )
173+
body_stream << &response_buffer;
174+
size_t length = lexical_cast<size_t>(boost::begin(content_length_range)->second) - already_read;
175+
if ( length == 0 )
176+
return;
177+
size_t bytes_read = 0;
173178
while ((bytes_read = boost::asio::read(socket_, response_buffer, boost::asio::transfer_at_least(1), error))) {
174179
body_stream << &response_buffer;
175180
length -= bytes_read;

0 commit comments

Comments
 (0)