24#ifndef KICAD_CURL_EASY_H_
25#define KICAD_CURL_EASY_H_
42#include <shared_mutex>
86 void SetHeader(
const std::string& aName,
const std::string& aValue );
102 bool SetPostFields(
const std::vector<std::pair<std::string, std::string>>& aFields );
119 bool SetURL(
const std::string& aURL );
146 std::string Escape(
const std::string& aUrl );
148 bool SetTransferCallback(
const TRANSFER_CALLBACK& aCallback,
size_t aInterval );
150 bool SetOutputStream(
const std::ostream* aOutput );
154 int GetResponseStatusCode();
164 template <
typename T>
165 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/.