azure-core
Loading...
Searching...
No Matches
curl_transport.hpp
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
9#pragma once
10
14
15#include <chrono>
16#include <memory>
17#include <string>
18
19namespace Azure { namespace Core { namespace Http {
20 class CurlNetworkConnection;
21
22 namespace _detail {
28 constexpr std::chrono::milliseconds DefaultConnectionTimeout = std::chrono::minutes(5);
29 } // namespace _detail
30
39 {
48
58
72 };
73
78 {
93
104
128 std::string CAInfo;
129
140 std::string CAPath;
141
152 bool HttpKeepAlive = true;
153
162 bool SslVerifyPeer = true;
163
172
181 bool NoSignal = false;
182
191 std::chrono::milliseconds ConnectionTimeout = _detail::DefaultConnectionTimeout;
192
196 bool EnableCurlTracing = false;
197 };
198
203 private:
204 CurlTransportOptions m_options;
205
210 virtual void OnUpgradedConnection(std::unique_ptr<CurlNetworkConnection>&&){};
211
212 public:
218 CurlTransport(CurlTransportOptions const& options = CurlTransportOptions()) : m_options(options)
219 {
220 }
221
228
237 virtual ~CurlTransport() = default;
238
247 std::unique_ptr<RawResponse> Send(Request& request, Context const& context) override;
248 };
249
250}}} // namespace Azure::Core::Http
A context is a node within a unidirectional tree that represents deadlines and key/value pairs.
Definition context.hpp:72
Concrete implementation of an HTTP Transport that uses libcurl.
Definition curl_transport.hpp:202
CurlTransport(CurlTransportOptions const &options=CurlTransportOptions())
Construct a new CurlTransport object.
Definition curl_transport.hpp:218
virtual ~CurlTransport()=default
Destroys a CurlTransport object.
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:344
Base class for all HTTP transport implementations.
Definition transport.hpp:22
A request message from a client to a server.
Definition http.hpp:182
Manages an optional contained value, i.e. a value that may or may not be present.
Definition nullable.hpp:30
Compute the hash value for the input binary data, using SHA256, SHA384 and SHA512.
Definition azure_assert.hpp:57
Manages an optional contained value, i.e. a value that may or may not be present.
HTTP transport policies, and their options.
Set the libcurl connection options like a proxy and CA path.
Definition curl_transport.hpp:78
bool SslVerifyPeer
This option determines whether libcurl verifies the authenticity of the peer's certificate.
Definition curl_transport.hpp:162
bool HttpKeepAlive
All HTTP requests will keep the connection channel open to the service.
Definition curl_transport.hpp:152
Azure::Nullable< std::string > ProxyUsername
Username to be used for proxy connections.
Definition curl_transport.hpp:103
std::string CAPath
Path to a directory which holds PEM encoded file, containing the certificate authorities sent to libc...
Definition curl_transport.hpp:140
CurlTransportSslOptions SslOptions
Define the SSL options for the libcurl handle.
Definition curl_transport.hpp:171
std::string CAInfo
Path to a PEM encoded file containing the certificate authorities sent to libcurl handle directly.
Definition curl_transport.hpp:128
Azure::Nullable< std::string > ProxyPassword
Password to be used for proxy connections.
Definition curl_transport.hpp:115
bool EnableCurlTracing
If set, integrates libcurl's internal tracing with Azure logging.
Definition curl_transport.hpp:196
bool NoSignal
When true, libcurl will not use any functions that install signal handlers or any functions that caus...
Definition curl_transport.hpp:181
Azure::Nullable< std::string > Proxy
The string for the proxy is passed directly to the libcurl handle without any parsing.
Definition curl_transport.hpp:92
std::chrono::milliseconds ConnectionTimeout
Contain the maximum time that you allow the connection phase to the server to take.
Definition curl_transport.hpp:191
The available options to set libcurl SSL options.
Definition curl_transport.hpp:39
bool AllowFailedCrlRetrieval
This option allows SSL connections to proceed even if there is an error retrieving the Certificate Re...
Definition curl_transport.hpp:57
std::string PemEncodedExpectedRootCertificates
A set of PEM encoded X.509 certificates and CRLs describing the certificates used to validate the ser...
Definition curl_transport.hpp:71
bool EnableCertificateRevocationListCheck
This option can enable the revocation list check.
Definition curl_transport.hpp:47
HTTP transport options parameterize the HTTP transport adapter being used.
Definition policy.hpp:162
Utilities to be used by HTTP transport implementations.