aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/lluri.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:04 -0500
committerJacek Antonelli2008-08-15 23:45:04 -0500
commit117e22047c5752352342d64e3fb7ce00a4eb8113 (patch)
treee32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/llcommon/lluri.h
parentSecond Life viewer sources 1.18.0.6 (diff)
downloadmeta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz
Second Life viewer sources 1.18.1.2
Diffstat (limited to 'linden/indra/llcommon/lluri.h')
-rw-r--r--linden/indra/llcommon/lluri.h97
1 files changed, 56 insertions, 41 deletions
diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h
index 3f24799..1044c48 100644
--- a/linden/indra/llcommon/lluri.h
+++ b/linden/indra/llcommon/lluri.h
@@ -58,34 +58,42 @@ public:
58 58
59 // construct from escaped string, as would be transmitted on the net 59 // construct from escaped string, as would be transmitted on the net
60 60
61 ~LLURI(); 61 ~LLURI();
62 62
63 static LLURI buildHTTP(const std::string& prefix, 63 static LLURI buildHTTP(
64 const LLSD& path); 64 const std::string& prefix,
65 static LLURI buildHTTP(const std::string& prefix, 65 const LLSD& path);
66 const LLSD& path,
67 const LLSD& query);
68 // prefix is either a full URL prefix of the form "http://example.com:8080",
69 // or it can be simply a host and optional port like "example.com" or
70 // "example.com:8080", in these cases, the "http://" will be added
71 66
72 static LLURI buildHTTP(const std::string& host, 67 static LLURI buildHTTP(
73 const U32& port, 68 const std::string& prefix,
74 const LLSD& path); 69 const LLSD& path,
75 static LLURI buildHTTP(const std::string& host, 70 const LLSD& query);
76 const U32& port, 71 ///< prefix is either a full URL prefix of the form
77 const LLSD& path, 72 /// "http://example.com:8080", or it can be simply a host and
78 const LLSD& query); 73 /// optional port like "example.com" or "example.com:8080", in
79 std::string asString() const; 74 /// these cases, the "http://" will be added
80 // the whole URI, escaped as needed 75
76 static LLURI buildHTTP(
77 const std::string& host,
78 const U32& port,
79 const LLSD& path);
80 static LLURI buildHTTP(
81 const std::string& host,
82 const U32& port,
83 const LLSD& path,
84 const LLSD& query);
85
86 std::string asString() const;
87 ///< the whole URI, escaped as needed
81 88
82 // Parts of a URI 89 /** @name Parts of a URI */
83 // These functions return parts of the decoded URI. The returned 90 //@{
84 // strings are un-escaped as needed 91 // These functions return parts of the decoded URI. The returned
92 // strings are un-escaped as needed
85 93
86 // for all schemes 94 // for all schemes
87 std::string scheme() const; // ex.: "http", note lack of colon 95 std::string scheme() const; ///< ex.: "http", note lack of colon
88 std::string opaque() const; // everything after the colon 96 std::string opaque() const; ///< everything after the colon
89 97
90 // for schemes that follow path like syntax (http, https, ftp) 98 // for schemes that follow path like syntax (http, https, ftp)
91 std::string authority() const; // ex.: "host.com:80" 99 std::string authority() const; // ex.: "host.com:80"
@@ -101,27 +109,34 @@ public:
101 const std::string& escapedQuery() const { return mEscapedQuery; } 109 const std::string& escapedQuery() const { return mEscapedQuery; }
102 LLSD queryMap() const; // above decoded into a map 110 LLSD queryMap() const; // above decoded into a map
103 static LLSD queryMap(std::string escaped_query_string); 111 static LLSD queryMap(std::string escaped_query_string);
104 static std::string mapToQueryString(const LLSD& queryMap);
105 112
106 // Escaping Utilities 113 /**
107 // Escape a string by urlencoding all the characters that aren't in the allowed string. 114 * @brief given a name value map, return a serialized query string.
108 static std::string escape(const std::string& str); 115 *
109 static std::string escape(const std::string& str, const std::string & allowed); 116
110 static std::string unescape(const std::string& str); 117 * @param query_map a map of name value. every value must be
118 * representable as a string.
119 * @return Returns an url query string of '?n1=v1&n2=v2&...'
120 */
121 static std::string mapToQueryString(const LLSD& query_map);
111 122
112 // Functions for building specific URIs for web services 123 /** @name Escaping Utilities */
113 // *NOTE: DEPRECATED. use the service builder instead. 124 //@{
114 //static LLURI buildBulkAgentNamesURI(LLApp* app); 125 // Escape a string by urlencoding all the characters that aren't
115 //static LLURI buildAgentSessionURI(const LLUUID& agent_id, LLApp* app); 126 // in the allowed string.
116 //static LLURI buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver); 127 static std::string escape(const std::string& str);
117 //static LLURI buildAgentNameURI(const LLUUID& agent_id, LLApp* app); 128 static std::string escape(
129 const std::string& str,
130 const std::string & allowed);
131 static std::string unescape(const std::string& str);
132 //@}
118 133
119private: 134private:
120 std::string mScheme; 135 std::string mScheme;
121 std::string mEscapedOpaque; 136 std::string mEscapedOpaque;
122 std::string mEscapedAuthority; 137 std::string mEscapedAuthority;
123 std::string mEscapedPath; 138 std::string mEscapedPath;
124 std::string mEscapedQuery; 139 std::string mEscapedQuery;
125}; 140};
126 141
127#endif // LL_LLURI_H 142#endif // LL_LLURI_H