azure-core
curl_transport.hpp
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // SPDX-License-Identifier: MIT
3 
9 #pragma once
10 
11 #include "azure/core/context.hpp"
12 #include "azure/core/http/http.hpp"
14 
15 namespace Azure { namespace Core { namespace Http {
16 
17  namespace _detail {
23  constexpr std::chrono::milliseconds DefaultConnectionTimeout = std::chrono::minutes(5);
24  } // namespace _detail
25 
34  {
44  };
45 
49  struct CurlTransportOptions final
50  {
74  std::string CAInfo;
85  bool HttpKeepAlive = true;
94  bool SslVerifyPeer = true;
95 
104 
113  bool NoSignal = false;
114 
123  std::chrono::milliseconds ConnectionTimeout = _detail::DefaultConnectionTimeout;
124  };
125 
129  class CurlTransport final : public HttpTransport {
130  private:
131  CurlTransportOptions m_options;
132 
133  public:
139  CurlTransport(CurlTransportOptions const& options = CurlTransportOptions()) : m_options(options)
140  {
141  }
142 
151  std::unique_ptr<RawResponse> Send(Request& request, Context const& context) override;
152  };
153 
154 }}} // namespace Azure::Core::Http
Azure::Core::Http::CurlTransportSslOptions::EnableCertificateRevocationListCheck
bool EnableCertificateRevocationListCheck
This option can enable the revocation list check.
Definition: curl_transport.hpp:43
Azure::Core::Http::CurlTransport
Concrete implementation of an HTTP Transport that uses libcurl.
Definition: curl_transport.hpp:129
Azure::Core::Http::CurlTransportOptions::SslOptions
CurlTransportSslOptions SslOptions
Define the SSL options for the libcurl handle.
Definition: curl_transport.hpp:103
Azure::Core::Http::CurlTransportOptions
Set the libcurl connection options like a proxy and CA path.
Definition: curl_transport.hpp:50
context.hpp
Context for canceling long running operations.
Azure::Core::Http::CurlTransportOptions::NoSignal
bool NoSignal
When true, libcurl will not use any functions that install signal handlers or any functions that caus...
Definition: curl_transport.hpp:113
Azure::Nullable< std::string >
Azure::Core::Http::CurlTransport::Send
std::unique_ptr< RawResponse > Send(Request &request, Context const &context) override
Implements interface to send an HTTP Request and produce an HTTP RawResponse.
Definition: curl.cpp:280
Azure::Core::Http::CurlTransportOptions::SslVerifyPeer
bool SslVerifyPeer
This option determines whether libcurl verifies the authenticity of the peer's certificate.
Definition: curl_transport.hpp:94
Azure::Core::Http::Request
A request message from a client to a server.
Definition: http.hpp:176
Azure::Core::Http::CurlTransportOptions::HttpKeepAlive
bool HttpKeepAlive
All HTTP requests will keep the connection channel open to the service.
Definition: curl_transport.hpp:85
Azure
Azure SDK abstractions.
Definition: azure_assert.hpp:55
http.hpp
HTTP request and response functionality.
Azure::Core::Http::HttpTransport
Base class for all HTTP transport implementations.
Definition: transport.hpp:19
Azure::Core::Http::CurlTransportSslOptions
The available options to set libcurl SSL options.
Definition: curl_transport.hpp:34
Azure::Core::Http::CurlTransportOptions::Proxy
Azure::Nullable< std::string > Proxy
The string for the proxy is passed directly to the libcurl handle without any parsing.
Definition: curl_transport.hpp:64
transport.hpp
Utilities to be used by HTTP transport implementations.
Azure::Core::Http::CurlTransportOptions::ConnectionTimeout
std::chrono::milliseconds ConnectionTimeout
Contain the maximum time that you allow the connection phase to the server to take.
Definition: curl_transport.hpp:123
Azure::Core::Context
A context is a node within a tree that represents deadlines and key/value pairs.
Definition: context.hpp:45
Azure::Core::Http::CurlTransportOptions::CAInfo
std::string CAInfo
The string for the certificate authenticator is sent to libcurl handle directly.
Definition: curl_transport.hpp:74
Azure::Core::Http::CurlTransport::CurlTransport
CurlTransport(CurlTransportOptions const &options=CurlTransportOptions())
Construct a new CurlTransport object.
Definition: curl_transport.hpp:139