diff options
Diffstat (limited to 'src/curl_wrapper.cpp')
-rw-r--r-- | src/curl_wrapper.cpp | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/curl_wrapper.cpp b/src/curl_wrapper.cpp index 4cfb9b5..50e20ab 100644 --- a/src/curl_wrapper.cpp +++ b/src/curl_wrapper.cpp @@ -64,16 +64,6 @@ CURLWrapper::~CURLWrapper() noexcept } } -void CURLWrapper::set_proxy(const string_view proxy) -{ - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) - CURLcode code{curl_easy_setopt(_connection, CURLOPT_PROXY, proxy.data())}; - if (code != CURLE_OK) - { - throw CURLException{code, "Failed to set proxy", _curl_buffer_error}; - } -} - answer_type CURLWrapper::make_request(const http_method &method, string uri, const parametermap ¶meters) { @@ -197,6 +187,36 @@ answer_type CURLWrapper::make_request(const http_method &method, string uri, return answer; } +void CURLWrapper::setup_connection_properties(string_view proxy, + string_view access_token, + string_view cainfo) +{ + if (!proxy.empty()) + { + set_proxy(proxy); + } + + if (!access_token.empty()) + { + set_access_token(access_token); + } + + if (!cainfo.empty()) + { + set_cainfo(cainfo); + } +} + +void CURLWrapper::set_proxy(const string_view proxy) +{ + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + CURLcode code{curl_easy_setopt(_connection, CURLOPT_PROXY, proxy.data())}; + if (code != CURLE_OK) + { + throw CURLException{code, "Failed to set proxy", _curl_buffer_error}; + } +} + void CURLWrapper::set_access_token(const string_view access_token) { // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise) |