summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-07-26 10:34:39 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-07-26 10:34:39 +0100
commit44d0fd81ee3d26a80068713182ac19885ea40f95 (patch)
tree96577339efce5ccb30dc3968ebb3ee2bd9ea4155 /indra/llmessage
parentd6726e6e4b40efaee35b8df5ac9d1098f208bcac (diff)
parentfe91462d6277251dbcc6053bc8ecd54dd93a13f0 (diff)
(hairy) merge from viewer-release
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcurl.cpp15
-rw-r--r--indra/llmessage/llcurl.h6
2 files changed, 14 insertions, 7 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 36874a5d48..ac50411de8 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;
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index b6a637ae5b..20ca87c87b 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -123,6 +123,11 @@ public:
// Used internally to set the url for debugging later.
void setURL(const std::string& url);
+ virtual bool followRedir()
+ {
+ return false;
+ }
+
public: /* but not really -- don't touch this */
U32 mReferenceCount;
@@ -182,6 +187,7 @@ public:
private:
static std::string sCAPath;
static std::string sCAFile;
+ static const unsigned int MAX_REDIRECTS;
};
namespace boost