From cc2634e835c326b8920aef653d775a0ffd079952 Mon Sep 17 00:00:00 2001 From: Niels Werensteijn Date: Sun, 24 Nov 2013 13:47:19 +0100 Subject: [PATCH 1/2] fixed read timeout in chucked content response for sync keep-alive client --- .../http/client/connection/sync_base.hpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/boost/network/protocol/http/client/connection/sync_base.hpp b/boost/network/protocol/http/client/connection/sync_base.hpp index 713458137..f5fe4fa8a 100644 --- a/boost/network/protocol/http/client/connection/sync_base.hpp +++ b/boost/network/protocol/http/client/connection/sync_base.hpp @@ -168,15 +168,18 @@ struct sync_connection_base_impl { } else { bool stopping_inner = false; do { - std::size_t chunk_bytes_read = - read(socket_, - response_buffer, - boost::asio::transfer_at_least(chunk_size), - error); - if (chunk_bytes_read == 0) { - if (error != boost::asio::error::eof) - throw boost::system::system_error(error); - stopping_inner = true; + if (response_buffer.size() < (chunk_size+2)){ + std::size_t toRead = (chunk_size+2) - response_buffer.size(); + std::size_t chunk_bytes_read = + read(socket_, + response_buffer, + boost::asio::transfer_at_least(toRead), + error); + if (chunk_bytes_read == 0) { + if (error != boost::asio::error::eof) + throw boost::system::system_error(error); + stopping_inner = true; + } } std::istreambuf_iterator eos; From bf64ef950fe2141a57c8f435fce5297b81d272cf Mon Sep 17 00:00:00 2001 From: Niels Werensteijn Date: Sun, 24 Nov 2013 14:04:08 +0100 Subject: [PATCH 2/2] changed variable name to be complient to coding style --- boost/network/protocol/http/client/connection/sync_base.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boost/network/protocol/http/client/connection/sync_base.hpp b/boost/network/protocol/http/client/connection/sync_base.hpp index f5fe4fa8a..c6d8f9cc0 100644 --- a/boost/network/protocol/http/client/connection/sync_base.hpp +++ b/boost/network/protocol/http/client/connection/sync_base.hpp @@ -169,11 +169,11 @@ struct sync_connection_base_impl { bool stopping_inner = false; do { if (response_buffer.size() < (chunk_size+2)){ - std::size_t toRead = (chunk_size+2) - response_buffer.size(); + std::size_t bytes_to_read = (chunk_size+2) - response_buffer.size(); std::size_t chunk_bytes_read = read(socket_, response_buffer, - boost::asio::transfer_at_least(toRead), + boost::asio::transfer_at_least(bytes_to_read), error); if (chunk_bytes_read == 0) { if (error != boost::asio::error::eof)