9
9
#include < boost/network/protocol/http/request.hpp>
10
10
#include < boost/network/protocol/http/response.hpp>
11
11
#include < boost/network/protocol/http/client/pimpl.hpp>
12
- #include < boost/network/protocol/http/client/parameters .hpp>
12
+ #include < boost/network/protocol/http/client/options .hpp>
13
13
14
14
namespace boost { namespace network { namespace http {
15
15
@@ -28,45 +28,20 @@ namespace boost { namespace network { namespace http {
28
28
typedef basic_client_impl<Tag,version_major,version_minor> pimpl_type;
29
29
typedef function<void (iterator_range<char const *> const &,system::error_code const &)> body_callback_function_type;
30
30
31
- template <class ArgPack >
32
- basic_client_facade (ArgPack const & args)
31
+ basic_client_facade (client_options<Tag> const &options)
33
32
{
34
- init_pimpl (args,
35
- typename mpl::if_<
36
- is_same<
37
- typename parameter::value_type<ArgPack, tag::io_service, void >::type,
38
- void
39
- >,
40
- no_io_service,
41
- has_io_service
42
- >::type ());
33
+ init_pimpl (options);
43
34
}
44
35
45
- BOOST_PARAMETER_MEMBER_FUNCTION (( response const ), head, tag, (required ( request,(request const &))) ) {
36
+ response const head ( request const &request ) {
46
37
return pimpl->request_skeleton (request, " HEAD" , false , body_callback_function_type ());
47
38
}
48
39
49
- BOOST_PARAMETER_MEMBER_FUNCTION ((response const ), get , tag,
50
- (required
51
- (request,(request const &))
52
- )
53
- (optional
54
- (body_handler,(body_callback_function_type),body_callback_function_type())
55
- )
56
- ) {
40
+ response const get (request const &request, body_callback_function_type body_handler = body_callback_function_type()) {
57
41
return pimpl->request_skeleton (request, " GET" , true , body_handler);
58
42
}
59
43
60
- BOOST_PARAMETER_MEMBER_FUNCTION ((response const ), post , tag,
61
- (required
62
- (request,(request)) // yes sir, we make a copy of the original request.
63
- )
64
- (optional
65
- (body,(string_type const &),string_type())
66
- (content_type,(string_type const &),string_type())
67
- (body_handler,(body_callback_function_type),body_callback_function_type())
68
- )
69
- ) {
44
+ response const post (request request, string_type const &body = string_type(), string_type const &content_type = string_type(), body_callback_function_type body_handler = body_callback_function_type()) {
70
45
if (body != string_type ()) {
71
46
request << remove_header (" Content-Length" )
72
47
<< header (" Content-Length" , boost::lexical_cast<string_type>(body.size ()))
@@ -88,16 +63,7 @@ namespace boost { namespace network { namespace http {
88
63
return pimpl->request_skeleton (request, " POST" , true , body_handler);
89
64
}
90
65
91
- BOOST_PARAMETER_MEMBER_FUNCTION ((response const ), put , tag,
92
- (required
93
- (request,(request)) // yes sir, we make a copy of the original request.
94
- )
95
- (optional
96
- (body,(string_type const &),string_type())
97
- (content_type,(string_type const &),string_type())
98
- (body_handler,(body_callback_function_type),body_callback_function_type())
99
- )
100
- ) {
66
+ response const put (request request, string_type const &body = string_type(), string_type const &content_type = string_type(), body_callback_function_type body_handler = body_callback_function_type()) {
101
67
if (body != string_type ()) {
102
68
request << remove_header (" Content-Length" )
103
69
<< header (" Content-Length" , boost::lexical_cast<string_type>(body.size ()))
@@ -119,14 +85,7 @@ namespace boost { namespace network { namespace http {
119
85
return pimpl->request_skeleton (request, " PUT" , true , body_handler);
120
86
}
121
87
122
- BOOST_PARAMETER_MEMBER_FUNCTION ((response const ), delete_, tag,
123
- (required
124
- (request,(request const &))
125
- )
126
- (optional
127
- (body_handler,(body_callback_function_type),body_callback_function_type())
128
- )
129
- ) {
88
+ response const delete_ (request const &request, body_callback_function_type body_handler = body_callback_function_type()) {
130
89
return pimpl->request_skeleton (request, " DELETE" , true , body_handler);
131
90
}
132
91
@@ -141,31 +100,15 @@ namespace boost { namespace network { namespace http {
141
100
142
101
boost::shared_ptr<pimpl_type> pimpl;
143
102
144
- template <class ArgPack >
145
- void init_pimpl (ArgPack const & args, no_io_service) {
103
+ void init_pimpl (client_options<Tag> const & options) {
146
104
pimpl.reset (
147
105
new pimpl_type (
148
- args[_cache_resolved|false ]
149
- , args[_follow_redirects|false ]
150
- , optional<string_type>(args[_openssl_certificate|optional<string_type>()])
151
- , optional<string_type>(args[_openssl_verify_path|optional<string_type>()])
152
- )
153
- );
106
+ options.cache_resolved (),
107
+ options.follow_redirects (),
108
+ options.openssl_certificate (),
109
+ options.openssl_verify_path (),
110
+ options.io_service ()));
154
111
}
155
-
156
- template <class ArgPack >
157
- void init_pimpl (ArgPack const & args, has_io_service) {
158
- pimpl.reset (
159
- new pimpl_type (
160
- args[_cache_resolved|false ]
161
- , args[_follow_redirects|false ]
162
- , args[_io_service]
163
- , optional<string_type>(args[_openssl_certificate|optional<string_type>()])
164
- , optional<string_type>(args[_openssl_verify_path|optional<string_type>()])
165
- )
166
- );
167
- }
168
-
169
112
};
170
113
171
114
} // namespace http
0 commit comments