Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc82e836

Browse files
committed
Thisfixes#496 by handling EOF correctly
1 parent6e32582 commitc82e836

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

‎boost/network/protocol/http/client/connection/async_normal.hpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ struct http_async_connection
9494
&command_streambuf));
9595
this->method = method;
9696
boost::uint16_t port_ =port(request);
97-
resolve_(
98-
resolver_,host(request), port_,
99-
request_strand_.wrap(boost::bind(
100-
&this_type::handle_resolved,this_type::shared_from_this(),string_type(host(request)), port_,
101-
get_body, callback, generator, boost::arg<1>(), boost::arg<2>())));
97+
resolve_(resolver_,host(request), port_,
98+
request_strand_.wrap(boost::bind(
99+
&this_type::handle_resolved,this_type::shared_from_this(),
100+
string_type(host(request)), port_, get_body, callback,
101+
generator, boost::arg<1>(), boost::arg<2>())));
102102
if (timeout_ >0) {
103103
timer_.expires_from_now(boost::posix_time::seconds(timeout_));
104104
timer_.async_wait(request_strand_.wrap(
@@ -140,11 +140,12 @@ struct http_async_connection
140140
resolver_iterator iter =boost::begin(endpoint_range);
141141
asio::ip::tcp::endpointendpoint(iter->endpoint().address(), port);
142142
delegate_->connect(
143-
endpoint, host, request_strand_.wrap(boost::bind(
144-
&this_type::handle_connected,
145-
this_type::shared_from_this(), host, port, get_body, callback,
146-
generator,std::make_pair(++iter,resolver_iterator()),
147-
placeholders::error)));
143+
endpoint, host,
144+
request_strand_.wrap(boost::bind(
145+
&this_type::handle_connected,this_type::shared_from_this(), host,
146+
port, get_body, callback, generator,
147+
std::make_pair(++iter,resolver_iterator()),
148+
placeholders::error)));
148149
}else {
149150
set_errors(ec ? ec : boost::asio::error::host_not_found);
150151
boost::iterator_range<constchar*> range;
@@ -172,8 +173,7 @@ struct http_async_connection
172173
resolver_iterator iter =boost::begin(endpoint_range);
173174
asio::ip::tcp::endpointendpoint(iter->endpoint().address(), port);
174175
delegate_->connect(
175-
endpoint,
176-
host,
176+
endpoint, host,
177177
request_strand_.wrap(boost::bind(
178178
&this_type::handle_connected,this_type::shared_from_this(),
179179
host, port, get_body, callback, generator,
@@ -254,6 +254,7 @@ struct http_async_connection
254254
size_t remainder;
255255
switch (state) {
256256
case version:
257+
if (ec == boost::asio::error::eof)return;
257258
parsed_ok =this->parse_version(
258259
delegate_,
259260
request_strand_.wrap(boost::bind(
@@ -263,6 +264,7 @@ struct http_async_connection
263264
bytes_transferred);
264265
if (!parsed_ok ||indeterminate(parsed_ok))return;
265266
case status:
267+
if (ec == boost::asio::error::eof)return;
266268
parsed_ok =this->parse_status(
267269
delegate_,
268270
request_strand_.wrap(boost::bind(
@@ -272,6 +274,7 @@ struct http_async_connection
272274
bytes_transferred);
273275
if (!parsed_ok ||indeterminate(parsed_ok))return;
274276
case status_message:
277+
if (ec == boost::asio::error::eof)return;
275278
parsed_ok =this->parse_status_message(
276279
delegate_, request_strand_.wrap(boost::bind(
277280
&this_type::handle_received_data,
@@ -281,6 +284,7 @@ struct http_async_connection
281284
bytes_transferred);
282285
if (!parsed_ok ||indeterminate(parsed_ok))return;
283286
case headers:
287+
if (ec == boost::asio::error::eof)return;
284288
// In the following, remainder is the number of bytes that
285289
// remain
286290
// in the buffer. We need this in the body processing to make

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp