20#ifndef KICAD_CURL_EASY_H_
21#define KICAD_CURL_EASY_H_
38#include <shared_mutex>
82 void SetHeader(
const std::string& aName,
const std::string& aValue );
98 bool SetPostFields(
const std::vector<std::pair<std::string, std::string>>& aFields );
115 bool SetURL(
const std::string& aURL );
142 std::string Escape(
const std::string& aUrl );
144 bool SetTransferCallback(
const TRANSFER_CALLBACK& aCallback,
size_t aInterval );
146 bool SetOutputStream(
const std::ostream* aOutput );
157 bool SetConnectTimeout(
long aTimeoutSecs );
171 bool SetTimeout(
long aTimeoutSecs );
186 bool SetStallTimeout(
long aMinBytesPerSec,
long aDurationSecs );
190 int GetResponseStatusCode();
200 template <
typename T>
201 int setOption(
int aOption,
T aArg );
int Perform()
Equivalent to curl_easy_perform.
bool SetPostFields(const std::vector< std::pair< std::string, std::string > > &aFields)
Set fields for application/x-www-form-urlencoded POST request.
std::unique_ptr< CURL_PROGRESS > progress
bool SetUserAgent(const std::string &aAgent)
Set the request user agent.
std::shared_lock< std::shared_mutex > m_curlSharedLock
void SetHeader(const std::string &aName, const std::string &aValue)
Set an arbitrary header for the HTTP(s) request.
const std::string & GetBuffer()
Return a reference to the received data buffer.
bool SetURL(const std::string &aURL)
Set the request URL.
bool SetFollowRedirects(bool aFollow)
Enable the following of HTTP(s) and other redirects, by default curl does not follow redirects.
int GetTransferTotal(uint64_t &aDownloadedBytes) const
const std::string GetErrorText(int aCode)
Fetch CURL's "friendly" error string for a given error code.
std::function< int(size_t, size_t, size_t, size_t)> TRANSFER_CALLBACK
Wrapper interface around the curl_easy API/.