@@ -312,6 +312,35 @@ class http_client_config
312312 }
313313#endif
314314
315+ // / <summary>
316+ // / Sets a callback to enable custom setting of platform specific options.
317+ // / </summary>
318+ // / <remarks>
319+ // / The native_handle is the following type depending on the underlying platform:
320+ // / Windows Desktop, WinHTTP - HINTERNET
321+ // / Windows Runtime, WinRT - IXMLHTTPRequest2 *
322+ // / All other platforms, Boost.Asio:
323+ // / https - boost::asio::ssl::stream<boost::asio::ip::tcp::socket &> *
324+ // / http - boost::asio::ip::tcp::socket *
325+ // / </remarks>
326+ // / <param name="callback">A user callback allowing for customization of the session</param>
327+ void set_nativesessionhandle_options (const std::function<void (native_handle)> &callback)
328+ {
329+ m_set_user_nativesessionhandle_options = callback;
330+ }
331+
332+ // / <summary>
333+ // / Invokes a user's callback to allow for customization of the session.
334+ // / </summary>
335+ // / <param name="handle">A internal implementation handle.</param>
336+ void invoke_nativesessionhandle_options (native_handle handle) const
337+ {
338+ if (m_set_user_nativesessionhandle_options != nullptr ) {
339+ m_set_user_nativesessionhandle_options (handle);
340+ }
341+ }
342+
343+
315344 // / <summary>
316345 // / Sets a callback to enable custom setting of platform specific options.
317346 // / </summary>
@@ -397,6 +426,7 @@ class http_client_config
397426#endif
398427
399428 std::function<void (native_handle)> m_set_user_nativehandle_options;
429+ std::function<void (native_handle)> m_set_user_nativesessionhandle_options;
400430
401431#if !defined(_WIN32) && !defined(__cplusplus_winrt) || defined(CPPREST_FORCE_HTTP_CLIENT_ASIO)
402432 std::function<void (boost::asio::ssl::context&)> m_ssl_context_callback;
0 commit comments