aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-12-27 21:46:16 +0000
committerMelanie2009-12-27 21:46:16 +0000
commit0f5219a004f38792757464d17a9481444e1ac696 (patch)
tree0e14f24b38ff77d0bec9010f9f4f8b52fccc72a3
parentRemove the sesion from returned presence info (diff)
downloadopensim-SC_OLD-0f5219a004f38792757464d17a9481444e1ac696.zip
opensim-SC_OLD-0f5219a004f38792757464d17a9481444e1ac696.tar.gz
opensim-SC_OLD-0f5219a004f38792757464d17a9481444e1ac696.tar.bz2
opensim-SC_OLD-0f5219a004f38792757464d17a9481444e1ac696.tar.xz
Allow lists to be embedded in query strings
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs63
1 files changed, 53 insertions, 10 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 413a078..a5d28a4 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -180,7 +180,31 @@ namespace OpenSim.Server.Base
180 if (elems.Length > 1) 180 if (elems.Length > 1)
181 value = System.Web.HttpUtility.UrlDecode(elems[1]); 181 value = System.Web.HttpUtility.UrlDecode(elems[1]);
182 182
183 result[name] = value; 183 if (name.EndsWith("[]"))
184 {
185 if (result.ContainsKey(name))
186 {
187 if (!(result[name] is List<string>))
188 continue;
189
190 List<string> l = (List<string>)result[name];
191
192 l.Add(value);
193 }
194 else
195 {
196 List<string> newList = new List<string>();
197
198 newList.Add(value);
199
200 result[name] = newList;
201 }
202 }
203 else
204 {
205 if (!result.ContainsKey(name))
206 result[name] = value;
207 }
184 } 208 }
185 209
186 return result; 210 return result;
@@ -190,23 +214,42 @@ namespace OpenSim.Server.Base
190 { 214 {
191 string qstring = String.Empty; 215 string qstring = String.Empty;
192 216
217 string part;
218
193 foreach (KeyValuePair<string, object> kvp in data) 219 foreach (KeyValuePair<string, object> kvp in data)
194 { 220 {
195 string part; 221 if (kvp.Value is List<string>)
196 if (kvp.Value.ToString() != String.Empty)
197 { 222 {
198 part = System.Web.HttpUtility.UrlEncode(kvp.Key) + 223 List<string> l = (List<String>)kvp.Value;
199 "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); 224
225 foreach (string s in l)
226 {
227 part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
228 "[]=" + System.Web.HttpUtility.UrlEncode(s);
229
230 if (qstring != String.Empty)
231 qstring += "&";
232
233 qstring += part;
234 }
200 } 235 }
201 else 236 else
202 { 237 {
203 part = System.Web.HttpUtility.UrlEncode(kvp.Key); 238 if (kvp.Value.ToString() != String.Empty)
204 } 239 {
240 part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
241 "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
242 }
243 else
244 {
245 part = System.Web.HttpUtility.UrlEncode(kvp.Key);
246 }
205 247
206 if (qstring != String.Empty) 248 if (qstring != String.Empty)
207 qstring += "&"; 249 qstring += "&";
208 250
209 qstring += part; 251 qstring += part;
252 }
210 } 253 }
211 254
212 return qstring; 255 return qstring;