summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortastytea2020-01-10 16:18:59 +0100
committertastytea2020-01-10 17:10:36 +0100
commitc47a62969f1733ec32f503b335738f4e438ee7b3 (patch)
tree2ffca205ae82547ed063e221b61f644312c1d78b /src
parentda033c3ffc10f84240ca09effd1c1fe0d32ced9c (diff)
downloadmastodonpp-c47a62969f1733ec32f503b335738f4e438ee7b3.tar
mastodonpp-c47a62969f1733ec32f503b335738f4e438ee7b3.tar.gz
mastodonpp-c47a62969f1733ec32f503b335738f4e438ee7b3.zip
Only use CURLAUTH_BEARER if libcurl supports it.
Diffstat (limited to 'src')
-rw-r--r--src/curl_wrapper.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/curl_wrapper.cpp b/src/curl_wrapper.cpp
index 18ab7a0..0c9a3f6 100644
--- a/src/curl_wrapper.cpp
+++ b/src/curl_wrapper.cpp
@@ -23,7 +23,6 @@
#include <array>
#include <atomic>
#include <cstdint>
-#include <cstring>
namespace mastodonpp
{
@@ -184,11 +183,14 @@ void CURLWrapper::set_access_token(const string_view access_token)
_curl_buffer_error};
}
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise)
- code = curl_easy_setopt(_connection, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);
- if (code == CURLE_NOT_BUILT_IN) // libcurl < 7.61.0.
+ if constexpr (LIBCURL_VERSION_NUM >= 0x073d00) // libcurl >= 7.61.0.
{
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise)
+ //NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-signed-bitwise)
+ code = curl_easy_setopt(_connection, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);
+ }
+ else
+ {
+ //NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-signed-bitwise)
code = curl_easy_setopt(_connection, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
}
if (code != CURLE_OK)