LLURI Class Reference

#include <lluri.h>

Collaboration diagram for LLURI:

Collaboration graph
[legend]

List of all members.

Parts of a URI



std::string scheme () const
 ex.: "http", note lack of colon
std::string opaque () const
 everything after the colon
std::string authority () const
std::string hostName () const
std::string userName () const
std::string password () const
U16 hostPort () const
BOOL defaultPort () const
const std::string & escapedPath () const
std::string path () const
LLSD pathArray () const
std::string query () const
const std::string & escapedQuery () const
LLSD queryMap () const
static LLSD queryMap (std::string escaped_query_string)
static std::string mapToQueryString (const LLSD &query_map)
 given a name value map, return a serialized query string.

Public Member Functions

 LLURI ()
 LLURI (const std::string &escaped_str)
 LLURI (const std::string &scheme, const std::string &userName, const std::string &password, const std::string &hostName, U16 hostPort, const std::string &escapedPath, const std::string &escapedQuery)
 ~LLURI ()
std::string asString () const
 the whole URI, escaped as needed

Static Public Member Functions

static LLURI buildHTTP (const std::string &prefix, const LLSD &path)
static LLURI buildHTTP (const std::string &prefix, const LLSD &path, const LLSD &query)
static LLURI buildHTTP (const std::string &host, const U32 &port, const LLSD &path)
static LLURI buildHTTP (const std::string &host, const U32 &port, const LLSD &path, const LLSD &query)
Escaping Utilities


static std::string escape (const std::string &str)
 Escape a raw url with a reasonable set of allowed characters.
static std::string escape (const std::string &str, const std::string &allowed, bool is_allowed_sorted=false)
 Escape a string with a specified set of allowed characters.
static std::string unescape (const std::string &str)
 unescape an escaped URI string.

Private Member Functions

void parseAuthorityAndPathUsingOpaque ()

Private Attributes

std::string mScheme
std::string mEscapedOpaque
std::string mEscapedAuthority
std::string mEscapedPath
std::string mEscapedQuery


Detailed Description

LLURI instances are immutable See: http://www.ietf.org/rfc/rfc3986.txt

Definition at line 49 of file lluri.h.


Constructor & Destructor Documentation

LLURI::LLURI (  ) 

Definition at line 178 of file lluri.cpp.

Referenced by buildHTTP().

Here is the caller graph for this function:

LLURI::LLURI ( const std::string &  escaped_str  ) 

Definition at line 182 of file lluri.cpp.

References mEscapedOpaque, mEscapedPath, mEscapedQuery, mScheme, and parseAuthorityAndPathUsingOpaque().

Here is the call graph for this function:

LLURI::LLURI ( const std::string &  scheme,
const std::string &  userName,
const std::string &  password,
const std::string &  hostName,
U16  hostPort,
const std::string &  escapedPath,
const std::string &  escapedQuery 
)

Definition at line 268 of file lluri.cpp.

References escape(), isDefault(), mEscapedAuthority, mEscapedOpaque, and opaque().

Here is the call graph for this function:

LLURI::~LLURI (  ) 

Definition at line 305 of file lluri.cpp.


Member Function Documentation

LLURI LLURI::buildHTTP ( const std::string &  prefix,
const LLSD path 
) [static]

LLURI LLURI::buildHTTP ( const std::string &  prefix,
const LLSD path,
const LLSD query 
) [static]

prefix is either a full URL prefix of the form "http://example.com:8080", or it can be simply a host and optional port like "example.com" or "example.com:8080", in these cases, the "http://" will be added

Definition at line 358 of file lluri.cpp.

References buildHTTP(), mapToQueryString(), mEscapedOpaque, and mEscapedQuery.

Here is the call graph for this function:

LLURI LLURI::buildHTTP ( const std::string &  host,
const U32 port,
const LLSD path 
) [static]

Definition at line 371 of file lluri.cpp.

References buildHTTP(), and llformat().

Here is the call graph for this function:

LLURI LLURI::buildHTTP ( const std::string &  host,
const U32 port,
const LLSD path,
const LLSD query 
) [static]

Definition at line 379 of file lluri.cpp.

References buildHTTP(), and llformat().

Here is the call graph for this function:

std::string LLURI::asString (  )  const

the whole URI, escaped as needed

Definition at line 387 of file lluri.cpp.

References mEscapedOpaque, and mScheme.

Referenced by tut::ensure_equals(), LLHTTPClient::get(), LLAres::UriRewriteResponder::queryError(), LLAres::UriRewriteResponder::queryResult(), and update_dialog_callback().

Here is the caller graph for this function:

std::string LLURI::scheme (  )  const

ex.: "http", note lack of colon

Definition at line 399 of file lluri.cpp.

References mScheme.

Referenced by tut::URITestData::checkParts(), cursor_from_parcel_media(), handle_click_action_open_media(), LLFloaterURLEntry::onBtnOK(), LLViewerMediaImpl::play(), LLAres::UriRewriteResponder::queryResult(), and LLAres::rewriteURI().

Here is the caller graph for this function:

std::string LLURI::opaque (  )  const

everything after the colon

Definition at line 404 of file lluri.cpp.

References mEscapedOpaque, and unescape().

Referenced by tut::URITestData::checkParts(), and LLURI().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::authority (  )  const

Definition at line 409 of file lluri.cpp.

References mEscapedAuthority, and unescape().

Referenced by tut::URITestData::checkParts().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::hostName (  )  const

Definition at line 447 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and unescape().

Referenced by LLAres::rewriteURI().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::userName (  )  const

Definition at line 454 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and unescape().

Referenced by LLAres::UriRewriteResponder::queryResult().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::password (  )  const

Definition at line 466 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and unescape().

Referenced by LLAres::UriRewriteResponder::queryResult().

Here is the call graph for this function:

Here is the caller graph for this function:

U16 LLURI::hostPort (  )  const

Definition at line 483 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and mScheme.

Referenced by defaultPort(), and LLAres::UriRewriteResponder::queryResult().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL LLURI::defaultPort (  )  const

Definition at line 478 of file lluri.cpp.

References hostPort(), isDefault(), and mScheme.

Referenced by LLAres::UriRewriteResponder::queryResult().

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& LLURI::escapedPath (  )  const [inline]

Definition at line 108 of file lluri.h.

References mEscapedPath.

Referenced by LLAres::UriRewriteResponder::queryResult().

Here is the caller graph for this function:

std::string LLURI::path (  )  const

Definition at line 500 of file lluri.cpp.

References mEscapedPath, and unescape().

Referenced by tut::URITestData::checkParts().

Here is the call graph for this function:

Here is the caller graph for this function:

LLSD LLURI::pathArray (  )  const

Definition at line 505 of file lluri.cpp.

References LLSD::append(), and mEscapedPath.

Referenced by LLURLDispatcherImpl::dispatchApp().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::query (  )  const

Definition at line 521 of file lluri.cpp.

References mEscapedQuery, and unescape().

Referenced by tut::URITestData::checkParts().

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& LLURI::escapedQuery (  )  const [inline]

Definition at line 112 of file lluri.h.

References mEscapedQuery.

Referenced by LLAres::UriRewriteResponder::queryResult().

Here is the caller graph for this function:

LLSD LLURI::queryMap (  )  const

Definition at line 526 of file lluri.cpp.

References mEscapedQuery.

Referenced by LLURLDispatcherImpl::dispatchApp(), LLPanelLogin::loadLoginPage(), and LLLoginHandler::parseDirectLogin().

Here is the caller graph for this function:

LLSD LLURI::queryMap ( std::string  escaped_query_string  )  [static]

Definition at line 532 of file lluri.cpp.

References LLSD::emptyArray(), lldebugs, llendl, and unescape().

Here is the call graph for this function:

std::string LLURI::mapToQueryString ( const LLSD query_map  )  [static]

given a name value map, return a serialized query string.

Parameters:
query_map a map of name value. every value must be representable as a string.
Returns:
Returns an url query string of '?n1=v1&n2=v2&...'

Definition at line 572 of file lluri.cpp.

References LLSD::beginMap(), LLSD::endMap(), escapeQueryValue(), escapeQueryVariable(), and LLSD::isMap().

Referenced by buildHTTP(), and LLServiceBuilder::buildServiceURI().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::escape ( const std::string &  str  )  [static]

Escape a raw url with a reasonable set of allowed characters.

The default set was chosen to match HTTP urls and general guidelines for naming resources. Passing in a raw url does not produce well defined results because you really need to know which segments are path parts because path parts are supposed to be escaped individually. The default set chosen is:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 0123456789 -._~ :@!$'()*+,=/?&#;

*NOTE: This API is basically broken because it does not allow you to specify significant path characters. For example, if the filename actually contained a /, then you cannot use this function to generate the serialized url for that resource.

Parameters:
str The raw URI to escape.
Returns:
Returns the escaped uri or an empty string.

Definition at line 166 of file lluri.cpp.

References unreserved().

Referenced by LLPanelDirFind::buildSearchURL(), escape(), escapeHostAndPort(), escapePathComponent(), escapeQueryValue(), escapeQueryVariable(), tut::URITestData::escapeRoundTrip(), LLPanelDirFind::getSearchURLSuffix(), LLURI(), and LLVoiceClient::sessionCreateSendMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string LLURI::escape ( const std::string &  str,
const std::string &  allowed,
bool  is_allowed_sorted = false 
) [static]

Escape a string with a specified set of allowed characters.

Escape a string by urlencoding all the characters that aren't in the allowed string.

Parameters:
str The raw URI to escape.
allowed Character array of allowed characters
is_allowed_sorted Optimization hint if allowed array is sorted.
Returns:
Returns the escaped uri or an empty string.

Definition at line 55 of file lluri.cpp.

References encode_character(), and escape().

Here is the call graph for this function:

std::string LLURI::unescape ( const std::string &  str  )  [static]

unescape an escaped URI string.

Parameters:
str The escped URI to unescape.
Returns:
Returns the unescaped uri or an empty string.

Definition at line 113 of file lluri.cpp.

References hex_as_nybble().

Referenced by authority(), tut::URITestData::escapeRoundTrip(), hostName(), opaque(), password(), path(), query(), queryMap(), and userName().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLURI::parseAuthorityAndPathUsingOpaque (  )  [private]

Definition at line 220 of file lluri.cpp.

References mEscapedAuthority, mEscapedOpaque, mEscapedPath, and mScheme.

Referenced by LLURI().

Here is the caller graph for this function:


Member Data Documentation

std::string LLURI::mScheme [private]

std::string LLURI::mEscapedOpaque [private]

Definition at line 184 of file lluri.h.

Referenced by asString(), buildHTTP(), LLURI(), opaque(), and parseAuthorityAndPathUsingOpaque().

std::string LLURI::mEscapedAuthority [private]

std::string LLURI::mEscapedPath [private]

std::string LLURI::mEscapedQuery [private]

Definition at line 187 of file lluri.h.

Referenced by buildHTTP(), escapedQuery(), LLURI(), query(), and queryMap().


The documentation for this class was generated from the following files:

Generated on Fri May 16 09:20:19 2008 for SecondLife by  doxygen 1.5.5