From 934e15973ea86e0e863123d4c5eabeae44d6c763 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 31 Jan 2007 19:36:32 +0000 Subject: merge release@57486 release-candidate@57503 --- indra/llcommon/lluri.cpp | 84 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lluri.cpp') diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 1b66173399..5ecba4420d 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -9,9 +9,13 @@ */ #include "linden_common.h" + +#include "llapp.h" #include "lluri.h" #include "llsd.h" +#include "../llmath/lluuid.h" + // uric = reserved | unreserved | escaped // reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," // unreserved = alphanum | mark @@ -353,9 +357,21 @@ LLURI LLURI::buildHTTP(const std::string& host_port, const LLSD& path) { LLURI result; - result.mScheme = "HTTP"; + // TODO: deal with '/' '?' '#' in host_port - result.mEscapedAuthority = "//" + escape(host_port); + S32 index = host_port.find("://"); + if (index != host_port.npos) + { + // The scheme is part of the host_port + result.mScheme = ""; + result.mEscapedAuthority = escape(host_port); + } + else + { + result.mScheme = "HTTP"; + result.mEscapedAuthority = "//" + escape(host_port); + } + if (path.isArray()) { // break out and escape each path component @@ -397,6 +413,70 @@ LLURI LLURI::buildHTTP(const std::string& host_port, return result; } +// static +LLURI LLURI::buildAgentPresenceURI(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("presence"); + + return buildHTTP(host, path); +} + +// static +LLURI LLURI::buildBulkAgentPresenceURI(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("presence"); + + return buildHTTP(host, path); +} + +// static +LLURI LLURI::buildAgentSessionURI(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("session"); + + 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); +} + std::string LLURI::asString() const { if (mScheme.empty()) -- cgit v1.2.3