summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-12-04 13:58:12 +0800
committerErik Kundiman <erik@megapahit.org>2025-12-04 16:48:50 +0800
commite3a35af2c676fb211ff7d01a79eb1a3299bc82f3 (patch)
tree0ff7a0a15d1a53850399250b65f0a2a42f7bbf22 /indra/llmessage
parentac052bed7f9f97efc63f0a0322214d4dcdcd5664 (diff)
parentc4ec3d866082d588de671e833413474d7ab19524 (diff)
Merge remote-tracking branch 'secondlife/release/2026.01' into 2026.01
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/CMakeLists.txt4
-rw-r--r--indra/llmessage/llavatarnamecache.cpp6
-rw-r--r--indra/llmessage/llavatarnamecache.h2
-rw-r--r--indra/llmessage/llblowfishcipher.cpp129
-rw-r--r--indra/llmessage/llblowfishcipher.h57
-rw-r--r--indra/llmessage/llcachename.cpp3
-rw-r--r--indra/llmessage/llcircuit.cpp4
-rw-r--r--indra/llmessage/llcoproceduremanager.cpp14
-rw-r--r--indra/llmessage/llcoproceduremanager.h6
-rw-r--r--indra/llmessage/llcorehttputil.cpp68
-rw-r--r--indra/llmessage/llcorehttputil.h116
-rw-r--r--indra/llmessage/llexperiencecache.cpp43
-rw-r--r--indra/llmessage/llexperiencecache.h8
-rw-r--r--indra/llmessage/llmail.cpp395
-rw-r--r--indra/llmessage/llmail.h130
-rw-r--r--indra/llmessage/lltransfertargetfile.h4
-rw-r--r--indra/llmessage/lltransfertargetvfile.cpp4
-rw-r--r--indra/llmessage/message.cpp18
-rw-r--r--indra/llmessage/message.h4
-rw-r--r--indra/llmessage/tests/llareslistener_test.cpp193
-rw-r--r--indra/llmessage/tests/llcoproceduremanager_test.cpp2
21 files changed, 155 insertions, 1055 deletions
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index f661e2c348..61c54d6313 100644
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -17,7 +17,6 @@ set(llmessage_SOURCE_FILES
llassetstorage.cpp
llavatarname.cpp
llavatarnamecache.cpp
- llblowfishcipher.cpp
llbuffer.cpp
llbufferstream.cpp
llcachename.cpp
@@ -39,7 +38,6 @@ set(llmessage_SOURCE_FILES
lliopipe.cpp
lliosocket.cpp
llioutil.cpp
- llmail.cpp
llmessagebuilder.cpp
llmessageconfig.cpp
llmessagereader.cpp
@@ -96,7 +94,6 @@ set(llmessage_HEADER_FILES
llassetstorage.h
llavatarname.h
llavatarnamecache.h
- llblowfishcipher.h
llbuffer.h
llbufferstream.h
llcachename.h
@@ -126,7 +123,6 @@ set(llmessage_HEADER_FILES
lliosocket.h
llioutil.h
llloginflags.h
- llmail.h
llmessagebuilder.h
llmessageconfig.h
llmessagereader.h
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 9b4454a847..ebafc53a4d 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -117,9 +117,9 @@ LLAvatarNameCache::LLAvatarNameCache()
mUsePeopleAPI = true;
- sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
- sHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
- sHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
+ sHttpRequest = std::make_shared<LLCore::HttpRequest>();
+ sHttpHeaders = std::make_shared<LLCore::HttpHeaders>();
+ sHttpOptions = std::make_shared<LLCore::HttpOptions>();
sHttpPolicy = LLCore::HttpRequest::DEFAULT_POLICY_ID;
}
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index fe51355207..0ddaee2aa1 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -42,7 +42,7 @@ class LLAvatarNameCache : public LLSingleton<LLAvatarNameCache>
~LLAvatarNameCache();
public:
typedef boost::signals2::signal<void (void)> use_display_name_signal_t;
- typedef boost::function<void (const LLUUID id, const LLAvatarName& av_name)> account_name_changed_callback_t;
+ typedef std::function<void (const LLUUID id, const LLAvatarName& av_name)> account_name_changed_callback_t;
// Import/export the name cache to file.
bool importFile(std::istream& istr);
diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp
deleted file mode 100644
index 3973565e22..0000000000
--- a/indra/llmessage/llblowfishcipher.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * @file llblowfishcipher.cpp
- * @brief Wrapper around OpenSSL Blowfish encryption algorithm.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-#include "llblowfishcipher.h"
-#include <openssl/evp.h>
-
-
-LLBlowfishCipher::LLBlowfishCipher(const U8* secret, size_t secret_size)
-: LLCipher()
-{
- llassert(secret);
-
- mSecretSize = secret_size;
- mSecret = new U8[mSecretSize];
- memcpy(mSecret, secret, mSecretSize);
-}
-
-LLBlowfishCipher::~LLBlowfishCipher()
-{
- delete [] mSecret;
- mSecret = NULL;
-}
-
-// virtual
-U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
-{
- if (!src || !src_len || !dst || !dst_len) return 0;
- if (src_len > dst_len) return 0;
-
- // OpenSSL uses "cipher contexts" to hold encryption parameters.
- EVP_CIPHER_CTX *context = EVP_CIPHER_CTX_new();
- if (!context)
- {
- LL_WARNS() << "LLBlowfishCipher::encrypt EVP_CIPHER_CTX initiation failure" << LL_ENDL;
- return 0;
- }
-
- // We want a blowfish cyclic block chain cipher, but need to set
- // the key length before we pass in a key, so call EncryptInit
- // first with NULLs.
- EVP_EncryptInit_ex(context, EVP_bf_cbc(), NULL, NULL, NULL);
- EVP_CIPHER_CTX_set_key_length(context, (int)mSecretSize);
-
- // Complete initialization. Per EVP_EncryptInit man page, the
- // cipher pointer must be NULL. Apparently initial_vector must
- // be 8 bytes for blowfish, as this is the block size.
- unsigned char initial_vector[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- EVP_EncryptInit_ex(context, NULL, NULL, mSecret, initial_vector);
-
- int blocksize = EVP_CIPHER_CTX_block_size(context);
- int keylen = EVP_CIPHER_CTX_key_length(context);
- int iv_length = EVP_CIPHER_CTX_iv_length(context);
- LL_DEBUGS() << "LLBlowfishCipher blocksize " << blocksize
- << " keylen " << keylen
- << " iv_len " << iv_length
- << LL_ENDL;
-
- int output_len = 0;
- int temp_len = 0;
- if (!EVP_EncryptUpdate(context,
- dst,
- &output_len,
- src,
- src_len))
- {
- LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << LL_ENDL;
- goto BF_ENCRYPT_ERROR;
- }
-
- // There may be some final data left to encrypt if the input is
- // not an exact multiple of the block size.
- if (!EVP_EncryptFinal_ex(context, (unsigned char*)(dst + output_len), &temp_len))
- {
- LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << LL_ENDL;
- goto BF_ENCRYPT_ERROR;
- }
- output_len += temp_len;
-
- EVP_CIPHER_CTX_free(context);
- return output_len;
-
-BF_ENCRYPT_ERROR:
- EVP_CIPHER_CTX_free(context);
- return 0;
-}
-
-// virtual
-U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
-{
- LL_ERRS() << "LLBlowfishCipher decrypt unsupported" << LL_ENDL;
- return 0;
-}
-
-// virtual
-U32 LLBlowfishCipher::requiredEncryptionSpace(U32 len) const
-{
- // *HACK: We know blowfish uses an 8 byte block size.
- // Oddly, sometimes EVP_Encrypt produces an extra block
- // if the input is an exact multiple of the block size.
- // So round up.
- const U32 BLOCK_SIZE = 8;
- len += BLOCK_SIZE;
- len -= (len % BLOCK_SIZE);
- return len;
-}
diff --git a/indra/llmessage/llblowfishcipher.h b/indra/llmessage/llblowfishcipher.h
deleted file mode 100644
index 53dc94cce9..0000000000
--- a/indra/llmessage/llblowfishcipher.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @file llblowfishcipher.h
- * @brief A symmetric block cipher, designed in 1993 by Bruce Schneier.
- * We use it because it has an 8 byte block size, allowing encryption of
- * two UUIDs and a timestamp (16x2 + 4 = 36 bytes) with only 40 bytes of
- * output. AES has a block size of 32 bytes, so this would require 64 bytes.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LLBLOWFISHCIPHER_H
-#define LLBLOWFISHCIPHER_H
-
-#include "llcipher.h"
-
-
-class LLBlowfishCipher : public LLCipher
-{
-public:
- // Secret may be up to 56 bytes in length per Blowfish spec.
- LLBlowfishCipher(const U8* secret, size_t secret_size);
- virtual ~LLBlowfishCipher();
-
- // See llcipher.h for documentation.
- /*virtual*/ U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len);
- /*virtual*/ U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len);
- /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const;
-
-#ifdef _DEBUG
- static bool testHarness();
-#endif
-
-private:
- U8* mSecret;
- size_t mSecretSize;
-};
-
-#endif // LL_LLCRYPTO_H
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 64f660d0ce..56dfaef873 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -600,7 +600,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name)
// This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer.
// The reason it is a slot is so that the legacy get() function below can bind an old callback
-// and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior
+// and pass it as a slot. The reason it isn't a std::function is so that trackable behavior
// doesn't get lost. As a result, we have to bind the slot to a signal to call it, even when
// we call it immediately. -Steve
// NOTE: Even though passing first and last name is a bit of extra overhead, it eliminates the
@@ -780,6 +780,7 @@ void LLCacheName::Impl::processPendingAsks()
void LLCacheName::Impl::processPendingReplies()
{
// First call all the callbacks, because they might send messages.
+ // Todo: needs cleanup logic, otherwise invalid ids might stay here indefinitely
for(ReplyQueue::iterator it = mReplyQueue.begin(); it != mReplyQueue.end(); ++it)
{
PendingReply* reply = *it;
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 8f9c02bdca..c2b1a2f069 100644
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -71,8 +71,8 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
mPacketsOutID(0),
mPacketsInID(in_id),
mHighestPacketID(in_id),
- mTimeoutCallback(NULL),
- mTimeoutUserData(NULL),
+ mTimeoutCallback(nullptr),
+ mTimeoutUserData(nullptr),
mTrusted(false),
mbAllowTimeout(true),
mbAlive(true),
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp
index 5c7b1c4235..0e5725baf3 100644
--- a/indra/llmessage/llcoproceduremanager.cpp
+++ b/indra/llmessage/llcoproceduremanager.cpp
@@ -53,7 +53,7 @@ static const U32 DEFAULT_POOL_SIZE = 5;
const U32 LLCoprocedureManager::DEFAULT_QUEUE_SIZE = 1024*512;
//=========================================================================
-class LLCoprocedurePool: private boost::noncopyable
+class LLCoprocedurePool
{
public:
typedef LLCoprocedureManager::CoProcedure_t CoProcedure_t;
@@ -61,6 +61,10 @@ public:
LLCoprocedurePool(const std::string &name, size_t size, size_t queue_size);
~LLCoprocedurePool();
+ // Non-copyable
+ LLCoprocedurePool(const LLCoprocedurePool&) = delete;
+ LLCoprocedurePool& operator=(const LLCoprocedurePool&) = delete;
+
/// Places the coprocedure on the queue for processing.
///
/// @param name Is used for debugging and should identify this coroutine.
@@ -151,8 +155,8 @@ LLCoprocedureManager::~LLCoprocedureManager()
// Shutting down, just log it
LL_WARNS() << "Exception during ~LLCoprocedureManager(): " << e.what() << LL_ENDL;
}
- mPropertyQueryFn.clear();
- mPropertyDefineFn.clear();
+ mPropertyQueryFn = nullptr;
+ mPropertyDefineFn = nullptr;
mPoolMap.clear();
}
@@ -195,7 +199,7 @@ void LLCoprocedureManager::initializePool(const std::string &poolName, size_t qu
LL_WARNS("CoProcMgr") << "LLCoprocedureManager: No setting for \"" << keyName << "\" setting pool size to default of " << size << LL_ENDL;
}
- poolPtr_t pool(new LLCoprocedurePool(poolName, size, queue_size));
+ poolPtr_t pool = std::make_shared<LLCoprocedurePool>(poolName, size, queue_size);
LL_ERRS_IF(!pool, "CoprocedureManager") << "Unable to create pool named \"" << poolName << "\" FATAL!" << LL_ENDL;
bool inserted = mPoolMap.emplace(poolName, pool).second;
@@ -365,7 +369,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size, s
for (size_t count = 0; count < mPoolSize; ++count)
{
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter( mPoolName + "Adapter", mHTTPPolicy));
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>(mPoolName + "Adapter", mHTTPPolicy);
std::string pooledCoro = LLCoros::instance().launch(
"LLCoprocedurePool("+mPoolName+")::coprocedureInvokerCoro",
diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h
index 485333657c..f6f9a5783b 100644
--- a/indra/llmessage/llcoproceduremanager.h
+++ b/indra/llmessage/llcoproceduremanager.h
@@ -41,10 +41,10 @@ class LLCoprocedureManager : public LLSingleton < LLCoprocedureManager >
virtual ~LLCoprocedureManager();
public:
- typedef boost::function<U32(const std::string &)> SettingQuery_t;
- typedef boost::function<void(const std::string &, U32, const std::string &)> SettingUpdate_t;
+ typedef std::function<U32(const std::string &)> SettingQuery_t;
+ typedef std::function<void(const std::string &, U32, const std::string &)> SettingUpdate_t;
- typedef boost::function<void(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, const LLUUID &id)> CoProcedure_t;
+ typedef std::function<void(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, const LLUUID &id)> CoProcedure_t;
/// Places the coprocedure on the queue for processing.
///
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index 992e145758..b24e5e4fcc 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -57,7 +57,7 @@ namespace
inline bool getBoolSetting(const std::string &keyname)
{
- if (!mBoolSettingGet || mBoolSettingGet.empty())
+ if (mBoolSettingGet == nullptr)
return(false);
return mBoolSettingGet(HTTP_LOGBODY_KEY);
}
@@ -69,7 +69,7 @@ void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn
mBoolSettingGet = queryfn;
mBoolSettingPut = updatefn;
- if (mBoolSettingPut && !mBoolSettingPut.empty())
+ if (mBoolSettingPut != nullptr)
{
mBoolSettingPut(HTTP_LOGBODY_KEY, false, "Log the entire HTTP body in the case of an HTTP error.");
}
@@ -666,9 +666,9 @@ const std::string HttpCoroutineAdapter::HTTP_RESULTS_HEADERS("headers");
const std::string HttpCoroutineAdapter::HTTP_RESULTS_CONTENT("content");
const std::string HttpCoroutineAdapter::HTTP_RESULTS_RAW("raw");
-HttpCoroutineAdapter::HttpCoroutineAdapter(const std::string &name,
+HttpCoroutineAdapter::HttpCoroutineAdapter(std::string name,
LLCore::HttpRequest::policy_t policyId) :
- mAdapterName(name),
+ mAdapterName(std::move(name)),
mPolicyId(policyId),
mYieldingHandle(LLCORE_HTTP_HANDLE_INVALID),
mWeakRequest(),
@@ -686,7 +686,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName, true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
return postAndSuspend_(request, url, body, options, headers, httpHandler);
}
@@ -723,7 +723,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName, true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
return postAndSuspend_(request, url, rawbody, options, headers, httpHandler);
}
@@ -733,7 +733,7 @@ LLSD HttpCoroutineAdapter::postRawAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName, true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroRawHandler>(replyPump);
return postAndSuspend_(request, url, rawbody, options, headers, httpHandler);
}
@@ -797,7 +797,7 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName, true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump);
LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray);
@@ -846,7 +846,7 @@ LLSD HttpCoroutineAdapter::putAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
return putAndSuspend_(request, url, body, options, headers, httpHandler);
}
@@ -856,7 +856,7 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName, true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump);
LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray);
@@ -931,7 +931,7 @@ LLSD HttpCoroutineAdapter::getAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
return getAndSuspend_(request, url, options, headers, httpHandler);
}
@@ -941,7 +941,7 @@ LLSD HttpCoroutineAdapter::getRawAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroRawHandler>(replyPump);
return getAndSuspend_(request, url, options, headers, httpHandler);
}
@@ -950,7 +950,7 @@ LLSD HttpCoroutineAdapter::getJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump);
return getAndSuspend_(request, url, options, headers, httpHandler);
}
@@ -987,7 +987,7 @@ LLSD HttpCoroutineAdapter::deleteAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
return deleteAndSuspend_(request, url, options, headers, httpHandler);
}
@@ -997,7 +997,7 @@ LLSD HttpCoroutineAdapter::deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t reque
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump);
return deleteAndSuspend_(request, url, options, headers, httpHandler);
}
@@ -1032,7 +1032,7 @@ LLSD HttpCoroutineAdapter::patchAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
return patchAndSuspend_(request, url, body, options, headers, httpHandler);
}
@@ -1070,10 +1070,10 @@ LLSD HttpCoroutineAdapter::copyAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
if (!headers)
- headers.reset(new LLCore::HttpHeaders);
+ headers = std::make_shared<LLCore::HttpHeaders>();
headers->append(HTTP_OUT_HEADER_DESTINATION, dest);
return copyAndSuspend_(request, url, options, headers, httpHandler);
@@ -1112,10 +1112,10 @@ LLSD HttpCoroutineAdapter::moveAndSuspend(LLCore::HttpRequest::ptr_t request,
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
{
LLEventStream replyPump(mAdapterName + "Reply", true);
- HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump));
+ HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump);
if (!headers)
- headers.reset(new LLCore::HttpHeaders);
+ headers = std::make_shared<LLCore::HttpHeaders>();
headers->append(HTTP_OUT_HEADER_DESTINATION, dest);
return moveAndSuspend_(request, url, options, headers, httpHandler);
@@ -1153,7 +1153,7 @@ LLSD HttpCoroutineAdapter::moveAndSuspend_(LLCore::HttpRequest::ptr_t &request,
void HttpCoroutineAdapter::checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers)
{
if (!headers)
- headers.reset(new LLCore::HttpHeaders);
+ headers = std::make_shared<LLCore::HttpHeaders>();
if (!headers->find(HTTP_OUT_HEADER_ACCEPT))
{
headers->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML);
@@ -1236,9 +1236,9 @@ void HttpCoroutineAdapter::callbackHttpGet(const std::string &url, LLCore::HttpR
/*static*/
void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::string &success, const std::string &failure)
{
- completionCallback_t cbSuccess = (success.empty()) ? NULL :
+ completionCallback_t cbSuccess = (success.empty()) ? nullptr :
static_cast<completionCallback_t>(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success));
- completionCallback_t cbFailure = (failure.empty()) ? NULL :
+ completionCallback_t cbFailure = (failure.empty()) ? nullptr :
static_cast<completionCallback_t>(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure));
callbackHttpGet(url, cbSuccess, cbFailure);
}
@@ -1247,9 +1247,9 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str
void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure)
{
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericGetCoro", policyId));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
+ httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericGetCoro", policyId);
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
+ LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>();
httpOpts->setWantHeaders(true);
@@ -1286,9 +1286,9 @@ void HttpCoroutineAdapter::callbackHttpPost(const std::string &url, LLCore::Http
/*static*/
void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &postData, const std::string &success, const std::string &failure)
{
- completionCallback_t cbSuccess = (success.empty()) ? NULL :
+ completionCallback_t cbSuccess = (success.empty()) ? nullptr :
static_cast<completionCallback_t>(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success));
- completionCallback_t cbFailure = (failure.empty()) ? NULL :
+ completionCallback_t cbFailure = (failure.empty()) ? nullptr :
static_cast<completionCallback_t>(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure));
callbackHttpPost(url, postData, cbSuccess, cbFailure);
@@ -1298,9 +1298,9 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p
void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure)
{
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", policyId));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
+ httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericPostCoro", policyId);
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
+ LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>();
httpOpts->setWantHeaders(true);
@@ -1342,9 +1342,9 @@ void HttpCoroutineAdapter::callbackHttpDel(const std::string &url, LLCore::HttpR
void HttpCoroutineAdapter::trivialDelCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success,
completionCallback_t failure)
{
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericDelCoro", policyId));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericDelCoro", policyId);
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
+ LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>();
httpOpts->setWantHeaders(true);
diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h
index 45b673b9d5..3dbfd6f00d 100644
--- a/indra/llmessage/llcorehttputil.h
+++ b/indra/llmessage/llcorehttputil.h
@@ -58,8 +58,8 @@
namespace LLCoreHttpUtil
{
/// Allow access to to the property settings methods.
-typedef boost::function<bool(const std::string &)> BoolSettingQuery_t;
-typedef boost::function<void(const std::string &, bool, const std::string &)> BoolSettingUpdate_t;
+typedef std::function<bool(const std::string &)> BoolSettingQuery_t;
+typedef std::function<void(const std::string &, bool, const std::string &)> BoolSettingUpdate_t;
void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn);
@@ -320,7 +320,7 @@ public:
typedef std::shared_ptr<HttpCoroutineAdapter> ptr_t;
typedef std::weak_ptr<HttpCoroutineAdapter> wptr_t;
- HttpCoroutineAdapter(const std::string &name, LLCore::HttpRequest::policy_t policyId);
+ HttpCoroutineAdapter(std::string name, LLCore::HttpRequest::policy_t policyId);
~HttpCoroutineAdapter();
/// Execute a Post transaction on the supplied URL and yield execution of
@@ -330,19 +330,19 @@ public:
/// not be deallocated during the yield.
LLSD postAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const LLSD & body,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD postAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLCore::BufferArray::ptr_t rawbody,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD postAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, const LLSD & body,
LLCore::HttpHeaders::ptr_t &headers)
{
return postAndSuspend(request, url, body,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
LLSD postAndSuspend(LLCore::HttpRequest::ptr_t &request,
@@ -350,59 +350,59 @@ public:
LLCore::HttpHeaders::ptr_t &headers)
{
return postAndSuspend(request, url, rawbody,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
LLSD postRawAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLCore::BufferArray::ptr_t rawbody,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD postRawAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, LLCore::BufferArray::ptr_t &rawbody,
LLCore::HttpHeaders::ptr_t &headers)
{
return postRawAndSuspend(request, url, rawbody,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, std::string fileName,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, std::string fileName,
LLCore::HttpHeaders::ptr_t &headers)
{
return postFileAndSuspend(request, url, fileName,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLUUID assetId, LLAssetType::EType assetType,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLUUID assetId, LLAssetType::EType assetType,
LLCore::HttpHeaders::ptr_t &headers)
{
return postFileAndSuspend(request, url, assetId, assetType,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
LLSD postJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const LLSD & body,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD postJsonAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, const LLSD & body,
LLCore::HttpHeaders::ptr_t &headers)
{
return postJsonAndSuspend(request, url, body,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
@@ -414,27 +414,27 @@ public:
/// not be deallocated during the yield.
LLSD putAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const LLSD & body,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD putAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const LLSD & body,
LLCore::HttpHeaders::ptr_t headers)
{
return putAndSuspend(request, url, body,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
LLSD putJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const LLSD & body,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD putJsonAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, const LLSD & body,
LLCore::HttpHeaders::ptr_t &headers)
{
return putJsonAndSuspend(request, url, body,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
/// Execute a Get transaction on the supplied URL and yield execution of
@@ -445,25 +445,25 @@ public:
///
LLSD getAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD getAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, LLCore::HttpHeaders::ptr_t &headers)
{
return getAndSuspend(request, url,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
+ std::make_shared<LLCore::HttpOptions>(),
headers);
}
LLSD getRawAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD getRawAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, LLCore::HttpHeaders::ptr_t &headers)
{
return getRawAndSuspend(request, url,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
+ std::make_shared<LLCore::HttpOptions>(),
headers);
}
@@ -473,13 +473,13 @@ public:
/// before being returned to the caller.
LLSD getJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD getJsonAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, LLCore::HttpHeaders::ptr_t &headers)
{
return getJsonAndSuspend(request, url,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
+ std::make_shared<LLCore::HttpOptions>(),
headers);
}
@@ -491,13 +491,13 @@ public:
/// not be deallocated during the yield.
LLSD deleteAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD deleteAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLCore::HttpHeaders::ptr_t headers)
{
return deleteAndSuspend(request, url,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
+ std::make_shared<LLCore::HttpOptions>(),
headers);
}
@@ -507,13 +507,13 @@ public:
/// before being returned to the caller.
LLSD deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, LLCore::HttpHeaders::ptr_t headers)
{
return deleteJsonAndSuspend(request, url,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
+ std::make_shared<LLCore::HttpOptions>(),
headers);
}
@@ -525,14 +525,14 @@ public:
/// not be deallocated during the yield.
LLSD patchAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const LLSD & body,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD patchAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, const LLSD & body,
LLCore::HttpHeaders::ptr_t &headers)
{
return patchAndSuspend(request, url, body,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
/// Execute a COPY transaction on the supplied URL and yield execution of
@@ -545,14 +545,14 @@ public:
/// not be deallocated during the yield.
LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const std::string dest,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, const std::string & dest,
LLCore::HttpHeaders::ptr_t &headers)
{
return copyAndSuspend(request, url, dest,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
/// Execute a MOVE transaction on the supplied URL and yield execution of
@@ -565,14 +565,14 @@ public:
/// not be deallocated during the yield.
LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t request,
const std::string & url, const std::string dest,
- LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()),
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()));
+ LLCore::HttpOptions::ptr_t options = std::make_shared<LLCore::HttpOptions>(),
+ LLCore::HttpHeaders::ptr_t headers = std::make_shared<LLCore::HttpHeaders>());
LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t &request,
const std::string & url, const std::string & dest,
LLCore::HttpHeaders::ptr_t &headers)
{
return moveAndSuspend(request, url, dest,
- LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers);
+ std::make_shared<LLCore::HttpOptions>(), headers);
}
///
@@ -585,21 +585,21 @@ public:
/// should match this form.
/// @sa callbackHttpGet
/// @sa callbackHttpPost
- typedef boost::function<void(const LLSD &)> completionCallback_t;
+ typedef std::function<void(const LLSD &)> completionCallback_t;
- static void callbackHttpGet(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = NULL, completionCallback_t failure = NULL);
- static void callbackHttpGet(const std::string &url, completionCallback_t success = NULL, completionCallback_t failure = NULL)
+ static void callbackHttpGet(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = nullptr, completionCallback_t failure = nullptr);
+ static void callbackHttpGet(const std::string &url, completionCallback_t success = nullptr, completionCallback_t failure = nullptr)
{
callbackHttpGet(url, LLCore::HttpRequest::DEFAULT_POLICY_ID, success, failure);
}
- static void callbackHttpPost(const std::string &url, LLCore::HttpRequest::policy_t policyId, const LLSD &postData, completionCallback_t success = NULL, completionCallback_t failure = NULL);
- static void callbackHttpPost(const std::string &url, const LLSD &postData, completionCallback_t success = NULL, completionCallback_t failure = NULL)
+ static void callbackHttpPost(const std::string &url, LLCore::HttpRequest::policy_t policyId, const LLSD &postData, completionCallback_t success = nullptr, completionCallback_t failure = nullptr);
+ static void callbackHttpPost(const std::string &url, const LLSD &postData, completionCallback_t success = nullptr, completionCallback_t failure = nullptr)
{
callbackHttpPost(url, LLCore::HttpRequest::DEFAULT_POLICY_ID, postData, success, failure);
}
- static void callbackHttpDel(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = NULL,
- completionCallback_t failure = NULL);
+ static void callbackHttpDel(const std::string& url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = nullptr,
+ completionCallback_t failure = nullptr);
/// Generic Get and post routines for HTTP via coroutines.
/// These static methods do all required setup for the GET or POST operation.
diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp
index 78cca47456..149741b9f9 100644
--- a/indra/llmessage/llexperiencecache.cpp
+++ b/indra/llmessage/llexperiencecache.cpp
@@ -35,7 +35,6 @@
#include <set>
#include <map>
#include <boost/tokenizer.hpp>
-#include <boost/concept_check.hpp>
//=========================================================================
namespace LLExperienceCacheImpl
@@ -249,7 +248,7 @@ const LLExperienceCache::cache_t& LLExperienceCache::getCached()
void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string url, RequestQueue_t requests)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
//LL_INFOS("requestExperiencesCoro") << "url: " << url << LL_ENDL;
@@ -320,7 +319,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
void LLExperienceCache::requestExperiences()
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -527,7 +526,7 @@ void LLExperienceCache::get(const LLUUID& key, LLExperienceCache::ExperienceGetF
fetch(key);
- signal_ptr signal = signal_ptr(new callback_signal_t());
+ signal_ptr signal = std::make_shared<callback_signal_t>();
std::pair<signal_map_t::iterator, bool> result = mSignalMap.insert(signal_map_t::value_type(key, signal));
if (!result.second)
@@ -538,7 +537,7 @@ void LLExperienceCache::get(const LLUUID& key, LLExperienceCache::ExperienceGetF
//=========================================================================
void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const LLUUID& itemId, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -550,7 +549,7 @@ void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const
void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const LLUUID& itemId, std::string url, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -562,7 +561,7 @@ void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const
void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID objectId, LLUUID itemId, std::string url, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
if (url.empty())
{
@@ -600,8 +599,10 @@ void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCorout
failure["error"] = -1;
failure["message"] = "no experience";
}
- if (fn && !fn.empty())
+ if (fn != nullptr)
+ {
fn(failure);
+ }
return;
}
@@ -612,7 +613,7 @@ void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCorout
//-------------------------------------------------------------------------
void LLExperienceCache::findExperienceByName(const std::string text, int page, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -624,7 +625,7 @@ void LLExperienceCache::findExperienceByName(const std::string text, int page, E
void LLExperienceCache::findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string text, int page, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
std::ostringstream url;
@@ -655,7 +656,7 @@ void LLExperienceCache::findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAd
//-------------------------------------------------------------------------
void LLExperienceCache::getGroupExperiences(const LLUUID &groupId, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -667,7 +668,7 @@ void LLExperienceCache::getGroupExperiences(const LLUUID &groupId, ExperienceGet
void LLExperienceCache::getGroupExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID groupId, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
// search for experiences owned by the current group
std::string url = mCapability("GroupExperiences");
@@ -710,7 +711,7 @@ void LLExperienceCache::setRegionExperiences(CapabilityQuery_t regioncaps, const
void LLExperienceCache::regionExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter,
CapabilityQuery_t regioncaps, bool update, LLSD experiences, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
// search for experiences owned by the current group
std::string url = regioncaps("RegionExperiences");
@@ -743,7 +744,7 @@ void LLExperienceCache::regionExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapt
//-------------------------------------------------------------------------
void LLExperienceCache::getExperiencePermission(const LLUUID &experienceId, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -767,7 +768,7 @@ void LLExperienceCache::getExperiencePermission(const LLUUID &experienceId, Expe
void LLExperienceCache::setExperiencePermission(const LLUUID &experienceId, const std::string &permission, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -797,7 +798,7 @@ void LLExperienceCache::setExperiencePermission(const LLUUID &experienceId, cons
void LLExperienceCache::forgetExperiencePermission(const LLUUID &experienceId, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -822,7 +823,7 @@ void LLExperienceCache::forgetExperiencePermission(const LLUUID &experienceId, E
void LLExperienceCache::experiencePermissionCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, permissionInvoker_fn invokerfn, std::string url, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
// search for experiences owned by the current group
@@ -841,7 +842,7 @@ void LLExperienceCache::experiencePermissionCoro(LLCoreHttpUtil::HttpCoroutineAd
//-------------------------------------------------------------------------
void LLExperienceCache::getExperienceAdmin(const LLUUID &experienceId, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -853,7 +854,7 @@ void LLExperienceCache::getExperienceAdmin(const LLUUID &experienceId, Experienc
void LLExperienceCache::getExperienceAdminCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID experienceId, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
std::string url = mCapability("IsExperienceAdmin");
if (url.empty())
@@ -873,7 +874,7 @@ void LLExperienceCache::getExperienceAdminCoro(LLCoreHttpUtil::HttpCoroutineAdap
//-------------------------------------------------------------------------
void LLExperienceCache::updateExperience(LLSD updateData, ExperienceGetFn_t fn)
{
- if (mCapability.empty())
+ if (mCapability == nullptr)
{
LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL;
return;
@@ -885,7 +886,7 @@ void LLExperienceCache::updateExperience(LLSD updateData, ExperienceGetFn_t fn)
void LLExperienceCache::updateExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLSD updateData, ExperienceGetFn_t fn)
{
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
std::string url = mCapability("UpdateExperience");
if (url.empty())
diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h
index 81e904107f..4b344347d5 100644
--- a/indra/llmessage/llexperiencecache.h
+++ b/indra/llmessage/llexperiencecache.h
@@ -35,7 +35,7 @@
#include "llsd.h"
#include "llcorehttputil.h"
#include <boost/signals2.hpp>
-#include <boost/function.hpp>
+#include <functional>
class LLSD;
class LLUUID;
@@ -46,8 +46,8 @@ class LLExperienceCache: public LLSingleton < LLExperienceCache >
LLSINGLETON(LLExperienceCache);
public:
- typedef boost::function<std::string(const std::string &)> CapabilityQuery_t;
- typedef boost::function<void(const LLSD &)> ExperienceGetFn_t;
+ typedef std::function<std::string(const std::string &)> CapabilityQuery_t;
+ typedef std::function<void(const LLSD &)> ExperienceGetFn_t;
void setCapabilityQuery(CapabilityQuery_t queryfn);
void cleanup();
@@ -108,7 +108,7 @@ private:
virtual void initSingleton() override;
- typedef boost::function<LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, LLCore::HttpRequest::ptr_t, std::string)> permissionInvoker_fn;
+ typedef std::function<LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, LLCore::HttpRequest::ptr_t, std::string)> permissionInvoker_fn;
// Callback types for get()
typedef boost::signals2::signal < void(const LLSD &) > callback_signal_t;
diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp
deleted file mode 100644
index b842aeda62..0000000000
--- a/indra/llmessage/llmail.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/**
- * @file llmail.cpp
- * @brief smtp helper functions.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "llmail.h"
-
-#include "llwin32headers.h"
-#include <string>
-#include <sstream>
-
-#include "apr_pools.h"
-#include "apr_network_io.h"
-
-#include "llapr.h"
-#include "llbase32.h" // IM-to-email address
-#include "llblowfishcipher.h"
-#include "llerror.h"
-#include "llhost.h"
-#include "llsd.h"
-#include "llstring.h"
-#include "lluuid.h"
-#include "net.h"
-
-//
-// constants
-//
-const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
-
-static bool gMailEnabled = true;
-static apr_pool_t* gMailPool;
-static apr_sockaddr_t* gSockAddr;
-static apr_socket_t* gMailSocket;
-
-bool connect_smtp();
-void disconnect_smtp();
-
-//#if LL_WINDOWS
-//SOCKADDR_IN gMailDstAddr, gMailSrcAddr, gMailLclAddr;
-//#else
-//struct sockaddr_in gMailDstAddr, gMailSrcAddr, gMailLclAddr;
-//#endif
-
-// Define this for a super-spammy mail mode.
-//#define LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND 1
-
-bool connect_smtp()
-{
- // Prepare an soket to talk smtp
- apr_status_t status;
- status = apr_socket_create(
- &gMailSocket,
- gSockAddr->sa.sin.sin_family,
- SOCK_STREAM,
- APR_PROTO_TCP,
- gMailPool);
- if(ll_apr_warn_status(status)) return false;
- status = apr_socket_connect(gMailSocket, gSockAddr);
- if(ll_apr_warn_status(status))
- {
- status = apr_socket_close(gMailSocket);
- ll_apr_warn_status(status);
- return false;
- }
- return true;
-}
-
-void disconnect_smtp()
-{
- if(gMailSocket)
- {
- apr_status_t status = apr_socket_close(gMailSocket);
- ll_apr_warn_status(status);
- gMailSocket = NULL;
- }
-}
-
-// Returns true on success.
-// message should NOT be SMTP escaped.
-// static
-bool LLMail::send(
- const char* from_name,
- const char* from_address,
- const char* to_name,
- const char* to_address,
- const char* subject,
- const char* message,
- const LLSD& headers)
-{
- std::string header = buildSMTPTransaction(
- from_name,
- from_address,
- to_name,
- to_address,
- subject,
- headers);
- if(header.empty())
- {
- return false;
- }
-
- std::string message_str;
- if(message)
- {
- message_str = message;
- }
- bool rv = send(header, message_str, to_address, from_address);
- if(rv) return true;
- return false;
-}
-
-// static
-void LLMail::init(const std::string& hostname, apr_pool_t* pool)
-{
- gMailSocket = NULL;
- if(hostname.empty() || !pool)
- {
- gMailPool = NULL;
- gSockAddr = NULL;
- }
- else
- {
- gMailPool = pool;
-
- // collect all the information into a socaddr sturcture. the
- // documentation is a bit unclear, but I either have to
- // specify APR_UNSPEC or not specify any flags. I am not sure
- // which option is better.
- apr_status_t status = apr_sockaddr_info_get(
- &gSockAddr,
- hostname.c_str(),
- APR_UNSPEC,
- 25,
- APR_IPV4_ADDR_OK,
- gMailPool);
- ll_apr_warn_status(status);
- }
-}
-
-// static
-void LLMail::enable(bool mail_enabled)
-{
- gMailEnabled = mail_enabled;
-}
-
-// Test a subject line for RFC2822 compliance.
-static bool valid_subject_chars(const char *subject)
-{
- for (; *subject != '\0'; subject++)
- {
- unsigned char c = *subject;
-
- if (c == '\xa' || c == '\xd' || c > '\x7f')
- {
- return false;
- }
- }
-
- return true;
-}
-
-// static
-std::string LLMail::buildSMTPTransaction(
- const char* from_name,
- const char* from_address,
- const char* to_name,
- const char* to_address,
- const char* subject,
- const LLSD& headers)
-{
- if(!from_address || !to_address)
- {
- LL_INFOS() << "send_mail build_smtp_transaction reject: missing to and/or"
- << " from address." << LL_ENDL;
- return std::string();
- }
- if(!valid_subject_chars(subject))
- {
- LL_INFOS() << "send_mail build_smtp_transaction reject: bad subject header: "
- << "to=<" << to_address
- << ">, from=<" << from_address << ">"
- << LL_ENDL;
- return std::string();
- }
- std::ostringstream from_fmt;
- if(from_name && from_name[0])
- {
- // "My Name" <myaddress@example.com>
- from_fmt << "\"" << from_name << "\" <" << from_address << ">";
- }
- else
- {
- // <myaddress@example.com>
- from_fmt << "<" << from_address << ">";
- }
- std::ostringstream to_fmt;
- if(to_name && to_name[0])
- {
- to_fmt << "\"" << to_name << "\" <" << to_address << ">";
- }
- else
- {
- to_fmt << "<" << to_address << ">";
- }
- std::ostringstream header;
- header
- << "HELO lindenlab.com\r\n"
- << "MAIL FROM:<" << from_address << ">\r\n"
- << "RCPT TO:<" << to_address << ">\r\n"
- << "DATA\r\n"
- << "From: " << from_fmt.str() << "\r\n"
- << "To: " << to_fmt.str() << "\r\n"
- << "Subject: " << subject << "\r\n";
-
- if(headers.isMap())
- {
- LLSD::map_const_iterator iter = headers.beginMap();
- LLSD::map_const_iterator end = headers.endMap();
- for(; iter != end; ++iter)
- {
- header << (*iter).first << ": " << ((*iter).second).asString()
- << "\r\n";
- }
- }
-
- header << "\r\n";
- return header.str();
-}
-
-// static
-bool LLMail::send(
- const std::string& header,
- const std::string& raw_message,
- const char* from_address,
- const char* to_address)
-{
- if(!from_address || !to_address)
- {
- LL_INFOS() << "send_mail reject: missing to and/or from address."
- << LL_ENDL;
- return false;
- }
-
- // remove any "." SMTP commands to prevent injection (DEV-35777)
- // we don't need to worry about "\r\n.\r\n" because of the
- // "\n" --> "\n\n" conversion going into rfc2822_msg below
- std::string message = raw_message;
- std::string bad_string = "\n.\n";
- std::string good_string = "\n..\n";
- while (1)
- {
- auto index = message.find(bad_string);
- if (index == std::string::npos) break;
- message.replace(index, bad_string.size(), good_string);
- }
-
- // convert all "\n" into "\r\n"
- std::ostringstream rfc2822_msg;
- for(U32 i = 0; i < message.size(); ++i)
- {
- switch(message[i])
- {
- case '\0':
- break;
- case '\n':
- // *NOTE: this is kinda busted if we're fed \r\n
- rfc2822_msg << "\r\n";
- break;
- default:
- rfc2822_msg << message[i];
- break;
- }
- }
-
- if(!gMailEnabled)
- {
- LL_INFOS() << "send_mail reject: mail system is disabled: to=<"
- << to_address << ">, from=<" << from_address
- << ">" << LL_ENDL;
- // Any future interface to SMTP should return this as an
- // error. --mark
- return true;
- }
- if(!gSockAddr)
- {
- LL_WARNS() << "send_mail reject: mail system not initialized: to=<"
- << to_address << ">, from=<" << from_address
- << ">" << LL_ENDL;
- return false;
- }
-
- if(!connect_smtp())
- {
- LL_WARNS() << "send_mail reject: SMTP connect failure: to=<"
- << to_address << ">, from=<" << from_address
- << ">" << LL_ENDL;
- return false;
- }
-
- std::ostringstream smtp_fmt;
- smtp_fmt << header << rfc2822_msg.str() << "\r\n" << ".\r\n" << "QUIT\r\n";
- std::string smtp_transaction = smtp_fmt.str();
- size_t original_size = smtp_transaction.size();
- apr_size_t send_size = original_size;
- apr_status_t status = apr_socket_send(
- gMailSocket,
- smtp_transaction.c_str(),
- (apr_size_t*)&send_size);
- disconnect_smtp();
- if(ll_apr_warn_status(status))
- {
- LL_WARNS() << "send_mail socket failure: unable to write "
- << "to=<" << to_address
- << ">, from=<" << from_address << ">"
- << ", bytes=" << original_size
- << ", sent=" << send_size << LL_ENDL;
- return false;
- }
- if(send_size >= LL_MAX_KNOWN_GOOD_MAIL_SIZE)
- {
- LL_WARNS() << "send_mail message has been shown to fail in testing "
- << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE
- << " bytes. The next log about success is potentially a lie." << LL_ENDL;
- }
- LL_DEBUGS() << "send_mail success: "
- << "to=<" << to_address
- << ">, from=<" << from_address << ">"
- << ", bytes=" << original_size
- << ", sent=" << send_size << LL_ENDL;
-
-#if LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND
- LL_INFOS() << rfc2822_msg.str() << LL_ENDL;
-#endif
- return true;
-}
-
-
-// static
-std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id,
- const LLUUID& to_agent_id,
- U32 time,
- const U8* secret,
- size_t secret_size)
-{
-#if LL_WINDOWS
- return "blowfish-not-supported-on-windows";
-#else
- size_t data_size = 4 + UUID_BYTES + UUID_BYTES;
- // Convert input data into a binary blob
- std::vector<U8> data;
- data.resize(data_size);
- // *NOTE: This may suffer from endian issues. Could be htolememcpy.
- memcpy(&data[0], &time, 4);
- memcpy(&data[4], &from_agent_id.mData[0], UUID_BYTES);
- memcpy(&data[4 + UUID_BYTES], &to_agent_id.mData[0], UUID_BYTES);
-
- // Encrypt the blob
- LLBlowfishCipher cipher(secret, secret_size);
- size_t encrypted_size = cipher.requiredEncryptionSpace(data.size());
- U8* encrypted = new U8[encrypted_size];
- cipher.encrypt(&data[0], data_size, encrypted, encrypted_size);
-
- std::string address = LLBase32::encode(encrypted, encrypted_size);
-
- // Make it more pretty for humans.
- LLStringUtil::toLower(address);
-
- delete [] encrypted;
-
- return address;
-#endif
-}
diff --git a/indra/llmessage/llmail.h b/indra/llmessage/llmail.h
deleted file mode 100644
index d67b89d1ea..0000000000
--- a/indra/llmessage/llmail.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * @file llmail.h
- * @brief smtp helper functions.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLMAIL_H
-#define LL_LLMAIL_H
-
-typedef struct apr_pool_t apr_pool_t;
-
-#include "llsd.h"
-
-class LLMail
-{
-public:
- // if hostname is NULL, then the host is resolved as 'mail'
- static void init(const std::string& hostname, apr_pool_t* pool);
-
- // Allow all email transmission to be disabled/enabled.
- static void enable(bool mail_enabled);
-
- /**
- * @brief send an email
- * @param from_name The name of the email sender
- * @param from_address The email address for the sender
- * @param to_name The name of the email recipient
- * @param to_address The email recipient address
- * @param subject The subject of the email
- * @param headers optional X-Foo headers in an llsd map.
- * @return Returns true if the call succeeds, false otherwise.
- *
- * Results in:
- * From: "from_name" <from_address>
- * To: "to_name" <to_address>
- * Subject: subject
- *
- * message
- */
- static bool send(
- const char* from_name,
- const char* from_address,
- const char* to_name,
- const char* to_address,
- const char* subject,
- const char* message,
- const LLSD& headers = LLSD());
-
- /**
- * @brief build the complete smtp transaction & header for use in an
- * mail.
- *
- * @param from_name The name of the email sender
- * @param from_address The email address for the sender
- * @param to_name The name of the email recipient
- * @param to_address The email recipient address
- * @param subject The subject of the email
- * @param headers optional X-Foo headers in an llsd map.
- * @return Returns the complete SMTP transaction mail header.
- */
- static std::string buildSMTPTransaction(
- const char* from_name,
- const char* from_address,
- const char* to_name,
- const char* to_address,
- const char* subject,
- const LLSD& headers = LLSD());
-
- /**
- * @brief send an email with header and body.
- *
- * @param header The email header. Use build_mail_header().
- * @param message The unescaped email message.
- * @param from_address Used for debugging
- * @param to_address Used for debugging
- * @return Returns true if the message could be sent.
- */
- static bool send(
- const std::string& header,
- const std::string& message,
- const char* from_address,
- const char* to_address);
-
- // IM-to-email sessions use a "session id" based on an encrypted
- // combination of from agent_id, to agent_id, and timestamp. When
- // a user replies to an email we use the from_id to determine the
- // sender's name and the to_id to route the message. The address
- // is encrypted to prevent users from building addresses to spoof
- // IMs from other users. The timestamps allow the "sessions" to
- // expire, in case one of the sessions is stolen/hijacked.
- //
- // indra/tools/mailglue is responsible for parsing the inbound mail.
- //
- // secret: binary blob passed to blowfish, max length 56 bytes
- // secret_size: length of blob, in bytes
- //
- // Returns: "base64" encoded email local-part, with _ and - as the
- // non-alphanumeric characters. This allows better compatibility
- // with email systems than the default / and + extra chars. JC
- static std::string encryptIMEmailAddress(
- const LLUUID& from_agent_id,
- const LLUUID& to_agent_id,
- U32 time,
- const U8* secret,
- size_t secret_size);
-};
-
-extern const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE;
-
-#endif
diff --git a/indra/llmessage/lltransfertargetfile.h b/indra/llmessage/lltransfertargetfile.h
index 43189eb388..cca0ea8d04 100644
--- a/indra/llmessage/lltransfertargetfile.h
+++ b/indra/llmessage/lltransfertargetfile.h
@@ -37,8 +37,8 @@ public:
LLTransferTargetParamsFile()
: LLTransferTargetParams(LLTTT_FILE),
- mCompleteCallback(NULL),
- mUserData(NULL)
+ mCompleteCallback(nullptr),
+ mUserData(nullptr)
{}
void setFilename(const std::string& filename) { mFilename = filename; }
void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; }
diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp
index fcf853845b..bbc2ddf4cc 100644
--- a/indra/llmessage/lltransfertargetvfile.cpp
+++ b/indra/llmessage/lltransfertargetvfile.cpp
@@ -41,8 +41,8 @@ void LLTransferTargetVFile::updateQueue(bool shutdown)
LLTransferTargetParamsVFile::LLTransferTargetParamsVFile() :
LLTransferTargetParams(LLTTT_VFILE),
mAssetType(LLAssetType::AT_NONE),
- mCompleteCallback(NULL),
- mRequestDatap(NULL),
+ mCompleteCallback(nullptr),
+ mRequestDatap(nullptr),
mErrCode(0)
{
}
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index ad1ff86807..e2937490ba 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -913,7 +913,7 @@ LLStoredMessagePtr LLMessageSystem::getReceivedMessage() const
const std::string& name = mMessageReader->getMessageName();
LLSD message = wrapReceivedTemplateData();
- return LLStoredMessagePtr(new LLStoredMessage(name, message));
+ return std::make_shared<LLStoredMessage>(name, message);
}
LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const
@@ -921,7 +921,7 @@ LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const
const std::string& name = mMessageBuilder->getMessageName();
LLSD message = wrapBuiltTemplateData();
- return LLStoredMessagePtr(new LLStoredMessage(name, message));
+ return std::make_shared<LLStoredMessage>(name, message);
}
S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message)
@@ -1162,7 +1162,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
{
LLSD message = mLLSDMessageBuilder->getMessage();
- UntrustedCallback_t cb = NULL;
+ UntrustedCallback_t cb = nullptr;
if ((mSendReliable) && (mReliablePacketParams.mCallback))
{
cb = boost::bind(mReliablePacketParams.mCallback, mReliablePacketParams.mCallbackData, _1);
@@ -1359,7 +1359,7 @@ S32 LLMessageSystem::sendMessage(
return 0;
}
- UntrustedCallback_t cb = NULL;
+ UntrustedCallback_t cb = nullptr;
if ((mSendReliable) && (mReliablePacketParams.mCallback))
{
cb = boost::bind(mReliablePacketParams.mCallback, mReliablePacketParams.mCallbackData, _1);
@@ -4028,9 +4028,9 @@ void LLMessageSystem::sendUntrustedSimulatorMessageCoro(std::string url, std::st
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("untrustedSimulatorMessage", httpPolicy));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("untrustedSimulatorMessage", httpPolicy);
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
+ LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>();
if (url.empty())
@@ -4049,8 +4049,10 @@ void LLMessageSystem::sendUntrustedSimulatorMessageCoro(std::string url, std::st
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- if ((callback) && (!callback.empty()))
+ if (callback != nullptr)
+ {
callback((status) ? LL_ERR_NOERR : LL_ERR_TCP_TIMEOUT);
+ }
}
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index 30945cac51..14cdc48a07 100644
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -28,6 +28,7 @@
#define LL_MESSAGE_H
#include <cstring>
+#include <functional>
#include <set>
#if LL_LINUX
@@ -55,7 +56,6 @@
#include "llmessagesenderinterface.h"
#include "llstoredmessage.h"
-#include "boost/function.hpp"
#include "llpounceable.h"
#include "llcoros.h"
#include LLCOROS_MUTEX_HEADER
@@ -826,7 +826,7 @@ public:
void receivedMessageFromTrustedSender();
private:
- typedef boost::function<void(S32)> UntrustedCallback_t;
+ typedef std::function<void(S32)> UntrustedCallback_t;
void sendUntrustedSimulatorMessageCoro(std::string url, std::string message, LLSD body, UntrustedCallback_t callback);
diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp
deleted file mode 100644
index f4a9e501ec..0000000000
--- a/indra/llmessage/tests/llareslistener_test.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * @file llareslistener_test.cpp
- * @author Mark Palange
- * @date 2009-02-26
- * @brief Tests of llareslistener.h.
- *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#if LL_WINDOWS
-#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
-#endif
-
-// Precompiled header
-#include "linden_common.h"
-// associated header
-#include "../llareslistener.h"
-// STL headers
-#include <iostream>
-// std headers
-// external library headers
-#include <boost/bind.hpp>
-
-// other Linden headers
-#include "llsd.h"
-#include "llares.h"
-#include "../test/lltut.h"
-#include "llevents.h"
-#include "tests/wrapllerrs.h"
-
-/*****************************************************************************
-* Dummy stuff
-*****************************************************************************/
-LLAres::LLAres():
- // Simulate this much of the real LLAres constructor: we need an
- // LLAresListener instance.
- mListener(new LLAresListener("LLAres", this))
-{}
-LLAres::~LLAres() {}
-void LLAres::rewriteURI(const std::string &uri,
- LLAres::UriRewriteResponder *resp)
-{
- // This is the only LLAres method I chose to implement.
- // The effect is that LLAres returns immediately with
- // a result that is equal to the input uri.
- std::vector<std::string> result;
- result.push_back(uri);
- resp->rewriteResult(result);
-}
-
-LLAres::QueryResponder::~QueryResponder() {}
-void LLAres::QueryResponder::queryError(int) {}
-void LLAres::QueryResponder::queryResult(char const*, size_t) {}
-LLQueryResponder::LLQueryResponder() {}
-void LLQueryResponder::queryResult(char const*, size_t) {}
-void LLQueryResponder::querySuccess() {}
-void LLAres::UriRewriteResponder::queryError(int) {}
-void LLAres::UriRewriteResponder::querySuccess() {}
-void LLAres::UriRewriteResponder::rewriteResult(const std::vector<std::string>& uris) {}
-
-/*****************************************************************************
-* TUT
-*****************************************************************************/
-namespace tut
-{
- struct data
- {
- LLAres dummyAres;
- };
- typedef test_group<data> llareslistener_group;
- typedef llareslistener_group::object object;
- llareslistener_group llareslistenergrp("llareslistener");
-
- struct ResponseCallback
- {
- std::vector<std::string> mURIs;
- bool operator()(const LLSD& response)
- {
- mURIs.clear();
- for (LLSD::array_const_iterator ri(response.beginArray()), rend(response.endArray());
- ri != rend; ++ri)
- {
- mURIs.push_back(*ri);
- }
- return false;
- }
- };
-
- template<> template<>
- void object::test<1>()
- {
- set_test_name("test event");
- // Tests the success and failure cases, since they both use
- // the same code paths in the LLAres responder.
- ResponseCallback response;
- std::string pumpname("trigger");
- // Since we're asking LLEventPumps to obtain() the pump by the desired
- // name, it will persist beyond the current scope, so ensure we
- // disconnect from it when 'response' goes away.
- LLTempBoundListener temp(
- LLEventPumps::instance().obtain(pumpname).listen("rewriteURIresponse",
- boost::bind(&ResponseCallback::operator(), &response, _1)));
- // Now build an LLSD request that will direct its response events to
- // that pump.
- const std::string testURI("login.bar.com");
- LLSD request;
- request["op"] = "rewriteURI";
- request["uri"] = testURI;
- request["reply"] = pumpname;
- LLEventPumps::instance().obtain("LLAres").post(request);
- ensure_equals(response.mURIs.size(), 1);
- ensure_equals(response.mURIs.front(), testURI);
- }
-
- template<> template<>
- void object::test<2>()
- {
- set_test_name("bad op");
- WrapLLErrs capture;
- LLSD request;
- request["op"] = "foo";
- std::string threw = capture.catch_llerrs([&request](){
- LLEventPumps::instance().obtain("LLAres").post(request);
- });
- ensure_contains("LLAresListener bad op", threw, "bad");
- }
-
- template<> template<>
- void object::test<3>()
- {
- set_test_name("bad rewriteURI request");
- WrapLLErrs capture;
- LLSD request;
- request["op"] = "rewriteURI";
- std::string threw = capture.catch_llerrs([&request](){
- LLEventPumps::instance().obtain("LLAres").post(request);
- });
- ensure_contains("LLAresListener bad req", threw, "missing");
- ensure_contains("LLAresListener bad req", threw, "reply");
- ensure_contains("LLAresListener bad req", threw, "uri");
- }
-
- template<> template<>
- void object::test<4>()
- {
- set_test_name("bad rewriteURI request");
- WrapLLErrs capture;
- LLSD request;
- request["op"] = "rewriteURI";
- request["reply"] = "nonexistent";
- std::string threw = capture.catch_llerrs([&request](){
- LLEventPumps::instance().obtain("LLAres").post(request);
- });
- ensure_contains("LLAresListener bad req", threw, "missing");
- ensure_contains("LLAresListener bad req", threw, "uri");
- ensure_does_not_contain("LLAresListener bad req", threw, "reply");
- }
-
- template<> template<>
- void object::test<5>()
- {
- set_test_name("bad rewriteURI request");
- WrapLLErrs capture;
- LLSD request;
- request["op"] = "rewriteURI";
- request["uri"] = "foo.bar.com";
- std::string threw = capture.catch_llerrs([&request](){
- LLEventPumps::instance().obtain("LLAres").post(request);
- });
- ensure_contains("LLAresListener bad req", threw, "missing");
- ensure_contains("LLAresListener bad req", threw, "reply");
- ensure_does_not_contain("LLAresListener bad req", threw, "uri");
- }
-}
diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp
index 4caae5f082..0a77fd218b 100644
--- a/indra/llmessage/tests/llcoproceduremanager_test.cpp
+++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp
@@ -48,7 +48,7 @@
#pragma warning(disable: 4702)
#endif
-LLCoreHttpUtil::HttpCoroutineAdapter::HttpCoroutineAdapter(std::string const&, unsigned int)
+LLCoreHttpUtil::HttpCoroutineAdapter::HttpCoroutineAdapter(std::string name, LLCore::HttpRequest::policy_t policyId)
{
}