10
10
namespace boost { namespace network { namespace http {
11
11
12
12
struct simple_async_client_connection : client_connection {
13
- simple_async_client_connection (asio::io_service & service,
14
- bool follow_redirects,
13
+ simple_async_client_connection (bool follow_redirects,
15
14
shared_ptr<resolver_delegate> resolver_delegate,
16
15
shared_ptr<connection_delegate> connection_delegate);
17
16
virtual shared_ptr<response_base> send_request (std::string const & method,
@@ -21,20 +20,17 @@ struct simple_async_client_connection : client_connection {
21
20
virtual void reset (); // override
22
21
virtual ~client_connection (); // override
23
22
protected:
24
- asio::io_service & service_;
25
23
bool follow_redirects_;
26
24
shared_ptr<resolver_delegate> resolver_delegate_;
27
25
shared_ptr<connection_delegate> connection_delegate_;
28
26
shared_ptr<connection> connection_;
29
27
};
30
28
31
29
simple_async_client_connection::simple_async_client_connection (
32
- asio::io_service & service,
33
30
bool follow_redirects,
34
31
shared_ptr<resolver_delegate> resolver_delegate,
35
32
shared_ptr<connection_delegate> connection_delegate)
36
- : service_(service),
37
- follow_redirects_ (follow_redirects),
33
+ : follow_redirects_(follow_redirects),
38
34
resolver_delegate_ (resolver_delegate),
39
35
connection_delegate_(connection_delegate),
40
36
{}
@@ -45,9 +41,12 @@ shared_ptr<response_base> send_request(std::string const & method,
45
41
callback_type callback) {
46
42
shared_ptr<response_base> response;
47
43
shared_ptr<connection> connection_;
48
- connection_.reset (new impl::async_connection (resolver_delegate_,
49
- follow_redirects_,
50
- connection_delegate_))
44
+ connection_.reset (new (std::nothrow) impl::async_connection (
45
+ resolver_delegate_,
46
+ follow_redirects_,
47
+ connection_delegate_))
48
+ if (!connection_.get ())
49
+ BOOST_THROW_EXCEPTION (std::runtime_error (" Insufficient memory." ));
51
50
response = connection_->start (request, method, get_body, callback);
52
51
return response
53
52
}
@@ -86,16 +85,15 @@ boost::network::http::simple_async_connection_manager::get_connection(
86
85
} else {
87
86
resolver_delegate.reset (new (std::nothrow) async_resolver (service));
88
87
if (!resolver_delegate_.get ())
89
- BOOST_THROW_EXCEPTION (std::runtime_error (" Insuffucuent memory." ));
88
+ BOOST_THROW_EXCEPTION (std::runtime_error (" Insuffucient memory." ));
90
89
}
91
90
shared_ptr<connection_delegate> connection_delegate;
92
91
bool https = (scheme (request) == " https" );
93
92
connection_delegate =
94
93
connection_delegate_factory::new_connection_delegate (
95
94
service, openssl_certificate_, openssl_verify_path_);
96
95
connection.reset (
97
- new (std::nothrow) simple_async_client_connection (service,
98
- follow_redirects_,
96
+ new (std::nothrow) simple_async_client_connection (follow_redirects_,
99
97
resolver_delegate,
100
98
connection_delegate));
101
99
if (!connection.get ())
@@ -110,4 +108,16 @@ void boost::network::http::simple_async_connection_manager::reset() {
110
108
}
111
109
}
112
110
111
+ namespace boost { namespace network { namespace http {
112
+
113
+ struct http_1_1_async_connection : client_connection {
114
+ http_1_1_async_connection (bool follow_redirects,
115
+ shared_ptr<resolver_delegate> resolver_delegate,
116
+ shared_ptr<connection_delegate> connection_delegate)
117
+ }
118
+
119
+ } /* http */
120
+ } /* network */
121
+ } /* boost */
122
+
113
123
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_POLICIES_ASYNC_CONNECTION_IPP_20110930 */
0 commit comments