Allow lists to be embedded in query strings
							parent
							
								
									2f717fc796
								
							
						
					
					
						commit
						0f5219a004
					
				| 
						 | 
				
			
			@ -180,7 +180,31 @@ namespace OpenSim.Server.Base
 | 
			
		|||
                if (elems.Length > 1)
 | 
			
		||||
                    value = System.Web.HttpUtility.UrlDecode(elems[1]);
 | 
			
		||||
 | 
			
		||||
                result[name] = value;
 | 
			
		||||
                if (name.EndsWith("[]"))
 | 
			
		||||
                {
 | 
			
		||||
                    if (result.ContainsKey(name))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (!(result[name] is List<string>))
 | 
			
		||||
                            continue;
 | 
			
		||||
 | 
			
		||||
                        List<string> l = (List<string>)result[name];
 | 
			
		||||
 | 
			
		||||
                        l.Add(value);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        List<string> newList = new List<string>();
 | 
			
		||||
 | 
			
		||||
                        newList.Add(value);
 | 
			
		||||
 | 
			
		||||
                        result[name] = newList;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    if (!result.ContainsKey(name))
 | 
			
		||||
                        result[name] = value;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
| 
						 | 
				
			
			@ -190,23 +214,42 @@ namespace OpenSim.Server.Base
 | 
			
		|||
        {
 | 
			
		||||
            string qstring = String.Empty;
 | 
			
		||||
 | 
			
		||||
            string part;
 | 
			
		||||
 | 
			
		||||
            foreach (KeyValuePair<string, object> kvp in data)
 | 
			
		||||
            {
 | 
			
		||||
                string part;
 | 
			
		||||
                if (kvp.Value.ToString() != String.Empty)
 | 
			
		||||
                if (kvp.Value is List<string>)
 | 
			
		||||
                {
 | 
			
		||||
                    part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
 | 
			
		||||
                            "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
 | 
			
		||||
                    List<string> l = (List<String>)kvp.Value;
 | 
			
		||||
 | 
			
		||||
                    foreach (string s in l)
 | 
			
		||||
                    {
 | 
			
		||||
                        part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
 | 
			
		||||
                                "[]=" + System.Web.HttpUtility.UrlEncode(s);
 | 
			
		||||
 | 
			
		||||
                        if (qstring != String.Empty)
 | 
			
		||||
                            qstring += "&";
 | 
			
		||||
 | 
			
		||||
                        qstring += part;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    part = System.Web.HttpUtility.UrlEncode(kvp.Key);
 | 
			
		||||
                    if (kvp.Value.ToString() != String.Empty)
 | 
			
		||||
                    {
 | 
			
		||||
                        part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
 | 
			
		||||
                                "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        part = System.Web.HttpUtility.UrlEncode(kvp.Key);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (qstring != String.Empty)
 | 
			
		||||
                        qstring += "&";
 | 
			
		||||
 | 
			
		||||
                    qstring += part;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (qstring != String.Empty)
 | 
			
		||||
                    qstring += "&";
 | 
			
		||||
 | 
			
		||||
                qstring += part;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return qstring;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue