diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-05-22 15:11:23 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2014-05-31 20:37:55 +0200 |
commit | e14507cb71131c6fd993346f38d894c29cc5e4c3 (patch) | |
tree | 37f07421aae562087fe0eea29cf603938a05e12a /src/libstrongswan/plugins/curl | |
parent | 344c9f91f355c4f94c82ef1a2564115f7fee8748 (diff) | |
download | strongswan-e14507cb71131c6fd993346f38d894c29cc5e4c3.tar.bz2 strongswan-e14507cb71131c6fd993346f38d894c29cc5e4c3.tar.xz |
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.
Diffstat (limited to 'src/libstrongswan/plugins/curl')
-rw-r--r-- | src/libstrongswan/plugins/curl/curl_fetcher.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/libstrongswan/plugins/curl/curl_fetcher.c b/src/libstrongswan/plugins/curl/curl_fetcher.c index 573c4c369..620cf74f3 100644 --- a/src/libstrongswan/plugins/curl/curl_fetcher.c +++ b/src/libstrongswan/plugins/curl/curl_fetcher.c @@ -108,7 +108,7 @@ METHOD(fetcher_t, fetch, status_t, goto out; } 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); if (this->timeout) { @@ -129,25 +129,16 @@ METHOD(fetcher_t, fetch, status_t, status = NOT_SUPPORTED; break; case CURLE_OK: + curl_easy_getinfo(this->curl, CURLINFO_RESPONSE_CODE, + &result); if (this->result) { - curl_easy_getinfo(this->curl, CURLINFO_RESPONSE_CODE, - &result); *this->result = result; } - status = SUCCESS; + status = (result >= 200 && result < 300) ? SUCCESS : FAILED; break; default: - if (this->result) - { /* 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); - } + DBG1(DBG_LIB, "libcurl http request failed: %s", error); status = FAILED; break; } |