Skip to content

Commit 0c062a8

Browse files
committed
Fixing problem with run-over buffer reads.
1 parent a17616a commit 0c062a8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

boost/network/protocol/http/connection.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,8 @@ namespace boost { namespace network { namespace http {
132132
}
133133

134134
if (content_length != 0) {
135-
async_read(
136-
socket_,
135+
socket_.async_read_some(
137136
boost::asio::buffer(buffer_),
138-
boost::asio::transfer_at_least(content_length),
139137
wrapper_.wrap(
140138
bind(
141139
&connection<Tag,Handler>::handle_read_body_contents,
@@ -210,7 +208,7 @@ namespace boost { namespace network { namespace http {
210208
size_t difference = bytes_to_read - bytes_transferred;
211209
array<char,BOOST_HTTP_SERVER_BUFFER_SIZE>::iterator start = buffer_.begin(),
212210
past_end = start;
213-
std::advance(past_end, bytes_to_read);
211+
std::advance(past_end, std::min(bytes_to_read,bytes_transferred));
214212
request_.body.append(buffer_.begin(), past_end);
215213
if (difference == 0) {
216214
handler_(request_, response_);

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