Skip to content

Commit 7881179

Browse files
committed
Finishing client_options implementation.
1 parent 4bca1ae commit 7881179

File tree

4 files changed

+55
-24
lines changed

4 files changed

+55
-24
lines changed

boost/network/protocol/http/client/facade.ipp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55

66
namespace boost { namespace network { namespace http {
77

8+
basic_client_facade::basic_client_facade()
9+
: base(new (std::nothrow) client_base())
10+
{}
11+
12+
basic_client_facade::basic_client_facade(client_options const &options)
13+
: base(new (std::nothrow) client_base(options))
14+
{}
15+
816
response const basic_client_facade::head(request const &request,
917
request_options const&options) {
1018
return base->request_skeleton(request,

boost/network/protocol/http/client/options.ipp

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_IPP
99

1010
#include <boost/network/protocol/http/client/options.hpp>
11+
#include <boost/network/protocol/http/client/simple_connection_manager.hpp>
12+
#include <boost/network/protocol/http/client/connection/simple_connection_factory.hpp>
1113

1214
namespace boost { namespace network { namespace http {
1315

@@ -19,7 +21,10 @@ public:
1921
, cache_resolved_(false)
2022
, openssl_certificate_paths_()
2123
, openssl_verify_paths_()
22-
{}
24+
, connection_manager_()
25+
, connection_factory_()
26+
{
27+
}
2328

2429
client_options_pimpl *clone() const {
2530
return new (std::nothrow) client_options_pimpl(*this);
@@ -65,13 +70,31 @@ public:
6570
return openssl_verify_paths_;
6671
}
6772

73+
void connection_manager(shared_ptr<http::connection_manager> manager) {
74+
connection_manager_ = manager;
75+
}
76+
77+
shared_ptr<http::connection_manager> connection_manager() const {
78+
return connection_manager_;
79+
}
80+
81+
void connection_factory(shared_ptr<http::connection_factory> factory) {
82+
connection_factory_ = factory;
83+
}
84+
85+
shared_ptr<http::connection_factory> connection_factory() const {
86+
return connection_factory_;
87+
}
88+
6889
private:
6990
client_options_pimpl(client_options_pimpl const &other)
7091
: io_service_(other.io_service_)
7192
, follow_redirects_(other.follow_redirects_)
7293
, cache_resolved_(other.cache_resolved_)
7394
, openssl_certificate_paths_(other.openssl_certificate_paths_)
7495
, openssl_verify_paths_(other.openssl_verify_paths_)
96+
, connection_manager_(other.connection_manager_)
97+
, connection_factory_(other.connection_factory_)
7598
{}
7699

77100
client_options_pimpl& operator=(client_options_pimpl); // cannot assign
@@ -80,6 +103,8 @@ private:
80103
asio::io_service *io_service_;
81104
bool follow_redirects_, cache_resolved_;
82105
std::list<std::string> openssl_certificate_paths_, openssl_verify_paths_;
106+
shared_ptr<http::connection_manager> connection_manager_;
107+
shared_ptr<http::connection_factory> connection_factory_;
83108
};
84109

85110
client_options::client_options()
@@ -149,6 +174,24 @@ std::list<std::string> const & client_options::openssl_verify_paths() const {
149174
return pimpl->openssl_verify_paths();
150175
}
151176

177+
client_options& client_options::connection_manager(shared_ptr<http::connection_manager> manager) {
178+
pimpl->connection_manager(manager);
179+
return *this;
180+
}
181+
182+
shared_ptr<http::connection_manager> client_options::connection_manager() const {
183+
return pimpl->connection_manager();
184+
}
185+
186+
client_options& client_options::connection_factory(shared_ptr<http::connection_factory> factory) {
187+
pimpl->connection_factory(factory);
188+
return *this;
189+
}
190+
191+
shared_ptr<http::connection_factory> client_options::connection_factory() const {
192+
return pimpl->connection_factory();
193+
}
194+
152195
} // namespace http
153196
} // namespace network
154197
} // namespace boost

libs/network/build/CMakeLists.txt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
11
include_directories(${CPP-NETLIB_SOURCE_DIR})
2-
find_package( Boost 1.45.0 COMPONENTS unit_test_framework system regex thread filesystem )
3-
4-
add_library(cppnetlib-uri STATIC ${CPP-NETLIB_SOURCE_DIR}/libs/network/src/parse_uri_impl.cpp)
5-
add_library(cppnetlib-server-parsers STATIC ${CPP-NETLIB_SOURCE_DIR}/libs/network/src/server_request_parsers_impl.cpp)
6-
add_library(cppnetlib-message
7-
STATIC
8-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/message/message.cpp)
9-
add_library(cppnetlib-message-directives
10-
STATIC
11-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/message/directives.cpp)
12-
add_library(cppnetlib-http-message
13-
STATIC
14-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/request.cpp
15-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/response.cpp)
16-
add_library(cppnetlib-http-client-connections
17-
STATIC
18-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/client_connections.cpp
19-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/simple_connection_manager.cpp
20-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/simple_connection_factory.cpp
21-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/connection_delegate_factory.cpp)
22-
add_library(cppnetlib-http-client
23-
STATIC
24-
${CPP-NETLIB_SOURCE_DIR}/libs/network/src/http/client.cpp)
2+
add_subdirectory(../src)

libs/network/test/http/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ if (Boost_FOUND)
3030
cppnetlib-uri
3131
cppnetlib-message
3232
cppnetlib-message-wrappers
33+
cppnetlib-message-directives
3334
cppnetlib-http-message
3435
cppnetlib-http-client
3536
cppnetlib-http-client-connections)
@@ -40,6 +41,7 @@ if (Boost_FOUND)
4041
cppnetlib-uri
4142
cppnetlib-message
4243
cppnetlib-message-wrappers
44+
cppnetlib-message-directives
4345
cppnetlib-http-message
4446
cppnetlib-http-client
4547
cppnetlib-http-client-connections)

0 commit comments

Comments
 (0)