Add set_proxy().

This commit is contained in:
tastytea 2020-11-13 18:18:22 +01:00
parent 921e4e271e
commit 194e729b29
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 18 additions and 0 deletions

View File

@ -83,6 +83,12 @@ void CURLWrapper::set_useragent(string_view useragent)
check(curl_easy_setopt(_connection, CURLOPT_USERAGENT, useragent.data()));
}
void CURLWrapper::set_proxy(const string_view proxy)
{
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
check(curl_easy_setopt(_connection, CURLOPT_PROXY, proxy.data()));
}
answer CURLWrapper::make_http_request(http_method method, string_view uri)
{
_buffer_headers.clear();

View File

@ -154,6 +154,18 @@ public:
*/
void set_useragent(string_view useragent);
/*!
* @brief Set a proxy.
*
* For more information consult [CURLOPT_PROXY(3)]
* (https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html).
*
* May throw CURLException.
*
* @since 0.1.1
*/
inline void set_proxy(string_view proxy);
/*!
* @brief Make a HTTP request.
*