From b387b98bd09119397b43a68567383401d0bcd532 Mon Sep 17 00:00:00 2001
From: Aaron Brashears <aaronb@lindenlab.com>
Date: Thu, 2 Aug 2007 19:05:10 +0000
Subject: Result of svn merge -r67150:67159
 svn+ssh://svn/svn/linden/branches/mp-backbone-2 into release.

---
 indra/lib/python/indra/base/llsd.py |   4 +-
 indra/lib/python/indra/ipc/russ.py  |  14 +++++
 indra/llcommon/lluri.cpp            | 111 ------------------------------------
 3 files changed, 16 insertions(+), 113 deletions(-)

(limited to 'indra')

diff --git a/indra/lib/python/indra/base/llsd.py b/indra/lib/python/indra/base/llsd.py
index 1af07e5885..18e62b0817 100644
--- a/indra/lib/python/indra/base/llsd.py
+++ b/indra/lib/python/indra/base/llsd.py
@@ -788,8 +788,8 @@ def parse(something):
             return to_python(fromstring(something)[0])
         else:
             return LLSDNotationParser().parse(something)
-    except KeyError:
-        raise Exception('LLSD could not be parsed: %s' % (something,))
+    except KeyError, e:
+        raise Exception('LLSD could not be parsed: %s' % (e,))
 
 class LLSD(object):
     def __init__(self, thing=None):
diff --git a/indra/lib/python/indra/ipc/russ.py b/indra/lib/python/indra/ipc/russ.py
index f6f67d4314..a9ebd8bb03 100644
--- a/indra/lib/python/indra/ipc/russ.py
+++ b/indra/lib/python/indra/ipc/russ.py
@@ -25,6 +25,18 @@ class UnknownDirective(Exception):
 class BadDirective(Exception):
     pass
 
+def format_value_for_path(value):
+    if type(value) in [list, tuple]:
+        # *NOTE: treat lists as unquoted path components so that the quoting
+        # doesn't get out-of-hand.  This is a workaround for the fact that
+        # russ always quotes, even if the data it's given is already quoted,
+        # and it's not safe to simply unquote a path directly, so if we want
+        # russ to substitute urls parts inside other url parts we always
+        # have to do so via lists of unquoted path components.
+        return '/'.join([urllib.quote(str(item)) for item in value])
+    else:
+        return urllib.quote(str(value))
+
 def format(format_str, context):
     """@brief Format format string according to rules for RUSS.
 @see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax
@@ -50,6 +62,8 @@ def format(format_str, context):
                 #print "directive:", format_str[pos+1:pos+5]
                 if format_str[pos + 1] == '$':
                     value = context.get(format_str[pos + 2:end])
+                    if value is not None:
+                        value = format_value_for_path(value)
                 elif format_str[pos + 1] == '%':
                     value = _build_query_string(
                         context.get(format_str[pos + 2:end]))
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index 22526c9a03..18867a77e1 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -299,117 +299,6 @@ LLURI LLURI::buildHTTP(const std::string& host,
 	return LLURI::buildHTTP(llformat("%s:%u", host.c_str(), port), path, query);
 }
 
-namespace {
-	LLURI buildBackboneURL(LLApp* app,
-				const std::string& p1 = "",
-				const std::string& p2 = "",
-				const std::string& p3 = "")
-	{
-		std::string host = "localhost:12040";
-
-		if (app)
-		{
-			host = app->getOption("backbone-host-port").asString();
-		}
-
-		LLSD path = LLSD::emptyArray();
-		if (!p1.empty())	path.append(p1);
-		if (!p2.empty())	path.append(p2);
-		if (!p3.empty())	path.append(p3);
-
-		return LLURI::buildHTTP(host, path);
-	}
-}
-
-#if LL_ENABLE_JANKY_DEPRECATED_WEB_SERVICE_CALLS
-// static
-LLURI LLURI::buildBulkAgentNamesURI(LLApp* app)
-{
-	std::string host = "localhost:12040";
-
-	if (app)
-	{
-		host = app->getOption("backbone-host-port").asString();
-	}
-
-	LLSD path = LLSD::emptyArray();
-	path.append("agent");
-	path.append("names");
-
-	return buildHTTP(host, path);
-}
-
-// static
-LLURI LLURI::buildBulkAgentNamesURI(LLApp* app)
-{
-	std::string host = "localhost:12040";
-
-	if (app)
-	{
-		host = app->getOption("backbone-host-port").asString();
-	}
-
-	LLSD path = LLSD::emptyArray();
-	path.append("agent");
-	path.append("names");
-
-	return buildHTTP(host, path);
-}
-
-// static
-LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app)
-{
-	return buildBackboneURL(app, "agent", agent_id.asString(), "session");
-}
-
-// static
-LLURI LLURI::buildAgentNameURI(const LLUUID& agent_id, LLApp* app)
-{
-	std::string host = "localhost:12040";
-
-	if (app)
-	{
-		host = app->getOption("backbone-host-port").asString();
-	}
-
-	LLSD path = LLSD::emptyArray();
-	path.append("agent");
-	path.append(agent_id);
-	path.append("name");
-
-	return buildHTTP(host, path);
-}
-
-// static
-LLURI LLURI::buildAgentNameURI(const LLUUID& agent_id, LLApp* app)
-{
-	std::string host = "localhost:12040";
-
-	if (app)
-	{
-		host = app->getOption("backbone-host-port").asString();
-	}
-
-	LLSD path = LLSD::emptyArray();
-	path.append("agent");
-	path.append(agent_id);
-	path.append("name");
-
-	return buildHTTP(host, path);
-}
-
-// static
-LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver)
-{
-	LLSD path = LLSD::emptyArray();
-	path.append("agent");
-	path.append(agent_id);
-	path.append("logininfo");
-
-	return buildHTTP(dataserver, path);
-}
-#endif // LL_ENABLE_JANKY_DEPRECATED_WEB_SERVICE_CALLS
-
 std::string LLURI::asString() const
 {
 	if (mScheme.empty())
-- 
cgit v1.2.3