-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add TLS extension SNI for boost asio based http_client #39
Conversation
- adds the TLS server name indication extension during handshake (ClientHello) - enabled by default as most virtual host environments require it nowadays - note: setting the extension could potentially fail (i.e. if TLS would be disabled on the stream altogether), but other SSL stream options are not "guarded" either
Hi @megaposer, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
@megaposer, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
@@ -101,6 +101,7 @@ class http_client_config | |||
, m_set_user_nativehandle_options([](native_handle)->void{}) | |||
#if !defined(_WIN32) && !defined(__cplusplus_winrt) | |||
, m_ssl_context_callback([](boost::asio::ssl::context&)->void{}) | |||
, m_tlsext_host_name(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: Can we have the variable name to reflect the type it is representing, bool here?
For eg, something like m_sni_enabled?
m_tlsext_host_name gives an impression that it is storing the host name to be set.
The change looks good. I have added some comments w.r.t to the naming convention for variables and APIs. |
This has been merged to the development branch. |
As per reported issue #35 ...
This adds the TLS 1.0 server name indication extension for the boost asio based http_client. The ClientHello packet in the SSL handshake will then contain the target host name so the remote server can return the corresponding certificate for the (virtual) host.
See https://en.wikipedia.org/wiki/Server_Name_Indication for more information.
The extension is enabled by default as most virtual host environments require it nowadays.
Please note:
WinHTTP
library enables TLS 1.0 on connections with Windows 7 and higher and implicitly sends the SNI extension in the ClientHello. Disabling SNI requires to explicitly unset theWINHTTP_FLAG_SECURE_PROTOCOL_TLS1
option via a native callback handler.