From 7d73afe8957b64a5b3620d162265484618aee9fc Mon Sep 17 00:00:00 2001 From: Palmer Date: Thu, 22 Jul 2010 15:20:45 -0700 Subject: EXT-7145 - Handle http redirects in viewer properly. Didn't work before. Reviewed by Bao and Babbage --- indra/llmessage/llcurl.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'indra/llmessage/llcurl.cpp') diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 36874a5d48..a093e45860 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -364,13 +364,6 @@ U32 LLCurl::Easy::report(CURLcode code) responseCode = 499; 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) { @@ -469,6 +462,13 @@ void LLCurl::Easy::prepRequest(const std::string& url, setopt(CURLOPT_HEADERFUNCTION, (void*)&curlHeaderCallback); setopt(CURLOPT_HEADERDATA, (void*)this); + // Allow up to five redirects + if(responder && responder->followRedir()) + { + setopt(CURLOPT_FOLLOWLOCATION, 1); + setopt(CURLOPT_MAXREDIRS, MAX_REDIRECTS); + } + setErrorBuffer(); setCA(); @@ -1061,3 +1061,4 @@ void LLCurl::cleanupClass() curl_global_cleanup(); } +const unsigned int LLCurl::MAX_REDIRECTS = 5; \ No newline at end of file -- cgit v1.2.3 From aac8bf09885a30953822f1edee0fddeb1e6722a0 Mon Sep 17 00:00:00 2001 From: Palmer Date: Thu, 22 Jul 2010 15:26:55 -0700 Subject: EOL added. --- indra/llmessage/llcurl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmessage/llcurl.cpp') diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index a093e45860..ac50411de8 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -1061,4 +1061,4 @@ void LLCurl::cleanupClass() curl_global_cleanup(); } -const unsigned int LLCurl::MAX_REDIRECTS = 5; \ No newline at end of file +const unsigned int LLCurl::MAX_REDIRECTS = 5; -- cgit v1.2.3