2323#include < boost/asio/io_service.hpp>
2424#include < boost/optional.hpp>
2525#include < network/config.hpp>
26+ #include < network/version.hpp>
2627#include < network/http/v2/client/request.hpp>
2728#include < network/http/v2/client/response.hpp>
2829
@@ -51,17 +52,37 @@ namespace network {
5152 , follow_redirects_(false )
5253 , cache_resolved_(false )
5354 , use_proxy_(false )
55+ , always_verify_peer_(false )
56+ , user_agent_(std::string(" cpp-netlib/" ) + NETLIB_VERSION)
5457 , timeout_(30000 ) { }
5558
5659/* *
5760 * \brief Copy constructor.
5861*/
59- client_options (client_optionsconst &) =default ;
62+ client_options (const client_options &other)
63+ : io_service_(other.io_service_)
64+ , follow_redirects_(other.follow_redirects_)
65+ , cache_resolved_(other.cache_resolved_)
66+ , use_proxy_(other.use_proxy_)
67+ , always_verify_peer_(other.always_verify_peer_)
68+ , user_agent_(other.user_agent_)
69+ , timeout_(other.timeout_)
70+ , openssl_certificate_paths_(other.openssl_certificate_paths_)
71+ , openssl_verify_paths_(other.openssl_verify_paths_) { }
6072
6173/* *
6274 * \brief Move constructor.
6375*/
64- client_options (client_options &&) =default ;
76+ client_options (client_options &&other)
77+ : io_service_(std::move(io_service_))
78+ , follow_redirects_(std::move(other.follow_redirects_))
79+ , cache_resolved_(std::move(other.cache_resolved_))
80+ , use_proxy_(std::move(other.use_proxy_))
81+ , always_verify_peer_(std::move(other.always_verify_peer_))
82+ , user_agent_(std::move(other.user_agent_))
83+ , timeout_(std::move(other.timeout_))
84+ , openssl_certificate_paths_(std::move(other.openssl_certificate_paths_))
85+ , openssl_verify_paths_(std::move(other.openssl_verify_paths_)) { }
6586
6687/* *
6788 * \brief Assignment operator.
@@ -87,6 +108,8 @@ namespace network {
87108swap (follow_redirects_, other.follow_redirects_ );
88109swap (cache_resolved_, other.cache_resolved_ );
89110swap (use_proxy_, other.use_proxy_ );
111+ swap (always_verify_peer_, other.always_verify_peer_ );
112+ swap (user_agent_, other.user_agent_ );
90113swap (timeout_, other.timeout_ );
91114swap (openssl_certificate_paths_, other.openssl_certificate_paths_ );
92115swap (openssl_verify_paths_, other.openssl_verify_paths_ );
@@ -220,12 +243,32 @@ namespace network {
220243return openssl_verify_paths_;
221244 }
222245
246+ client_options &always_verify_peer (bool always_verify_peer) {
247+ always_verify_peer_ = always_verify_peer;
248+ return *this ;
249+ }
250+
251+ bool always_verify_peer ()const {
252+ return always_verify_peer_;
253+ }
254+
255+ client_options &user_agent (const std::string &user_agent) {
256+ user_agent_ = user_agent;
257+ return *this ;
258+ }
259+
260+ std::stringuser_agent ()const {
261+ return user_agent_;
262+ }
263+
223264private:
224265
225266 boost::optional<boost::asio::io_service &> io_service_;
226267bool follow_redirects_;
227268bool cache_resolved_;
228269bool use_proxy_;
270+ bool always_verify_peer_;
271+ std::string user_agent_;
229272 std::chrono::milliseconds timeout_;
230273 std::vector<std::string> openssl_certificate_paths_;
231274 std::vector<std::string> openssl_verify_paths_;