diff options
author | Tess Chu <tess@lindenlab.com> | 2007-11-15 22:39:12 +0000 |
---|---|---|
committer | Tess Chu <tess@lindenlab.com> | 2007-11-15 22:39:12 +0000 |
commit | 813b140d0767146b17acf4ad2fb96fbd5a347c34 (patch) | |
tree | d47a36708813b3f93b4049d822f966c48de4e576 /indra/llcommon | |
parent | 291d99bc66c4c2b8009ba723a43e2e97d24313f9 (diff) |
svn merge -r73880:73879 svn+ssh://svn/svn/linden/release. backing out viewer auth merge
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lluri.cpp | 69 | ||||
-rw-r--r-- | indra/llcommon/lluri.h | 7 |
2 files changed, 21 insertions, 55 deletions
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 5e4dec7f82..df790433df 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -40,8 +40,6 @@ #include "../llmath/lluuid.h" -// system includes -#include <boost/tokenizer.hpp> // static std::string LLURI::escape(const std::string& str, const std::string & allowed) @@ -132,7 +130,7 @@ LLURI::LLURI() LLURI::LLURI(const std::string& escaped_str) { - std::string::size_type delim_pos; + std::string::size_type delim_pos, delim_pos2; delim_pos = escaped_str.find(':'); std::string temp; if (delim_pos == std::string::npos) @@ -146,39 +144,13 @@ LLURI::LLURI(const std::string& escaped_str) mEscapedOpaque = escaped_str.substr(delim_pos+1); } - parseAuthorityAndPathUsingOpaque(); - - delim_pos = mEscapedPath.find('?'); - if (delim_pos != std::string::npos) - { - mEscapedQuery = mEscapedPath.substr(delim_pos+1); - mEscapedPath = mEscapedPath.substr(0,delim_pos); - } -} - -static BOOL isDefault(const std::string& scheme, U16 port) -{ - if (scheme == "http") - return port == 80; - if (scheme == "https") - return port == 443; - if (scheme == "ftp") - return port == 21; - - return FALSE; -} - -void LLURI::parseAuthorityAndPathUsingOpaque() -{ - if (mScheme == "http" || mScheme == "https" || - mScheme == "ftp" || mScheme == "secondlife" ) + if (mScheme == "http" || mScheme == "https" || mScheme == "ftp") { if (mEscapedOpaque.substr(0,2) != "//") { return; } - - std::string::size_type delim_pos, delim_pos2; + delim_pos = mEscapedOpaque.find('/', 2); delim_pos2 = mEscapedOpaque.find('?', 2); // no path, no query @@ -210,12 +182,27 @@ void LLURI::parseAuthorityAndPathUsingOpaque() mEscapedPath = mEscapedOpaque.substr(delim_pos); } } - else if (mScheme == "about") + + delim_pos = mEscapedPath.find('?'); + if (delim_pos != std::string::npos) { - mEscapedPath = mEscapedOpaque; + mEscapedQuery = mEscapedPath.substr(delim_pos+1); + mEscapedPath = mEscapedPath.substr(0,delim_pos); } } +static BOOL isDefault(const std::string& scheme, U16 port) +{ + if (scheme == "http") + return port == 80; + if (scheme == "https") + return port == 443; + if (scheme == "ftp") + return port == 21; + + return FALSE; +} + LLURI::LLURI(const std::string& scheme, const std::string& userName, const std::string& password, @@ -453,22 +440,6 @@ std::string LLURI::path() const return unescape(mEscapedPath); } -LLSD LLURI::pathArray() const -{ - typedef boost::tokenizer<boost::char_separator<char> > tokenizer; - boost::char_separator<char> sep("/", "", boost::drop_empty_tokens); - tokenizer tokens(mEscapedPath, sep); - tokenizer::iterator it = tokens.begin(); - tokenizer::iterator end = tokens.end(); - - LLSD params; - for ( ; it != end; ++it) - { - params.append(*it); - } - return params; -} - std::string LLURI::query() const { return unescape(mEscapedQuery); diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index bfe673c2f7..3246dcd81f 100644 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h @@ -107,7 +107,7 @@ public: BOOL defaultPort() const; // true if port is default for scheme const std::string& escapedPath() const { return mEscapedPath; } std::string path() const; // ex.: "/abc/def", includes leading slash - LLSD pathArray() const; // above decoded into an array of strings + // LLSD pathArray() const; // above decoded into an array of strings std::string query() const; // ex.: "x=34", section after "?" const std::string& escapedQuery() const { return mEscapedQuery; } LLSD queryMap() const; // above decoded into a map @@ -135,11 +135,6 @@ public: //@} private: - // only "http", "https", "ftp", and "secondlife" schemes are parsed - // secondlife scheme parses authority as "" and includes it as part of - // the path. See lluri_tut.cpp - // i.e. secondlife://app/login has mAuthority = "" and mPath = "/app/login" - void parseAuthorityAndPathUsingOpaque(); std::string mScheme; std::string mEscapedOpaque; std::string mEscapedAuthority; |