curl: Don't set CURLOPT_FAILONERROR
With the strongTNC REST API some errors will actually be accompanied by a response we want to receive completely.
This commit is contained in:
committed by
Andreas Steffen
parent
344c9f91f3
commit
e14507cb71
@@ -108,7 +108,7 @@ METHOD(fetcher_t, fetch, status_t,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
curl_easy_setopt(this->curl, CURLOPT_ERRORBUFFER, error);
|
curl_easy_setopt(this->curl, CURLOPT_ERRORBUFFER, error);
|
||||||
curl_easy_setopt(this->curl, CURLOPT_FAILONERROR, TRUE);
|
curl_easy_setopt(this->curl, CURLOPT_FAILONERROR, FALSE);
|
||||||
curl_easy_setopt(this->curl, CURLOPT_NOSIGNAL, TRUE);
|
curl_easy_setopt(this->curl, CURLOPT_NOSIGNAL, TRUE);
|
||||||
if (this->timeout)
|
if (this->timeout)
|
||||||
{
|
{
|
||||||
@@ -129,25 +129,16 @@ METHOD(fetcher_t, fetch, status_t,
|
|||||||
status = NOT_SUPPORTED;
|
status = NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
case CURLE_OK:
|
case CURLE_OK:
|
||||||
|
curl_easy_getinfo(this->curl, CURLINFO_RESPONSE_CODE,
|
||||||
|
&result);
|
||||||
if (this->result)
|
if (this->result)
|
||||||
{
|
{
|
||||||
curl_easy_getinfo(this->curl, CURLINFO_RESPONSE_CODE,
|
|
||||||
&result);
|
|
||||||
*this->result = result;
|
*this->result = result;
|
||||||
}
|
}
|
||||||
status = SUCCESS;
|
status = (result >= 200 && result < 300) ? SUCCESS : FAILED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (this->result)
|
DBG1(DBG_LIB, "libcurl http request failed: %s", error);
|
||||||
{ /* don't log an error in this case */
|
|
||||||
curl_easy_getinfo(this->curl, CURLINFO_RESPONSE_CODE,
|
|
||||||
&result);
|
|
||||||
*this->result = result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBG1(DBG_LIB, "libcurl http request failed: %s", error);
|
|
||||||
}
|
|
||||||
status = FAILED;
|
status = FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user