mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08:00
UI: Add fail_on_error parameter to GetRemoteFile
CURLOPT_FAILONERROR swallows the body of 40X responses, but in some cases we want to read the body for error details.
This commit is contained in:
+3
-2
@@ -123,7 +123,7 @@ bool GetRemoteFile(const char *url, std::string &str, std::string &error,
|
||||
long *responseCode, const char *contentType,
|
||||
std::string request_type, const char *postData,
|
||||
std::vector<std::string> extraHeaders,
|
||||
std::string *signature, int timeoutSec)
|
||||
std::string *signature, int timeoutSec, bool fail_on_error)
|
||||
{
|
||||
vector<string> header_in_list;
|
||||
char error_in[CURL_ERROR_SIZE];
|
||||
@@ -158,7 +158,8 @@ bool GetRemoteFile(const char *url, std::string &str, std::string &error,
|
||||
curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, "");
|
||||
curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, header);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, error_in);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
|
||||
if (fail_on_error)
|
||||
curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
|
||||
string_write);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &str);
|
||||
|
||||
Reference in New Issue
Block a user