diff --git a/src/curl.cpp b/src/curl.cpp index c7a4788..9976290 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -2065,7 +2065,7 @@ int S3fsCurl::RequestPerform(void) } // 1 attempt + retries... - for(int retrycnt = S3fsCurl::retries; 0 < retrycnt; retrycnt--){ + for(int retrycnt = 0; retrycnt < S3fsCurl::retries; ++retrycnt){ // Requests CURLcode curlCode = curl_easy_perform(hCurl); @@ -2081,11 +2081,6 @@ int S3fsCurl::RequestPerform(void) S3FS_PRN_INFO3("HTTP response code %ld", LastResponseCode); return 0; } - if(500 <= LastResponseCode){ - S3FS_PRN_ERR("HTTP response code = %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : "")); - sleep(4); - break; - } // Service response codes which are >= 300 && < 500 switch(LastResponseCode){ @@ -2108,6 +2103,17 @@ int S3fsCurl::RequestPerform(void) S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); return -ENOENT; + case 501: + S3FS_PRN_INFO3("HTTP response code 501 was returned, returning ENOTSUP"); + S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); + return -ENOTSUP; + + case 503: + S3FS_PRN_INFO3("HTTP response code 503 was returned, slowing down"); + S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : "")); + sleep(4 << retry_count); + break; + default: S3FS_PRN_ERR("HTTP response code %ld, returning EIO. Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : "")); return -EIO;