summaryrefslogtreecommitdiff
path: root/indra/llcommon/lluri.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2007-01-31 19:36:32 +0000
committerSteven Bennetts <steve@lindenlab.com>2007-01-31 19:36:32 +0000
commit934e15973ea86e0e863123d4c5eabeae44d6c763 (patch)
treec4d9ff93e1d9283c4807981ecf1973babf620143 /indra/llcommon/lluri.cpp
parent565e6873decfaadf9eda2d0109132eb64c0ad325 (diff)
merge release@57486 release-candidate@57503
Diffstat (limited to 'indra/llcommon/lluri.cpp')
-rw-r--r--indra/llcommon/lluri.cpp84
1 files changed, 82 insertions, 2 deletions
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())