Skip to content

Fix chunk and content-length encoding #759

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
May 15, 2017
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -361,22 +361,23 @@ struct http_async_protocol_handler {
for (typename string_type::const_iterator iter =
std::search(begin, partial_parsed.end(), crlf.begin(), crlf.end());
iter != partial_parsed.end();
iter =
std::search(begin, partial_parsed.end(), crlf.begin(), crlf.end())) {
iter = std::search(begin, partial_parsed.end(), crlf.begin(), crlf.end())) {
string_type line(begin, iter);
if (line.empty()) {
std::advance(iter, 2);
begin = iter;
continue;
std::advance(iter, 2);
begin = iter;
continue;
}
std::stringstream stream(line);
int len;
stream >> std::hex >> len;
std::advance(iter, 2);
if (!len) return true;
if (len <= partial_parsed.end() - iter) {
std::advance(iter, len + 2);
}
std::advance(iter, len);
} else {
return false;
}
begin = iter;
}
return false;
Expand All @@ -391,7 +392,7 @@ struct http_async_protocol_handler {
partial_parsed.append(part_begin, it);
part_begin = part.begin();
if (check_parse_body_complete()) {
callback(boost::asio::error::eof, bytes);
callback(boost::asio::error::eof, 0);
} else {
delegate_->read_some(
boost::asio::mutable_buffers_1(part.data(), part.size()), callback);
Expand Down