Commits

Anonymous committed cef3a09 Merge

merge backout

Comments (0)

Files changed (2)

indra/llmessage/llcurl.cpp

 		responseReason = strerror(code) + " : " + mErrorBuffer;
 	}
 		
+	if(responseCode >= 300 && responseCode < 400) //redirect
+	{
+		char new_url[512] ;
+		curl_easy_getinfo(mCurlEasyHandle, CURLINFO_REDIRECT_URL, new_url);
+		responseReason = new_url ; //get the new URL.
+	}
+
 	if (mResponder)
 	{	
 		mResponder->completedRaw(responseCode, responseReason, mChannels, mOutput);

indra/newview/lltexturefetch.cpp

 					partial = true;
 				}
 			}
-			else
-			{
-				worker->setGetStatus(status, reason);
-// 				llwarns << status << ": " << reason << llendl;
-			}
+
 			if (!success)
 			{
 				worker->setGetStatus(status, reason);
 				if (mGetStatus == HTTP_NOT_FOUND)
 				{
 					mHTTPFailCount = max_attempts = 1; // Don't retry
-					//llwarns << "Texture missing from server (404): " << mUrl << llendl;
+					llwarns << "Texture missing from server (404): " << mUrl << llendl;
 
 					//roll back to try UDP
 					if(mCanUseNET)
 					max_attempts = mHTTPFailCount+1; // Keep retrying
 					LL_INFOS_ONCE("Texture") << "Texture server busy (503): " << mUrl << LL_ENDL;
 				}
+				else if(mGetStatus >= HTTP_MULTIPLE_CHOICES && mGetStatus < HTTP_BAD_REQUEST) //http re-direct
+				{
+					++mHTTPFailCount;
+					max_attempts = 5 ; //try at most 5 times to avoid infinite redirection loop.
+
+					llwarns << "HTTP GET failed because of redirection: "  << mUrl
+							<< " Status: " << mGetStatus << " Reason: '" << mGetReason << llendl ;
+
+					//assign to the new url
+					mUrl = mGetReason ;
+				}
 				else
 				{
 					const S32 HTTP_MAX_RETRY_COUNT = 3;
 							<< " Status: " << mGetStatus << " Reason: '" << mGetReason << "'"
 							<< " Attempt:" << mHTTPFailCount+1 << "/" << max_attempts << llendl;
 				}
+
 				if (mHTTPFailCount >= max_attempts)
 				{
 					if (cur_size > 0)