@@ -94,11 +94,11 @@ struct http_async_connection
94
94
&command_streambuf));
95
95
this ->method = method;
96
96
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 >())));
102
102
if (timeout_ >0 ) {
103
103
timer_.expires_from_now (boost::posix_time::seconds (timeout_));
104
104
timer_.async_wait (request_strand_.wrap (
@@ -140,11 +140,12 @@ struct http_async_connection
140
140
resolver_iterator iter =boost::begin (endpoint_range);
141
141
asio::ip::tcp::endpointendpoint (iter->endpoint ().address (), port);
142
142
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)));
148
149
}else {
149
150
set_errors (ec ? ec : boost::asio::error::host_not_found);
150
151
boost::iterator_range<const char *> range;
@@ -172,8 +173,7 @@ struct http_async_connection
172
173
resolver_iterator iter =boost::begin (endpoint_range);
173
174
asio::ip::tcp::endpointendpoint (iter->endpoint ().address (), port);
174
175
delegate_->connect (
175
- endpoint,
176
- host,
176
+ endpoint, host,
177
177
request_strand_.wrap (boost::bind (
178
178
&this_type::handle_connected,this_type::shared_from_this (),
179
179
host, port, get_body, callback, generator,
@@ -254,6 +254,7 @@ struct http_async_connection
254
254
size_t remainder;
255
255
switch (state) {
256
256
case version:
257
+ if (ec == boost::asio::error::eof)return ;
257
258
parsed_ok =this ->parse_version (
258
259
delegate_,
259
260
request_strand_.wrap (boost::bind (
@@ -263,6 +264,7 @@ struct http_async_connection
263
264
bytes_transferred);
264
265
if (!parsed_ok ||indeterminate (parsed_ok))return ;
265
266
case status:
267
+ if (ec == boost::asio::error::eof)return ;
266
268
parsed_ok =this ->parse_status (
267
269
delegate_,
268
270
request_strand_.wrap (boost::bind (
@@ -272,6 +274,7 @@ struct http_async_connection
272
274
bytes_transferred);
273
275
if (!parsed_ok ||indeterminate (parsed_ok))return ;
274
276
case status_message:
277
+ if (ec == boost::asio::error::eof)return ;
275
278
parsed_ok =this ->parse_status_message (
276
279
delegate_, request_strand_.wrap (boost::bind (
277
280
&this_type::handle_received_data,
@@ -281,6 +284,7 @@ struct http_async_connection
281
284
bytes_transferred);
282
285
if (!parsed_ok ||indeterminate (parsed_ok))return ;
283
286
case headers:
287
+ if (ec == boost::asio::error::eof)return ;
284
288
// In the following, remainder is the number of bytes that
285
289
// remain
286
290
// in the buffer. We need this in the body processing to make