diff options
Diffstat (limited to 'src/curl_wrapper.cpp')
-rw-r--r-- | src/curl_wrapper.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/curl_wrapper.cpp b/src/curl_wrapper.cpp index b4b9dde..996f5fb 100644 --- a/src/curl_wrapper.cpp +++ b/src/curl_wrapper.cpp @@ -17,8 +17,10 @@ #include "curl_wrapper.hpp" #include "exceptions.hpp" #include "log.hpp" +#include "version.hpp" #include <cstdint> +#include <cstring> namespace mastodonpp { @@ -180,6 +182,15 @@ void CURLWrapper::setup_curl() throw CURLException{code, "Failed to set write data", _curl_buffer_error}; } + + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + code = curl_easy_setopt(_connection, CURLOPT_USERAGENT, + string("mastorss/").append(version).c_str()); + if (code != CURLE_OK) + { + throw CURLException{code, "Failed to set User-Agent", + _curl_buffer_error}; + } } } // namespace mastodonpp |