Skip to content

Commit 30c53ea

Browse files
committed
Merge branch '0.10-devel' of git://github.com/cpp-netlib/cpp-netlib into 0.10-devel
2 parents d05c0fc + 472a4ad commit 30c53ea

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

boost/network/protocol/http/client/connection/sync_base.hpp

+12-9
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,18 @@ struct sync_connection_base_impl {
168168
} else {
169169
bool stopping_inner = false;
170170
do {
171-
std::size_t chunk_bytes_read =
172-
read(socket_,
173-
response_buffer,
174-
boost::asio::transfer_at_least(chunk_size),
175-
error);
176-
if (chunk_bytes_read == 0) {
177-
if (error != boost::asio::error::eof)
178-
throw boost::system::system_error(error);
179-
stopping_inner = true;
171+
if (response_buffer.size() < (chunk_size+2)){
172+
std::size_t bytes_to_read = (chunk_size+2) - response_buffer.size();
173+
std::size_t chunk_bytes_read =
174+
read(socket_,
175+
response_buffer,
176+
boost::asio::transfer_at_least(bytes_to_read),
177+
error);
178+
if (chunk_bytes_read == 0) {
179+
if (error != boost::asio::error::eof)
180+
throw boost::system::system_error(error);
181+
stopping_inner = true;
182+
}
180183
}
181184

182185
std::istreambuf_iterator<char> eos;

0 commit comments

Comments
 (0)