Tier2: add option to fail on error in cURL params

This commit is contained in:
Kawe Mazidjatari 2024-09-13 19:36:13 +02:00
parent 9f935ec4b4
commit fa5a8f8be8
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@ struct CURLParams
, verifyPeer(false) , verifyPeer(false)
, followRedirect(false) , followRedirect(false)
, verbose(false) , verbose(false)
, failOnError(true)
{} {}
void* readFunction; void* readFunction;
@ -36,6 +37,7 @@ struct CURLParams
bool verifyPeer; bool verifyPeer;
bool followRedirect; bool followRedirect;
bool verbose; bool verbose;
bool failOnError;
}; };
size_t CURLReadFileCallback(void* data, const size_t size, const size_t nmemb, FILE* stream); size_t CURLReadFileCallback(void* data, const size_t size, const size_t nmemb, FILE* stream);

View File

@ -30,6 +30,7 @@ void CURLInitCommonOptions(CURL* curl, const char* remote,
{ {
curl_easy_setopt(curl, CURLOPT_TIMEOUT, params.timeout); curl_easy_setopt(curl, CURLOPT_TIMEOUT, params.timeout);
curl_easy_setopt(curl, CURLOPT_VERBOSE, params.verbose); curl_easy_setopt(curl, CURLOPT_VERBOSE, params.verbose);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, params.failOnError);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, params.followRedirect); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, params.followRedirect);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, params.verifyPeer); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, params.verifyPeer);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);