Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I try to create https server on windows , the following exception occurs . #1500

Open
hurry11 opened this issue Sep 17, 2020 · 0 comments
Open

Comments

@hurry11
Copy link

@hurry11 hurry11 commented Sep 17, 2020

The exception:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

Where the exception occurred:
cpprestsdk.v142.2.10.15\include\cpprest\asyncrt_utils.h
template<typename _Type, typename _Arg1, typename _Arg2>
std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2)
{
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2)));
}

The environment:
windows 10 , vs 2017, sdk10.0.18362.0, cpprestsdk.v142.2.10.15, debug, x86,boost_1_71_0

My code:

bool verify_certificate(bool bPreverified, boost::asio::ssl::verify_context& ctx)
{
char szSubjectName[256] = { 0 };
X509* pCert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
X509_NAME_oneline(X509_get_subject_name(pCert), szSubjectName, sizeof(szSubjectName));
return bPreverified;
}

http_listener_config server_config;
auto  lambdaVerify = [&](boost::asio::ssl::context& ctx)
{
    ctx.set_options(boost::asio::ssl::context::default_workarounds);
    ctx.set_verify_mode(boost::asio::ssl::verify_peer);
    ctx.set_verify_callback(verify_certificate);
    ctx.use_certificate_file(m_strCertFile, boost::asio::ssl::context::pem);
    ctx.use_rsa_private_key_file(m_strPrivateKeyFile, boost::asio::ssl::context::pem);
};
server_config.set_ssl_context_callback(lambdaVerify);
m_pListener = new http_listener(addr, server_config);// exception on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.