9 #ifndef INCLUDE_RESTCLIENT_CPP_CONNECTION_H_
10 #define INCLUDE_RESTCLIENT_CPP_CONNECTION_H_
12 #include <curl/curl.h>
18 #include "restclient-cpp/version.h"
100 std::string password;
103 std::string certPath;
104 std::string certType;
111 explicit Connection(
const std::string& baseUrl);
117 const std::string& password);
134 void SetCertPath(
const std::string& cert);
137 void SetCertType(
const std::string& type);
140 void SetKeyPath(
const std::string& keyPath);
154 const std::string& value);
160 const std::string& data);
162 const std::string& data);
171 bool followRedirects;
173 std::string username;
174 std::string password;
176 std::string customUserAgent;
177 std::string caInfoFilePath;
178 RequestInfo lastRequest;
179 std::string certPath;
180 std::string certType;
186 #endif // INCLUDE_RESTCLIENT_CPP_CONNECTION_H_
This structure represents the HTTP response data.
Definition: restclient.h:38
RestClient::HeaderFields GetHeaders()
get all custom headers set on the connection
Definition: connection.cc:105
double totalTime
Definition: connection.h:61
double preTransferTime
Definition: connection.h:65
double redirectTime
Definition: connection.h:67
RestClient::Connection::Info GetInfo()
get diagnostic information about the connection object
Definition: connection.cc:53
libcurl wrapper for REST calls
void FollowRedirects(bool follow)
configure whether to follow redirects on this connection
Definition: connection.cc:115
Connection(const std::string &baseUrl)
constructor for the Connection object
Definition: connection.cc:28
holds some diagnostics information about a request
Definition: connection.h:60
int redirectCount
Definition: connection.h:68
holds some diagnostics information about the connection object it came from
Definition: connection.h:93
RestClient::HeaderFields headers
Definition: connection.h:95
void SetUserAgent(const std::string &userAgent)
set custom user agent for connection. This gets prepended to the default restclient-cpp/RESTCLIENT_VE...
Definition: connection.cc:127
std::string GetUserAgent()
get the user agent to add to the request
Definition: connection.cc:149
void SetHeaders(RestClient::HeaderFields headers)
set the custom headers map. This will replace the currently configured headers with the provided ones...
Definition: connection.cc:91
void SetCAInfoFilePath(const std::string &caInfoFilePath)
set custom Certificate Authority (CA) path
Definition: connection.cc:139
std::map< std::string, std::string > HeaderFields
Definition: restclient.h:27
RestClient::Response post(const std::string &uri, const std::string &data)
HTTP POST method.
Definition: connection.cc:351
void SetTimeout(int seconds)
set timeout for connection
Definition: connection.cc:164
void AppendHeader(const std::string &key, const std::string &value)
append a header to the internal map
Definition: connection.cc:78
RestClient::Response del(const std::string &uri)
HTTP DELETE method.
Definition: connection.cc:399
RestClient::Response put(const std::string &uri, const std::string &data)
HTTP PUT method.
Definition: connection.cc:370
RestClient::Response head(const std::string &uri)
HTTP HEAD method.
Definition: connection.cc:417
double startTransferTime
Definition: connection.h:66
Connection object for advanced usage.
Definition: connection.h:28
bool followRedirects
Definition: connection.h:97
std::string customUserAgent
Definition: connection.h:106
std::string baseUrl
Definition: connection.h:94
double appConnectTime
Definition: connection.h:64
double connectTime
Definition: connection.h:63
double nameLookupTime
Definition: connection.h:62
RequestInfo lastRequest
Definition: connection.h:107
void SetBasicAuth(const std::string &username, const std::string &password)
set username and password for basic auth
Definition: connection.cc:176
int timeout
Definition: connection.h:96
namespace for all RestClient definitions
Definition: connection.h:23