summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/other_tools/utils/curl_easy_handle.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/other_tools/utils/curl_easy_handle.cpp b/src/other_tools/utils/curl_easy_handle.cpp
index 17ba0261..6a98056e 100644
--- a/src/other_tools/utils/curl_easy_handle.cpp
+++ b/src/other_tools/utils/curl_easy_handle.cpp
@@ -116,6 +116,10 @@ auto CurlEasyHandle::DownloadToFile(
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
curl_easy_setopt(handle_.get(), CURLOPT_FOLLOWLOCATION, 1);
+ // ensure failure on error codes that otherwise might return OK
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
+ curl_easy_setopt(handle_.get(), CURLOPT_FAILONERROR, 1);
+
// set callback for writing to file
std::ofstream file(file_path.c_str(), std::ios::binary);
@@ -194,6 +198,10 @@ auto CurlEasyHandle::DownloadToString(std::string const& url) noexcept
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
curl_easy_setopt(handle_.get(), CURLOPT_FOLLOWLOCATION, 1);
+ // ensure failure on error codes that otherwise might return OK
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
+ curl_easy_setopt(handle_.get(), CURLOPT_FAILONERROR, 1);
+
// set callback for writing to string
std::string content{};