aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/lluri.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/lluri.cpp')
-rw-r--r--linden/indra/llcommon/lluri.cpp84
1 files changed, 82 insertions, 2 deletions
diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp
index 2eb0f11..e697ec1 100644
--- a/linden/indra/llcommon/lluri.cpp
+++ b/linden/indra/llcommon/lluri.cpp
@@ -28,9 +28,13 @@
28 */ 28 */
29 29
30#include "linden_common.h" 30#include "linden_common.h"
31
32#include "llapp.h"
31#include "lluri.h" 33#include "lluri.h"
32#include "llsd.h" 34#include "llsd.h"
33 35
36#include "../llmath/lluuid.h"
37
34// uric = reserved | unreserved | escaped 38// uric = reserved | unreserved | escaped
35// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," 39// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
36// unreserved = alphanum | mark 40// unreserved = alphanum | mark
@@ -372,9 +376,21 @@ LLURI LLURI::buildHTTP(const std::string& host_port,
372 const LLSD& path) 376 const LLSD& path)
373{ 377{
374 LLURI result; 378 LLURI result;
375 result.mScheme = "HTTP"; 379
376 // TODO: deal with '/' '?' '#' in host_port 380 // TODO: deal with '/' '?' '#' in host_port
377 result.mEscapedAuthority = "//" + escape(host_port); 381 S32 index = host_port.find("://");
382 if (index != host_port.npos)
383 {
384 // The scheme is part of the host_port
385 result.mScheme = "";
386 result.mEscapedAuthority = escape(host_port);
387 }
388 else
389 {
390 result.mScheme = "HTTP";
391 result.mEscapedAuthority = "//" + escape(host_port);
392 }
393
378 if (path.isArray()) 394 if (path.isArray())
379 { 395 {
380 // break out and escape each path component 396 // break out and escape each path component
@@ -416,6 +432,70 @@ LLURI LLURI::buildHTTP(const std::string& host_port,
416 return result; 432 return result;
417} 433}
418 434
435// static
436LLURI LLURI::buildAgentPresenceURI(const LLUUID& agent_id, LLApp* app)
437{
438 std::string host = "localhost:12040";
439
440 if (app)
441 {
442 host = app->getOption("backbone-host-port").asString();
443 }
444
445 LLSD path = LLSD::emptyArray();
446 path.append("agent");
447 path.append(agent_id);
448 path.append("presence");
449
450 return buildHTTP(host, path);
451}
452
453// static
454LLURI LLURI::buildBulkAgentPresenceURI(LLApp* app)
455{
456 std::string host = "localhost:12040";
457
458 if (app)
459 {
460 host = app->getOption("backbone-host-port").asString();
461 }
462
463 LLSD path = LLSD::emptyArray();
464 path.append("agent");
465 path.append("presence");
466
467 return buildHTTP(host, path);
468}
469
470// static
471LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app)
472{
473 std::string host = "localhost:12040";
474
475 if (app)
476 {
477 host = app->getOption("backbone-host-port").asString();
478 }
479
480 LLSD path = LLSD::emptyArray();
481 path.append("agent");
482 path.append(agent_id);
483 path.append("session");
484
485 return buildHTTP(host, path);
486}
487
488// static
489LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver)
490{
491 LLSD path = LLSD::emptyArray();
492 path.append("agent");
493 path.append(agent_id);
494 path.append("logininfo");
495
496 return buildHTTP(dataserver, path);
497}
498
419std::string LLURI::asString() const 499std::string LLURI::asString() const
420{ 500{
421 if (mScheme.empty()) 501 if (mScheme.empty())