编译 'set_ssl_context_callback' 时出错:Windows

Error on compiling 'set_ssl_context_callback': on Windows

我想在我的上下文中添加一些 TLS 规范,因此我正在使用 set_ssl_context_callback
但是我收到错误 "set_ssl_context_callback is not a member of web::http::client::http_client_config" 因为它被包围了 :

#if !defined(_WIN32) && !defined(__cplusplus_winrt)

如何禁用这些标志?

有解决办法吗?我正在使用 Visual Studio 2017.(15.6.7)

http_client_config config;
        config.set_ssl_context_callback([](boost::asio::ssl::context &context){
            context.set_options(boost::asio::ssl::context::no_sslv2
                | boost::asio::ssl::context::no_sslv3
                | boost::asio::ssl::context::no_tlsv1
                | boost::asio::ssl::context::no_tlsv1_1);
        });
        http_client raw_client(SessionData::get_instance().GetServerUrl(), config);

我收到以下错误"set_ssl_context_callback is not a member of web::http::client::http_client_config"

这不适用于 Windows,因为它已被禁用:

if !defined(_WIN32) && !defined(__cplusplus_winrt)

使用以下命令代替 cpprest 2.10:

    auto func = [&](native_handle handle) {
        BOOL win32Result = FALSE;
        DWORD secure_protocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
        win32Result = ::WinHttpSetOption(handle,
            WINHTTP_OPTION_SECURE_PROTOCOLS,
            &secure_protocols,
            sizeof(secure_protocols));
        if (FALSE == win32Result) {
            MessageBox(NULL, L"error", L"Failed to set minimum TLS option", MB_OK);
        }
        else
            MessageBox(NULL, L"error", L"Set minimum TLS option to Success", MB_OK);

    };

   config.set_nativesessionhandle_options(func)