summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-xindra/llmessage/llavatarnamecache.cpp9
-rwxr-xr-xindra/llmessage/llavatarnamecache.h2
-rwxr-xr-xindra/llmessage/llbuffer.cpp2
-rwxr-xr-xindra/llmessage/llcachename.cpp2
-rwxr-xr-xindra/llmessage/llcurl.cpp3
-rwxr-xr-xindra/llmessage/llhttpclient.cpp35
-rwxr-xr-xindra/llmessage/llhttpclient.h19
-rwxr-xr-xindra/llmessage/llhttpnode.cpp4
-rwxr-xr-xindra/llmessage/llhttpsender.cpp3
-rwxr-xr-xindra/llmessage/llhttpsender.h2
-rwxr-xr-xindra/llmessage/llinstantmessage.h2
-rwxr-xr-xindra/llmessage/llmessagetemplate.h1
-rwxr-xr-xindra/llmessage/lltemplatemessagereader.cpp6
-rwxr-xr-xindra/llmessage/llurlrequest.cpp21
-rwxr-xr-xindra/llmessage/llurlrequest.h9
-rwxr-xr-xindra/llmessage/message.cpp19
16 files changed, 95 insertions, 44 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 9a68093427..31dd264021 100755
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -680,6 +680,15 @@ void LLAvatarNameCache::setUseDisplayNames(bool use)
}
}
+void LLAvatarNameCache::setUseUsernames(bool use)
+{
+ if (use != LLAvatarName::useUsernames())
+ {
+ LLAvatarName::setUseUsernames(use);
+ mUseDisplayNamesSignal();
+ }
+}
+
void LLAvatarNameCache::erase(const LLUUID& agent_id)
{
sCache.erase(agent_id);
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 2a8eb46187..3a19cee3ed 100755
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -80,6 +80,8 @@ namespace LLAvatarNameCache
// Set display name: flips the switch and triggers the callbacks.
void setUseDisplayNames(bool use);
+ void setUseUsernames(bool use);
+
void insert(const LLUUID& agent_id, const LLAvatarName& av_name);
void erase(const LLUUID& agent_id);
diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp
index 01da20f060..aaa49d2ed6 100755
--- a/indra/llmessage/llbuffer.cpp
+++ b/indra/llmessage/llbuffer.cpp
@@ -225,7 +225,7 @@ LLBufferArray::LLBufferArray() :
LLBufferArray::~LLBufferArray()
{
std::for_each(mBuffers.begin(), mBuffers.end(), DeletePointer());
-
+ mBuffers.clear();
delete mMutexp;
}
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 267c48e1d2..13d779ff83 100755
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -278,7 +278,9 @@ LLCacheName::Impl::Impl(LLMessageSystem* msg)
LLCacheName::Impl::~Impl()
{
for_each(mCache.begin(), mCache.end(), DeletePairedPointer());
+ mCache.clear();
for_each(mReplyQueue.begin(), mReplyQueue.end(), DeletePointer());
+ mReplyQueue.clear();
}
boost::signals2::connection LLCacheName::Impl::addPending(const LLUUID& id, const LLCacheNameCallback& callback)
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index efbc804cbc..9e68c68858 100755
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -296,7 +296,7 @@ LLCurl::Easy* LLCurl::Easy::getEasy()
// Enable a brief cache period for now. This was zero for the longest time
// which caused some routers grief and generated unneeded traffic. For the
- // threded resolver, we're using system resolution libraries and non-zero values
+ // threaded resolver, we're using system resolution libraries and non-zero values
// are preferred. The c-ares resolver is another matter and it might not
// track server changes as well.
CURLcode result = curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 15);
@@ -1741,6 +1741,7 @@ void LLCurl::cleanupClass()
#if SAFE_SSL
CRYPTO_set_locking_callback(NULL);
for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer());
+ sSSLMutex.clear();
#endif
LL_CHECK_MEMORY
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 6110b035dc..11648717ad 100755
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -217,7 +217,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())
@@ -231,7 +232,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)
@@ -334,7 +335,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)
@@ -342,37 +344,42 @@ void LLHTTPClient::getByteRange(
std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1);
headers["Range"] = range;
}
- request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers);
+ request(url,LLURLRequest::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, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers);
+ request(url, LLURLRequest::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, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers);
+ request(url, LLURLRequest::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, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers);
+ request(url, LLURLRequest::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 a7236ba169..5de257a4f6 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,
@@ -74,8 +79,10 @@ public:
ResponderPtr,
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/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index 5c2f73eccb..f6ccb5bdda 100755
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -76,8 +76,8 @@ LLHTTPNode::LLHTTPNode()
// virtual
LLHTTPNode::~LLHTTPNode()
{
- std::for_each(impl.mNamedChildren.begin(), impl.mNamedChildren.end(),
- DeletePairedPointer());
+ std::for_each(impl.mNamedChildren.begin(), impl.mNamedChildren.end(), DeletePairedPointer());
+ impl.mNamedChildren.clear();
delete impl.mWildcardChild;
diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp
index c48cbc42a6..d0bd343db6 100755
--- a/indra/llmessage/llhttpsender.cpp
+++ b/indra/llmessage/llhttpsender.cpp
@@ -38,7 +38,7 @@ namespace
{
typedef std::map<LLHost, LLHTTPSender*> SenderMap;
static SenderMap senderMap;
- static LLHTTPSender* defaultSender = new LLHTTPSender();
+ static LLPointer<LLHTTPSender> defaultSender(new LLHTTPSender());
}
//virtual
@@ -90,6 +90,5 @@ void LLHTTPSender::clearSender(const LLHost& host)
//static
void LLHTTPSender::setDefaultSender(LLHTTPSender* sender)
{
- delete defaultSender;
defaultSender = sender;
}
diff --git a/indra/llmessage/llhttpsender.h b/indra/llmessage/llhttpsender.h
index 88920db24d..ff8fa2f95b 100755
--- a/indra/llmessage/llhttpsender.h
+++ b/indra/llmessage/llhttpsender.h
@@ -32,7 +32,7 @@
class LLHost;
class LLSD;
-class LLHTTPSender
+class LLHTTPSender : public LLThreadSafeRefCount
{
public:
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/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h
index ae8e0087c1..005a49cedf 100755
--- a/indra/llmessage/llmessagetemplate.h
+++ b/indra/llmessage/llmessagetemplate.h
@@ -118,6 +118,7 @@ public:
~LLMsgData()
{
for_each(mMemberBlocks.begin(), mMemberBlocks.end(), DeletePairedPointer());
+ mMemberBlocks.clear();
}
void addBlock(LLMsgBlkData *blockp)
diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp
index ab91f74abe..94bc7cb045 100755
--- a/indra/llmessage/lltemplatemessagereader.cpp
+++ b/indra/llmessage/lltemplatemessagereader.cpp
@@ -91,15 +91,17 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
}
LLMsgBlkData *msg_block_data = iter->second;
- LLMsgVarData& vardata = msg_block_data->mMemberVarData[vnamep];
+ LLMsgBlkData::msg_var_data_map_t &var_data_map = msg_block_data->mMemberVarData;
- if (!vardata.getName())
+ if (var_data_map.find(vnamep) == var_data_map.end())
{
llerrs << "Variable "<< vnamep << " not in message "
<< mCurrentRMessageData->mName<< " block " << bnamep << llendl;
return;
}
+ LLMsgVarData& vardata = msg_block_data->mMemberVarData[vnamep];
+
if (size && size != vardata.getSize())
{
llerrs << "Msg " << mCurrentRMessageData->mName
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index de9e2fe294..683065357d 100755
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -150,16 +150,19 @@ std::string LLURLRequest::actionAsVerb(LLURLRequest::ERequestAction action)
return VERBS[action];
}
-LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action) :
- mAction(action)
+LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, bool follow_redirects /* = true */) :
+ mAction(action),
+ mFollowRedirects(follow_redirects)
{
initialize();
}
LLURLRequest::LLURLRequest(
LLURLRequest::ERequestAction action,
- const std::string& url) :
- mAction(action)
+ const std::string& url,
+ bool follow_redirects /* = true */) :
+ mAction(action),
+ mFollowRedirects(follow_redirects)
{
initialize();
setURL(url);
@@ -479,12 +482,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 44d358d906..20d6e30d17 100755
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -95,7 +95,7 @@ public:
*
* @param action One of the ERequestAction enumerations.
*/
- LLURLRequest(ERequestAction action);
+ LLURLRequest(ERequestAction action, bool follow_redirects = true);
/**
* @brief Constructor.
@@ -103,7 +103,7 @@ public:
* @param action One of the ERequestAction enumerations.
* @param url The url of the request. It should already be encoded.
*/
- LLURLRequest(ERequestAction action, const std::string& url);
+ LLURLRequest(ERequestAction action, const std::string& url, bool follow_redirects = true);
/**
* @brief Destructor.
@@ -219,10 +219,11 @@ protected:
};
EState mState;
ERequestAction 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/message.cpp b/indra/llmessage/message.cpp
index ae95087377..c3642ccbe8 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -3032,12 +3032,23 @@ void LLMessageSystem::setExceptionFunc(EMessageException e,
BOOL LLMessageSystem::callExceptionFunc(EMessageException exception)
{
callbacks_t::iterator it = mExceptionCallbacks.find(exception);
- if(it != mExceptionCallbacks.end())
+ if(it == mExceptionCallbacks.end())
{
- ((*it).second.first)(this, (*it).second.second,exception);
- return TRUE;
+ return FALSE;
}
- return FALSE;
+
+ exception_t& ex = it->second;
+ msg_exception_callback ex_cb = ex.first;
+
+ if (!ex_cb)
+ {
+ LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << llendl;
+ return FALSE;
+ }
+
+ (ex_cb)(this, ex.second, exception);
+
+ return TRUE;
}
void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data)