Skip to content
This repository was archived by the owner on Jun 12, 2018. It is now read-only.

Commit c9febf3

Browse files
committed
workaround for boost 1.53 TLS 1.2
1 parent 6192c13 commit c9febf3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

client_https.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ namespace SimpleWeb {
1313
Client(const std::string& server_port_path, bool verify_certificate=true,
1414
const std::string& cert_file=std::string(), const std::string& private_key_file=std::string(),
1515
const std::string& verify_file=std::string()) :
16-
ClientBase<HTTPS>::ClientBase(server_port_path, 443), context(boost::asio::ssl::context::tlsv12) {
16+
ClientBase<HTTPS>::ClientBase(server_port_path, 443), context(boost::asio::ssl::context::sslv23) {
17+
long disallow_ssl_flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
18+
context.set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | disallow_ssl_flags);
1719
if(cert_file.size()>0 && private_key_file.size()>0) {
1820
context.use_certificate_chain_file(cert_file);
1921
context.use_private_key_file(private_key_file, boost::asio::ssl::context::pem);

server_https.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ namespace SimpleWeb {
2525
}
2626

2727
Server(const std::string& cert_file, const std::string& private_key_file, const std::string& verify_file=std::string()):
28-
ServerBase<HTTPS>::ServerBase(443), context(boost::asio::ssl::context::tlsv12) {
28+
ServerBase<HTTPS>::ServerBase(443), context(boost::asio::ssl::context::sslv23) {
29+
long disallow_ssl_flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
2930
context.use_certificate_chain_file(cert_file);
3031
context.use_private_key_file(private_key_file, boost::asio::ssl::context::pem);
32+
context.set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | disallow_ssl_flags);
3133

3234
if(verify_file.size()>0) {
3335
context.load_verify_file(verify_file);

0 commit comments

Comments
 (0)