curl: Be less strict when considering status codes as errors
For file:// URIs the code is 0 on success. We now do the same libcurl would do with CURLOPT_FAILONERROR enabled. Fixes #1203.
This commit is contained in:
@@ -123,7 +123,7 @@ METHOD(fetcher_t, fetch, status_t,
|
|||||||
curl_easy_setopt(this->curl, CURLOPT_HTTPHEADER, this->headers);
|
curl_easy_setopt(this->curl, CURLOPT_HTTPHEADER, this->headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG2(DBG_LIB, " sending http request to '%s'...", uri);
|
DBG2(DBG_LIB, " sending request to '%s'...", uri);
|
||||||
curl_status = curl_easy_perform(this->curl);
|
curl_status = curl_easy_perform(this->curl);
|
||||||
switch (curl_status)
|
switch (curl_status)
|
||||||
{
|
{
|
||||||
@@ -137,10 +137,10 @@ METHOD(fetcher_t, fetch, status_t,
|
|||||||
{
|
{
|
||||||
*this->result = result;
|
*this->result = result;
|
||||||
}
|
}
|
||||||
status = (result >= 200 && result < 300) ? SUCCESS : FAILED;
|
status = (result < 400) ? SUCCESS : FAILED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG1(DBG_LIB, "libcurl http request failed [%d]: %s", curl_status,
|
DBG1(DBG_LIB, "libcurl request failed [%d]: %s", curl_status,
|
||||||
error);
|
error);
|
||||||
status = FAILED;
|
status = FAILED;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user