summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2013-10-29 13:20:18 +0000
committerDon Kjer <don@lindenlab.com>2013-10-29 13:20:18 +0000
commit7866356d7719413b952787a509ebd3c4ce8d39b1 (patch)
treea200c96afd5ab8ad6da64c14ec6211aac9d5c65f /indra/llmessage
parent81fecfa9f7e8664ec4f3bcf6662fe34d4e5d41a1 (diff)
parentea1e1b0925b386cf83178539b8eae9e25c573548 (diff)
Merge viewer-release => sunshine-internal
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-xindra/llmessage/llhttpclient.cpp35
-rwxr-xr-xindra/llmessage/llhttpclient.h19
-rwxr-xr-xindra/llmessage/llinstantmessage.h2
-rwxr-xr-xindra/llmessage/llurlrequest.cpp21
-rwxr-xr-xindra/llmessage/llurlrequest.h9
-rwxr-xr-xindra/llmessage/tests/llhttpclientadapter_test.cpp2
6 files changed, 56 insertions, 32 deletions
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 70c890a8de..5e87c3398d 100755
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -220,7 +220,8 @@ static void request(
Injector* body_injector,
LLCurl::ResponderPtr responder,
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
- const LLSD& headers = LLSD()
+ const LLSD& headers = LLSD(),
+ bool follow_redirects = true
)
{
if (!LLHTTPClient::hasPump())
@@ -234,7 +235,7 @@ static void request(
}
LLPumpIO::chain_t chain;
- LLURLRequest* req = new LLURLRequest(method, url);
+ LLURLRequest* req = new LLURLRequest(method, url, follow_redirects);
if(!req->isValid())//failed
{
if (responder)
@@ -330,7 +331,8 @@ void LLHTTPClient::getByteRange(
S32 bytes,
ResponderPtr responder,
const LLSD& hdrs,
- const F32 timeout)
+ const F32 timeout,
+ bool follow_redirects /* = true */)
{
LLSD headers = hdrs;
if(offset > 0 || bytes > 0)
@@ -338,37 +340,42 @@ void LLHTTPClient::getByteRange(
std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1);
headers[HTTP_OUT_HEADER_RANGE] = range;
}
- request(url,HTTP_GET, NULL, responder, timeout, headers);
+ request(url,HTTP_GET, NULL, responder, timeout, headers, follow_redirects);
}
void LLHTTPClient::head(
const std::string& url,
ResponderPtr responder,
const LLSD& headers,
- const F32 timeout)
+ const F32 timeout,
+ bool follow_redirects /* = true */)
{
- request(url, HTTP_HEAD, NULL, responder, timeout, headers);
+ request(url, HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);
}
-void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
+void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout,
+ bool follow_redirects /* = true */)
{
- request(url, HTTP_GET, NULL, responder, timeout, headers);
+ request(url, HTTP_GET, NULL, responder, timeout, headers, follow_redirects);
}
-void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
+void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers,
+ const F32 timeout, bool follow_redirects /* = true */)
{
- request(url, HTTP_HEAD, NULL, responder, timeout, headers);
+ request(url, HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);
}
-void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout)
+void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout,
+ bool follow_redirects /* = true */)
{
- getHeaderOnly(url, responder, LLSD(), timeout);
+ getHeaderOnly(url, responder, LLSD(), timeout, follow_redirects);
}
-void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, const F32 timeout)
+void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers,
+ const F32 timeout, bool follow_redirects /* = true */)
{
LLURI uri;
uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query);
- get(uri.asString(), responder, headers, timeout);
+ get(uri.asString(), responder, headers, timeout, follow_redirects);
}
// A simple class for managing data returned from a curl http request.
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index 5ace2d74c9..b18258fd7b 100755
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -63,10 +63,15 @@ public:
const std::string& url,
ResponderPtr,
const LLSD& headers = LLSD(),
- const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
- static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
- static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
- static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS,
+ bool follow_redirects = true);
+ static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr,
+ const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS,
+ bool follow_redirects = true);
+ static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(),
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, bool follow_redirects = true);
+ static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(),
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, bool follow_redirects = true);
static void put(
const std::string& url,
@@ -82,8 +87,10 @@ public:
const LLSD& headers = LLSD(),
const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
- static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
- static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+ static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS,
+ bool follow_redirects = true);
+ static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers,
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, bool follow_redirects = true);
static void post(
const std::string& url,
diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h
index db4a38ea9e..f7118f8ccf 100755
--- a/indra/llmessage/llinstantmessage.h
+++ b/indra/llmessage/llinstantmessage.h
@@ -126,7 +126,7 @@ enum EInstantMessage
IM_LURE_ACCEPTED = 23,
IM_LURE_DECLINED = 24,
IM_GODLIKE_LURE_USER = 25,
- IM_YET_TO_BE_USED = 26,
+ IM_TELEPORT_REQUEST = 26,
// IM that notifie of a new group election.
// Name is name of person who called vote.
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index d6448e83fe..ae4c40cdb0 100755
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -131,16 +131,19 @@ CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
*/
-LLURLRequest::LLURLRequest(EHTTPMethod action) :
- mAction(action)
+LLURLRequest::LLURLRequest(EHTTPMethod action, bool follow_redirects /* = true */) :
+ mAction(action),
+ mFollowRedirects(follow_redirects)
{
initialize();
}
LLURLRequest::LLURLRequest(
EHTTPMethod action,
- const std::string& url) :
- mAction(action)
+ const std::string& url,
+ bool follow_redirects /* = true */) :
+ mAction(action),
+ mFollowRedirects(follow_redirects)
{
initialize();
setURL(url);
@@ -465,12 +468,18 @@ bool LLURLRequest::configure()
case HTTP_HEAD:
mDetail->mCurlRequest->setopt(CURLOPT_HEADER, 1);
mDetail->mCurlRequest->setopt(CURLOPT_NOBODY, 1);
- mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1);
+ if (mFollowRedirects)
+ {
+ mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1);
+ }
rv = true;
break;
case HTTP_GET:
mDetail->mCurlRequest->setopt(CURLOPT_HTTPGET, 1);
- mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1);
+ if (mFollowRedirects)
+ {
+ mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1);
+ }
// Set Accept-Encoding to allow response compression
mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, "");
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index f3d32f5419..88fccd4bf6 100755
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -76,7 +76,7 @@ public:
*
* @param action One of the EHTTPMethod enumerations.
*/
- LLURLRequest(EHTTPMethod action);
+ LLURLRequest(EHTTPMethod action, bool follow_redirects = true);
/**
* @brief Constructor.
@@ -84,7 +84,7 @@ public:
* @param action One of the EHTTPMethod enumerations.
* @param url The url of the request. It should already be encoded.
*/
- LLURLRequest(EHTTPMethod action, const std::string& url);
+ LLURLRequest(EHTTPMethod action, const std::string& url, bool follow_redirects = true);
/**
* @brief Destructor.
@@ -200,10 +200,11 @@ protected:
};
EState mState;
EHTTPMethod mAction;
+ bool mFollowRedirects;
LLURLRequestDetail* mDetail;
LLIOPipe::ptr_t mCompletionCallback;
- S32 mRequestTransferedBytes;
- S32 mResponseTransferedBytes;
+ S32 mRequestTransferedBytes;
+ S32 mResponseTransferedBytes;
static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
diff --git a/indra/llmessage/tests/llhttpclientadapter_test.cpp b/indra/llmessage/tests/llhttpclientadapter_test.cpp
index cc7feeab4f..e9ce116bb3 100755
--- a/indra/llmessage/tests/llhttpclientadapter_test.cpp
+++ b/indra/llmessage/tests/llhttpclientadapter_test.cpp
@@ -34,7 +34,7 @@ float const HTTP_REQUEST_EXPIRY_SECS = 1.0F;
std::vector<std::string> get_urls;
std::vector< LLCurl::ResponderPtr > get_responders;
-void LLHTTPClient::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers, const F32 timeout)
+void LLHTTPClient::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers, const F32 timeout, bool follow_redirects)
{
get_urls.push_back(url);
get_responders.push_back(responder);