Result of svn merge -r67150:67159 svn+ssh://svn/svn/linden/branches/mp-backbone-2 into release.
parent
7138fb673a
commit
b387b98bd0
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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]))
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in New Issue