aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/lluri.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/lluri.h')
-rw-r--r--linden/indra/llcommon/lluri.h50
1 files changed, 45 insertions, 5 deletions
diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h
index d67051a..d6d235d 100644
--- a/linden/indra/llcommon/lluri.h
+++ b/linden/indra/llcommon/lluri.h
@@ -14,12 +14,12 @@
14 * ("GPL"), unless you have obtained a separate licensing agreement 14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of 15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or 16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlife.com/developers/opensource/gplv2 17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 * 18 *
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlife.com/developers/opensource/flossexception 22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 23 *
24 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -125,12 +125,52 @@ public:
125 125
126 /** @name Escaping Utilities */ 126 /** @name Escaping Utilities */
127 //@{ 127 //@{
128 // Escape a string by urlencoding all the characters that aren't 128 /**
129 // in the allowed string. 129 * @brief Escape a raw url with a reasonable set of allowed characters.
130 *
131 * The default set was chosen to match HTTP urls and general
132 * guidelines for naming resources. Passing in a raw url does not
133 * produce well defined results because you really need to know
134 * which segments are path parts because path parts are supposed
135 * to be escaped individually. The default set chosen is:
136 *
137 * ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
138 * 0123456789
139 * -._~
140 * :@!$'()*+,=/?&#;
141 *
142 * *NOTE: This API is basically broken because it does not
143 * allow you to specify significant path characters. For example,
144 * if the filename actually contained a /, then you cannot use
145 * this function to generate the serialized url for that
146 * resource.
147 *
148 * @param str The raw URI to escape.
149 * @return Returns the escaped uri or an empty string.
150 */
130 static std::string escape(const std::string& str); 151 static std::string escape(const std::string& str);
152
153 /**
154 * @brief Escape a string with a specified set of allowed characters.
155 *
156 * Escape a string by urlencoding all the characters that aren't
157 * in the allowed string.
158 * @param str The raw URI to escape.
159 * @param allowed Character array of allowed characters
160 * @param is_allowed_sorted Optimization hint if allowed array is sorted.
161 * @return Returns the escaped uri or an empty string.
162 */
131 static std::string escape( 163 static std::string escape(
132 const std::string& str, 164 const std::string& str,
133 const std::string & allowed); 165 const std::string& allowed,
166 bool is_allowed_sorted = false);
167
168 /**
169 * @brief unescape an escaped URI string.
170 *
171 * @param str The escped URI to unescape.
172 * @return Returns the unescaped uri or an empty string.
173 */
134 static std::string unescape(const std::string& str); 174 static std::string unescape(const std::string& str);
135 //@} 175 //@}
136 176