Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreidheim <eidheim@gmail.com>2016-12-18 13:42:30 +0300
committereidheim <eidheim@gmail.com>2016-12-18 13:45:31 +0300
commit007f3494f4908556c83ac75f1df40f517d681ef0 (patch)
treefb82c7063a3f0c596cb21f8129e17e8f11313dfb /client_wss.hpp
parentbc5bf31a602ed3f5ea3087d44e85f7663cb313d0 (diff)
Cleanup of SocketClient<WSS> constructor
Diffstat (limited to 'client_wss.hpp')
-rw-r--r--client_wss.hpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/client_wss.hpp b/client_wss.hpp
index 26d125a..02328d1 100644
--- a/client_wss.hpp
+++ b/client_wss.hpp
@@ -15,24 +15,23 @@ namespace SimpleWeb {
const std::string& verify_file=std::string()) :
SocketClientBase<WSS>::SocketClientBase(server_port_path, 443),
context(boost::asio::ssl::context::tlsv12) {
- if(verify_certificate) {
- context.set_verify_mode(boost::asio::ssl::verify_peer);
- context.set_verify_callback(boost::asio::ssl::rfc2818_verification(host));
- context.set_default_verify_paths();
- }
- else
- context.set_verify_mode(boost::asio::ssl::verify_none);
-
if(cert_file.size()>0 && private_key_file.size()>0) {
context.use_certificate_chain_file(cert_file);
context.use_private_key_file(private_key_file, boost::asio::ssl::context::pem);
}
- if(verify_file.size()>0) {
+ if(verify_certificate)
+ context.set_verify_callback(boost::asio::ssl::rfc2818_verification(host));
+
+ if(verify_file.size()>0)
context.load_verify_file(verify_file);
+ else
+ context.set_default_verify_paths();
+
+ if(verify_file.size()>0 || verify_certificate)
context.set_verify_mode(boost::asio::ssl::verify_peer);
- }
-
+ else
+ context.set_verify_mode(boost::asio::ssl::verify_none);
};
protected: