@@ -14,51 +14,50 @@ namespace boost { namespace network { namespace http {
14
14
15
15
namespace placeholders = boost::asio::placeholders;
16
16
17
- struct http_async_connection
18
- : client_connection
19
- , boost::enable_shared_from_this<http_async_connection>
17
+ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_connection_pimpl>
20
18
{
19
+ http_async_connection_pimpl (
20
+ resolver_delegate_ptr resolver_delegate,
21
+ asio::io_service & io_service,
22
+ bool follow_redirect,
23
+ connection_delegate_ptr delegate)
24
+ :
25
+ follow_redirect_ (follow_redirect),
26
+ request_strand_ (io_service),
27
+ resolver_delegate_ (resolver_delegate),
28
+ delegate_ (delegate) {}
21
29
22
- http_async_connection (resolver_delegate_ptr resolver_delegate,
23
- asio::io_service & io_service,
24
- bool follow_redirect,
25
- connection_delegate_ptr delegate)
26
- :
27
- follow_redirect_ (follow_redirect),
28
- request_strand_ (io_service),
29
- resolver_delegate_ (resolver_delegate),
30
- delegate_ (delegate) {}
31
-
32
- // This is the main entry point for the connection/request pipeline. We're
33
- // overriding async_connection_base<...>::start(...) here which is called
34
- // by the client.
35
- virtual response start (request const & request,
36
- string_type const & method,
37
- bool get_body,
38
- body_callback_function_type callback) {
39
- response response_;
40
- this ->init_response (response_, get_body);
41
- linearize (request, method, version_major, version_minor,
42
- std::ostreambuf_iterator<typename char_<Tag>::type>(&command_streambuf));
43
- this ->method = method;
44
- boost::uint16_t port_ = port (request);
45
- resolver_delegate_->resolve (host (request),
46
- port_,
47
- request_strand_.wrap (
48
- boost::bind (
49
- &this_type::handle_resolved,
50
- this_type::shared_from_this (),
51
- port_,
52
- get_body,
53
- callback,
54
- _1,
55
- _2)));
56
- return response_;
57
- }
30
+ // This is the main entry point for the connection/request pipeline. We're
31
+ // overriding async_connection_base<...>::start(...) here which is called
32
+ // by the client.
33
+ response start (request const & request,
34
+ string_type const & method,
35
+ bool get_body,
36
+ body_callback_function_type callback) {
37
+ response response_;
38
+ this ->init_response (response_, get_body);
39
+ linearize (request, method, version_major, version_minor,
40
+ std::ostreambuf_iterator<typename char_<Tag>::type>(&command_streambuf));
41
+ this ->method = method;
42
+ boost::uint16_t port_ = port (request);
43
+ resolver_delegate_->resolve (
44
+ host (request),
45
+ port_,
46
+ request_strand_.wrap (
47
+ boost::bind (
48
+ &this_type::handle_resolved,
49
+ this_type::shared_from_this (),
50
+ port_,
51
+ get_body,
52
+ callback,
53
+ _1,
54
+ _2)));
55
+ return response_;
56
+ }
58
57
59
- private:
58
+ private:
60
59
61
- http_async_connection (http_async_connection const &); // = delete
60
+ http_async_connection_pimpl (http_async_connection_pimpl const &); // = delete
62
61
63
62
void set_errors (boost::system::error_code const & ec) {
64
63
boost::system::system_error error (ec);
@@ -385,6 +384,19 @@ private:
385
384
string_type method;
386
385
};
387
386
387
+ // END OF PIMPL DEFINITION
388
+
389
+ http_async_connection::http_async_connection (shared_ptr<resolver_delegate> resolver_delegate,
390
+ shared_ptr<connection_delegate> connection_delegate,
391
+ asio::io_service & io_service,
392
+ bool follow_redirects)
393
+ : pimpl(new (std::nothrow) http_async_connection_pimpl(resolver_delegate,
394
+ connection_delegate,
395
+ io_service,
396
+ follow_redirects))
397
+ {}
398
+
399
+ http_async_connection::http
388
400
389
401
} /* http */
390
402
0 commit comments