This repository was archived by the owner on Jun 12, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,15 @@ set(BOOST_COMPONENTS system thread filesystem date_time)
1111if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "GNU" )
1212 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
1313 set (BOOST_COMPONENTS ${BOOST_COMPONENTS} regex )
14- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_BOOST_REGEX" )
14+ message ("legacy GCC detected: boost regex" )
15+ add_definitions (-DUSE_BOOST_REGEX)
1516 endif ()
1617endif ()
1718find_package (Boost 1.53.0 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
19+ if (Boost_MINOR_VERSION LESS 58)
20+ message ("legacy boost detected: using TLS 1.2 workaround" )
21+ add_definitions (-DBOOST_TLS12_FALLBACK)
22+ endif ()
1823include_directories (SYSTEM ${Boost_INCLUDE_DIR} )
1924
2025if (APPLE )
Original file line number Diff line number Diff line change @@ -13,7 +13,13 @@ 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+ #ifdef BOOST_TLS12_FALLBACK
17+ ClientBase<HTTPS>::ClientBase(server_port_path, 443 ), context(boost::asio::ssl::context::sslv23) {
18+ long disallow_ssl_flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
19+ context.set_options (boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | disallow_ssl_flags);
20+ #else
21+ ClientBase<HTTPS>::ClientBase (server_port_path, 443 ), context (boost::asio::ssl::context::tlsv12) {
22+ #endif
1723 if (cert_file.size ()>0 && private_key_file.size ()>0 ) {
1824 context.use_certificate_chain_file (cert_file);
1925 context.use_private_key_file (private_key_file, boost::asio::ssl::context::pem);
Original file line number Diff line number Diff line change @@ -25,7 +25,13 @@ 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+ #ifdef BOOST_TLS12_FALLBACK
29+ ServerBase<HTTPS>::ServerBase(443 ), context(boost::asio::ssl::context::sslv23) {
30+ long disallow_ssl_flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
31+ context.set_options (boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | disallow_ssl_flags);
32+ #else
33+ ServerBase<HTTPS>::ServerBase (443 ), context (boost::asio::ssl::context::tlsv12) {
34+ #endif
2935 context.use_certificate_chain_file (cert_file);
3036 context.use_private_key_file (private_key_file, boost::asio::ssl::context::pem);
3137
You can’t perform that action at this time.
0 commit comments