Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit e39222e

Browse files
committed
Add interface with which users can custom settings for HTTP connections
1 parent 307aee0 commit e39222e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

Microsoft.WindowsAzure.Storage/includes/was/common.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,23 @@ namespace azure { namespace storage {
17281728
}
17291729
#endif
17301730

1731+
/// <summary>
1732+
/// Sets a callback to enable custom setting of platform specific options.
1733+
/// </summary>
1734+
/// <param name="callback">A user callback allowing for customization of the session.</param>
1735+
void set_native_session_handle_options_callback(const std::function<void(web::http::client::native_handle)>& callback)
1736+
{
1737+
m_native_session_handle_options_callback = callback;
1738+
}
1739+
1740+
/// <summary>
1741+
/// Gets the user's callback to custom setting of platform specific options.
1742+
/// </summary>
1743+
const std::function<void(web::http::client::native_handle)>& get_native_session_handle_options_callback() const
1744+
{
1745+
return m_native_session_handle_options_callback;
1746+
}
1747+
17311748
private:
17321749

17331750
std::function<void(web::http::http_request &, operation_context)> m_sending_request;
@@ -1744,6 +1761,7 @@ namespace azure { namespace storage {
17441761
boost::log::sources::severity_logger<boost::log::trivial::severity_level> m_logger;
17451762
std::function<void(boost::asio::ssl::context&)> m_ssl_context_callback; //No need to initialize as CPPRest does not initialize it.
17461763
#endif
1764+
std::function<void(web::http::client::native_handle)> m_native_session_handle_options_callback;
17471765
};
17481766

17491767
/// <summary>
@@ -1991,6 +2009,23 @@ namespace azure { namespace storage {
19912009
}
19922010
#endif
19932011

2012+
/// <summary>
2013+
/// Sets a callback to enable custom setting of platform specific options.
2014+
/// </summary>
2015+
/// <param name="callback">A user callback allowing for customization of the session.</param>
2016+
void set_native_session_handle_options_callback(const std::function<void(web::http::client::native_handle)>& callback)
2017+
{
2018+
m_impl->set_native_session_handle_options_callback(callback);
2019+
}
2020+
2021+
/// <summary>
2022+
/// Gets the user's callback to custom setting of platform specific options.
2023+
/// </summary>
2024+
const std::function<void(web::http::client::native_handle)>& get_native_session_handle_options_callback() const
2025+
{
2026+
return m_impl->get_native_session_handle_options_callback();
2027+
}
2028+
19942029
std::shared_ptr<_operation_context> _get_impl() const
19952030
{
19962031
return m_impl;

Microsoft.WindowsAzure.Storage/src/executor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ namespace azure { namespace storage { namespace core {
149149
config.set_ssl_context_callback(instance->m_context._get_impl()->get_ssl_context_callback());
150150
}
151151
#endif
152+
if (instance->m_context._get_impl()->get_native_session_handle_options_callback() != nullptr)
153+
{
154+
config.set_nativesessionhandle_options(instance->m_context._get_impl()->get_native_session_handle_options_callback());
155+
}
152156

153157
config.set_validate_certificates(instance->m_request_options.validate_certificates());
154158

0 commit comments

Comments
 (0)