Skip to content

fixed read timeout in chucked content response for sync keep-alive client #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 24, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fixed read timeout in chucked content response for sync keep-alive cl…
…ient
  • Loading branch information
nwerensteijn committed Nov 24, 2013
commit cc2634e835c326b8920aef653d775a0ffd079952
21 changes: 12 additions & 9 deletions boost/network/protocol/http/client/connection/sync_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would prefer you call this variable bytes_to_read.

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<char> eos;
Expand Down