Skip to content

Commit cc2634e

Browse files
committed
fixed read timeout in chucked content response for sync keep-alive client
1 parent 2e5b039 commit cc2634e

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

Lines changed: 12 additions & 9 deletions
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 toRead = (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(toRead),
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy