azure-core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
win_http_transport_impl.hpp
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#pragma once
5
6#include <memory>
7#include <wincrypt.h>
8
9#include <wil/resource.h>
10
11namespace Azure { namespace Core { namespace Http { namespace _detail {
12 class WinHttpTransportImpl : HttpTransport {
13 private:
14 WinHttpTransport const* m_parent;
15
16 WinHttpTransportOptions m_options;
17 // m_sessionhandle is const to ensure immutability.
18 const Azure::Core::_internal::UniqueHandle<void*> m_sessionHandle;
19 wil::unique_cert_context m_tlsClientCertificate;
20
21 Azure::Core::_internal::UniqueHandle<void*> CreateSessionHandle();
22 Azure::Core::_internal::UniqueHandle<void*> CreateConnectionHandle(
23 Azure::Core::Url const& url,
24 Azure::Core::Context const& context);
25
26 std::unique_ptr<_detail::WinHttpRequest> CreateRequestHandle(
27 Azure::Core::_internal::UniqueHandle<void*> const& connectionHandle,
28 Azure::Core::Url const& url,
29 Azure::Core::Http::HttpMethod const& method);
30
31 // Callback to allow a derived transport to extract the request handle. Used for WebSocket
32 // transports.
33 virtual void OnUpgradedConnection(std::unique_ptr<_detail::WinHttpRequest> const& request)
34 {
35 m_parent->OnUpgradedConnection(request);
36 };
37
38 public:
44 WinHttpTransportImpl(
45 WinHttpTransport const* parent,
46 WinHttpTransportOptions const& options = WinHttpTransportOptions());
47
57 WinHttpTransportImpl(
58 WinHttpTransport const* parent,
60
66 virtual std::unique_ptr<RawResponse> Send(Request& request, Context const& context) override;
67
68 // See also:
69 // [Core Guidelines C.35: "A base class destructor should be either public
70 // and virtual or protected and
71 // non-virtual"](http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-non-virtual)
72 virtual ~WinHttpTransportImpl();
73 };
74}}}} // namespace Azure::Core::Http::_detail
A context is a node within a unidirectional tree that represents deadlines and key/value pairs.
Definition context.hpp:72
The method to be performed on the resource identified by the Request.
Definition http.hpp:95
Represents the location where a request will be performed.
Definition url.hpp:46
Compute the hash value for the input binary data, using SHA256, SHA384 and SHA512.
Definition azure_assert.hpp:57
HTTP transport options parameterize the HTTP transport adapter being used.
Definition policy.hpp:166