remove 10-attempts in CURL net request - seems to be legacy fixed by setting CURLOPT_CONNECTTIMEOUT instead of CURLOPT_TIMEOUT
@@ -263,8 +263,9 @@ INetResponse* CURLNetRequest::doPull(const char* method, const String& strUrl,
int nRespCode = -1;
Vector<char> respBody;
long nStartFrom = 0;
- if (oFile)
+ if (oFile) {
nStartFrom = oFile->size();
+ }
if( !RHODESAPP().isBaseUrl(strUrl.c_str()) )
{
@@ -274,10 +275,10 @@ INetResponse* CURLNetRequest::doPull(const char* method, const String& strUrl,
}
Hashtable<String,String> h;
- if (pHeaders)
+ if (pHeaders) {
h = *pHeaders;
+ }
- for (int nAttempts = 0; nAttempts < 10; ++nAttempts) {
Vector<char> respChunk;
RequestState state;
@@ -309,8 +310,9 @@ INetResponse* CURLNetRequest::doPull(const char* method, const String& strUrl,
curl_slist_free_all(hdrs);
long statusCode = 0;
- if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &statusCode) != 0)
+ if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &statusCode) != 0) {
statusCode = 500;
+ }
RAWTRACE2("CURLNetRequest::doPull - Status code: %d, response size: %d", (int)statusCode, respChunk.size() );
@@ -325,8 +327,6 @@ INetResponse* CURLNetRequest::doPull(const char* method, const String& strUrl,
} else {
std::copy(respChunk.begin(), respChunk.end(), std::back_inserter(respBody));
}
- // Clear counter of attempts because 206 response does not considered to be failed attempt
- nAttempts = 0;
break;
default:
@@ -346,15 +346,13 @@ INetResponse* CURLNetRequest::doPull(const char* method, const String& strUrl,
} else if ( respChunk.size() > 0 ) {
nStartFrom = respBody.size();
}
- continue;
- }
-
+ } else {
nRespCode = getResponseCode(err, respBody, oSession);
- break;
}
- if( !RHODESAPP().isBaseUrl(strUrl.c_str()) )
+ if( !RHODESAPP().isBaseUrl(strUrl.c_str()) ) {
rho_net_impl_network_indicator(0);
+ }
if ( m_pCallback != 0 )
{
