-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,7 @@ Gery Vessere ([email protected]) | |
Cisco Systems | ||
Gergely Lukacsy (glukacsy) | ||
|
||
Ocedo GmbH | ||
Henning Pfeiffer (megaposer) | ||
|
||
thomasschaub |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
#endif | ||
#if defined(_WIN32) && !defined(__cplusplus_winrt) | ||
, m_buffer_request(false) | ||
|
@@ -347,6 +348,25 @@ class http_client_config | |
{ | ||
return m_ssl_context_callback; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the TLS server name indication (SNI) property. | ||
/// </summary> | ||
/// <returns>True if TLS server name indication is enabled, false otherwise.</returns> | ||
bool tlsext_host_name() const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, since this is returning a boolean value, something like is_sni_enabled() would be better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback. I was unsure whether you want to deviate from the current naming scheme in the API which does not phrase "bool-getters" as an "is_something..." question, will make the adjustments shortly. |
||
{ | ||
return m_tlsext_host_name; | ||
} | ||
|
||
/// <summary> | ||
/// Sets the TLS server name indication (SNI) property. | ||
/// </summary> | ||
/// <param name="tlsext_host_name">False to disable the TLS (ClientHello) extension for server name indication, true otherwise.</param> | ||
/// <remarks>Note: This setting is required in most virtual hosting scenarios.</remarks> | ||
void set_tlsext_host_name(bool tlsext_host_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, this is not setting the host name but enabling the set_tlsext_host_name feature. |
||
{ | ||
m_tlsext_host_name = tlsext_host_name; | ||
} | ||
#endif | ||
|
||
private: | ||
|
@@ -372,6 +392,7 @@ class http_client_config | |
|
||
#if !defined(_WIN32) && !defined(__cplusplus_winrt) | ||
std::function<void(boost::asio::ssl::context&)> m_ssl_context_callback; | ||
bool m_tlsext_host_name; | ||
#endif | ||
#if defined(_WIN32) && !defined(__cplusplus_winrt) | ||
bool m_buffer_request; | ||
|
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.