3#include <HttpStatusCodes_C++11.h>
56 void setCommonFields(
const std::string &fullURL, std::string &receivedData, CURLoption method);
65 void setCommonFields(
const std::string &fullURL, std::string &receivedData, CURLoption method,
66 const std::string &payload);
76 static size_t writeDataCallback(
const char *contents,
size_t size,
size_t nmemb, std::string *userp);
111 template <
typename T>
bool setOption(CURLoption option, T value)
113 return curl_easy_setopt(
_curl, option, value) == CURLE_OK;
129 CURLcode
sendGETRequest(
const std::string &index, std::string &receivedData, HttpStatus::Code &statusCode);
138 CURLcode
sendHEADRequest(
const std::string &index, std::string &receivedData, HttpStatus::Code &statusCode);
148 CURLcode
sendPOSTRequest(
const std::string &index,
const std::string &payload, std::string &receivedData,
149 HttpStatus::Code &statusCode);
159 CURLcode
sendPUTRequest(
const std::string &index,
const std::string &payload, std::string &receivedData,
160 HttpStatus::Code &statusCode);
constexpr int HTTP_TIMEOUT_MS
HTTP connection timeout in milliseconds.
const std::string & getHostAddress() const
CURLcode sendPUTRequest(const std::string &index, const std::string &payload, std::string &receivedData, HttpStatus::Code &statusCode)
HTTP(std::string addr, int timeoutInMs=HTTP_TIMEOUT_MS)
CURLcode sendHEADRequest(const std::string &index, std::string &receivedData, HttpStatus::Code &statusCode)
HTTP & operator=(HTTP)=delete
Copy assignment operator.
HTTP(const HTTP &)=delete
Copy constructor.
CURLcode performRequest(HttpStatus::Code &statusCode)
CURLcode sendPOSTRequest(const std::string &index, const std::string &payload, std::string &receivedData, HttpStatus::Code &statusCode)
HTTP(HTTP &&)=delete
Move constructor.
HTTP & operator=(HTTP &&)=delete
Move assignment operator.
bool setOption(CURLoption option, T value)
CURL * _curl
CURL handler.
static size_t writeDataCallback(const char *contents, size_t size, size_t nmemb, std::string *userp)
void setCommonFields(const std::string &fullURL, std::string &receivedData, CURLoption method)
CURLcode sendGETRequest(const std::string &index, std::string &receivedData, HttpStatus::Code &statusCode)
std::string _hostAddr
Full path of server.
long startTransferTime
Total processing time for starting transfer in microseconds.
size_t requestBytes
Total request size in bytes.
long uploadSpeed
Upload bandwidth in Bps.
long preTransferTime
Total processing time for pre-transfer period in microseconds.
size_t headerBytes
Total header size in bytes.
size_t uploadBytes
Total uploaded bytes.
long nameLookupTime
Total processing time for name lookup in microseconds.
long totalTime
Total processing time in microseconds.
long redirectTime
Total processing time for redirections in microseconds.
size_t downloadBytes
Total downloaded bytes.
long connectionTime
Total processing time for connection in microseconds.
long downloadSpeed
Download bandwidth in Bps.