summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-05-15 12:51:18 -0700
committerRider Linden <rider@lindenlab.com>2015-05-15 12:51:18 -0700
commitf26fb73dd8a7794df580e6a58744d76dde293569 (patch)
tree7a8de73693c46d087fac1a28401097c867f3da7e /indra
parent2d79079414f61ad7a6e336e039353c030aa559c8 (diff)
Address Nat's concerns about the const_cast<> and modification of a binary object wrapped in an LLSD object.
Diffstat (limited to 'indra')
-rw-r--r--indra/llmessage/llcorehttputil.cpp17
-rwxr-xr-xindra/newview/llfeaturemanager.cpp2
2 files changed, 19 insertions, 0 deletions
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index 8da62ca839..f8f5866355 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -405,6 +405,22 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::
LLCore::BufferArrayStream bas(body);
+#if 1
+ // This is the slower implementation. It is safe vis-a-vi the const_cast<> and modification
+ // of a LLSD managed array but contains an extra (potentially large) copy.
+ //
+ // *TODO: https://jira.secondlife.com/browse/MAINT-5221
+
+ LLSD::Binary data;
+ data.reserve(size);
+ bas >> std::noskipws;
+ data.assign(std::istream_iterator<U8>(bas), std::istream_iterator<U8>());
+
+ result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = data;
+
+#else
+ // This is disabled because it's dangerous. See the other case for an
+ // alternate implementation.
// We create a new LLSD::Binary object and assign it to the result map.
// The LLSD has created it's own copy so we retrieve it asBinary and const cast
// the reference so that we can modify it.
@@ -416,6 +432,7 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::
data.reserve(size);
bas >> std::noskipws;
data.assign(std::istream_iterator<U8>(bas), std::istream_iterator<U8>());
+#endif
return result;
}
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index b701fece5a..c61e11b912 100755
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -520,6 +520,8 @@ void LLFeatureManager::fetchFeatureTableCoro(LLCoros::self& self, std::string ta
#endif
std::string url = base + "/" + filename;
+ // testing url below
+ //url = "http://viewer-settings.secondlife.com/featuretable.2.1.1.208406.txt";
const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);