-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
How to get a hostname from connection handle in on_tls_init callback #1049
Comments
Add a hostname argument as the first arg in your on_tls_init function. Extract the hostname from the URL that you pass to m_client.get_connection. Pass that hostname here:
|
I am calling I would much prefer to be able to reuse a single tls client endpoint to be able to connect to different hostnames. Or is it not an intended way to use client endpoint? |
In the code excerpt below, create_connection calls on_tls_init which occurs before the set_uri call in the excerpt below which explains why get_uri returned null during the call to on_tls_init. That seems to contradict the documentation which says:
That quote says get_connection makes a request, but it seems to imply the request is not executed until the call to endpoint::connect, but since on_tls_init is called at the request creation stage that shows that it did connect. You said "calling set_tls_init_handler again". You seem reluctant to do that, and it seems strange you would need to do that, but I think that might be a way to solve your problem.
|
Yes, so in other words handlers are normally set on the connection object before
but in case of |
Hello! I would like to verify TLS certificate. A convenient way of doing that seems to be
ctx->set_verify_callback(asio::ssl::rfc2818_verification("host.name"));
, but it needs a hostname passed to it.Handler for
set_tls_init_handler
hasconnection_hdl
parameter and I would expect to be able to somehow retrieve hostname from it, but I have not succeeded. In particular:The text was updated successfully, but these errors were encountered: