summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2008-06-06 22:52:02 +0000
committerJosh Bell <josh@lindenlab.com>2008-06-06 22:52:02 +0000
commit810a0b3dcee41ec657c94ccb26003b9b4e20e141 (patch)
tree5b06ec8662957b3218fde311983acd9ac5043c75 /indra/llmessage
parentad332810078a0bbb8fa08fcbfdf3d756de6914f6 (diff)
svn merge -r 88872:89137 svn+ssh://svn.lindenlab.com/svn/linden/qa/qar-652 --> release
Effectively: svn merge -r 87048:88773 svn+ssh://svn.lindenlab.com/svn/linden/branches/Branch_1-22-Server * Plus some gcc4.x fixes In detail: * Bump version numbers to 1.22.0 Server * Updated files for enabled conductor. * Added tarball pulling during deploy for central servers. * DEV-15160 Logins not remembering start location on beta grid * DEV-15167 Random failure with set-classified-stats * DEV-15193 Viewer Passing Through Unsanitized Strings to DB when creating classifieds. * Add --location to the curl invocation in fetch_agni_ws_snapshot * QAR-609 Some Havok4 bug fixes * QAR-460 Automatic XUI selection & Kick-ass Linux Fonts MergeMe * DEV-14704 1.21.1.86182 revealing hidden groups in profile * DEV-14641 Change automated Subject Line messages for IM-to-Email to avoid SPAM association * DEV-15387 Write unit test for LLStringFn::strip_invalid_xml(). * Changed getpass.getuser() to os.getuid() as getuser() was returning the saved-UID of the process (root user, which kic ks off parabuild as parabuild u ser). We want os.getuid() as it correctly returns the parabuild user's uid. / Stupid mistake using os.getuid().. .fixed by using the pwd module to return the unix username given the userid from os.getuid() * QAR-623 More single ref attachment awesomeness testing * Committed temporary fix for running dwell and query-cache on deneb.lindenlab.com, since it's in the DFW colo with the current asset cluster. * DEV-15783 Groups not shown in search wont appear in your profile while using webservice * QAR-642 Even more single ref attachment awesomeness testing From Branch_1-21-Server (which didn't go directly into release) * addinng the phputf8 library found from http://phputf8.sourceforge.net/ and liscensed LGPL. For DEV-15202 * Checking in a fix for settle balance portion proc - the event query was moved. * fix for DEV-15202 - replace non-utf8 with REPLACEMENT CHAR. See jira for more info. * Checking return value from /proc/vault/charge, must get back a string. * removed code used for the browser hud AB test. * Changed TTL from stupid default of 1234 to 5 * DEV-15788 Fixing crashloganalyzer.py cleanup of unparseable crash reports. * DEV-15737 offline scripted IMs not working inprocess_im_using_ws Merge conflict resolutions/fixes include: * Addition of indra/test/llstring_tut.cpp to indra/test/test.vcproj migrated to CMakeLists.txt * Changes to BuildParams, scripts/automated_build_scripts/* reviewed w/ cg * Changes to deploy scripts (scripts/farm, install_indra.py, farm_deploy) based on the 1.22 changes except for mkpersist dir addition (retained from release) * Changes to scripts/crash_report/crashloganalyzer.py retained from 1.22, per Mani * scripts/generate_indra_xml.py, etc/services-station.dtd, indra/newsim/llagentinfo.cpp analyzed carefully by josh * indra/llcommon/llstring.h required fix for client build ("" --> std::basic_string<T>()) in LLStringBase<T> initializer * indra/llphysics/abstract/llphysicsshape.h #include syntax changed from <llmath/llvolume.h> to "llvolume.h" Psst, don't tell anyone, but the dataserver-is-deprecated
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llservicebuilder.cpp70
-rw-r--r--indra/llmessage/llservicebuilder.h15
2 files changed, 28 insertions, 57 deletions
diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp
index d5c6014140..6442767ebd 100644
--- a/indra/llmessage/llservicebuilder.cpp
+++ b/indra/llmessage/llservicebuilder.cpp
@@ -111,10 +111,13 @@ std::string LLServiceBuilder::buildServiceURI(
const std::string& service_name,
const LLSD& option_map)
{
- std::string service_url = buildServiceURI(service_name);
-
- // Find the Service Name
- if(!service_url.empty() && option_map.isMap())
+ return russ_format(buildServiceURI(service_name), option_map);
+}
+
+std::string russ_format(const std::string& format_str, const LLSD& context)
+{
+ std::string service_url(format_str);
+ if(!service_url.empty() && context.isMap())
{
// throw in a ridiculously large limiter to make sure we don't
// loop forever with bad input.
@@ -134,9 +137,9 @@ std::string LLServiceBuilder::buildServiceURI(
std::string::iterator end(service_url.end());
std::string::iterator deepest_node(service_url.end());
std::string::iterator deepest_node_end(service_url.end());
- //parse out the variables to replace by going through {}s one at a time,
- // starting with the "deepest" in series {{}},
- // and otherwise replacing right-to-left
+ // parse out the variables to replace by going through {}s
+ // one at a time, starting with the "deepest" in series
+ // {{}}, and otherwise replacing right-to-left
for(; iter != end; ++iter)
{
switch(*iter)
@@ -171,7 +174,7 @@ std::string LLServiceBuilder::buildServiceURI(
// params and straight string substitution, so it's a
// known distance of 2 to skip the directive.
std::string key(deepest_node + 2, deepest_node_end);
- LLSD value = option_map[key];
+ LLSD value = context[key];
switch(*(deepest_node + 1))
{
case '$':
@@ -184,7 +187,9 @@ std::string LLServiceBuilder::buildServiceURI(
}
else
{
- llwarns << "Unknown key: " << key << " in option map: " << LLSDOStreamer<LLSDNotationFormatter>(option_map) << llendl;
+ llwarns << "Unknown key: " << key << " in option map: "
+ << LLSDOStreamer<LLSDNotationFormatter>(context)
+ << llendl;
keep_looping = false;
}
break;
@@ -212,50 +217,3 @@ std::string LLServiceBuilder::buildServiceURI(
}
return service_url;
}
-
-
-
-// Old, not as good implementation. Phoenix 2007-10-15
-#if 0
- // Do brace replacements - NOT CURRENTLY RECURSIVE
- for(LLSD::map_const_iterator option_itr = option_map.beginMap();
- option_itr != option_map.endMap();
- ++option_itr)
- {
- std::string variable_name = "{$";
- variable_name.append((*option_itr).first);
- variable_name.append("}");
- std::string::size_type find_pos = service_url.find(variable_name);
- if(find_pos != std::string::npos)
- {
- service_url.replace(
- find_pos,
- variable_name.length(),
- (*option_itr).second.asString());
- continue;
- }
- variable_name.assign("{%");
- variable_name.append((*option_itr).first);
- variable_name.append("}");
- find_pos = service_url.find(variable_name);
- if(find_pos != std::string::npos)
- {
- std::string query_str = LLURI::mapToQueryString(
- (*option_itr).second);
- service_url.replace(
- find_pos,
- variable_name.length(),
- query_str);
- }
- }
- }
-
- if (service_url.find('{') != std::string::npos)
- {
- llwarns << "Constructed a likely bogus service URL: " << service_url
- << llendl;
- }
-
- return service_url;
-}
-#endif
diff --git a/indra/llmessage/llservicebuilder.h b/indra/llmessage/llservicebuilder.h
index 2c00660893..30e44923b6 100644
--- a/indra/llmessage/llservicebuilder.h
+++ b/indra/llmessage/llservicebuilder.h
@@ -38,11 +38,24 @@
class LLSD;
+/**
+ * @brief Format format string according to rules for RUSS.
+ *
+ * This function appears alongside the service builder since the
+ * algorithm was originally implemented there. This can eventually be
+ * moved when someone wants to take the time.
+ * @see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax
+ * @param format_str The input string to format.
+ * @param context A map used for string substitutions.
+ * @return Returns the formatted string. If no match is found for a
+ * substitution target, the braces remain intact.
+ */
+std::string russ_format(const std::string& format_str, const LLSD& context);
+
/**
* @class LLServiceBuilder
* @brief This class builds urls for us to use when making web service calls.
*/
-
class LLServiceBuilder
{
LOG_CLASS(LLServiceBuilder);