mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
cosmetics
This commit is contained in:
@@ -582,25 +582,36 @@ namespace OpenSim.Framework
|
||||
|
||||
/// <summary>
|
||||
/// Convert a NameValueCollection into a query string. This is the
|
||||
/// inverse of HttpUtility.ParseQueryString()
|
||||
/// not exactly the inverse of HttpUtility.ParseQueryString()
|
||||
/// </summary>
|
||||
/// <param name="parameters">Collection of key/value pairs to convert</param>
|
||||
/// <returns>A query string with URL-escaped values</returns>
|
||||
public static string BuildQueryString(NameValueCollection parameters)
|
||||
{
|
||||
List<string> items = new List<string>(parameters.Count);
|
||||
if (parameters.Count == 0)
|
||||
return string.Empty;
|
||||
|
||||
StringBuilder sb = new StringBuilder(4096);
|
||||
foreach (string key in parameters.Keys)
|
||||
{
|
||||
string[] values = parameters.GetValues(key);
|
||||
if (values != null)
|
||||
{
|
||||
foreach (string value in values)
|
||||
items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty)));
|
||||
{
|
||||
sb.Append(key);
|
||||
sb.Append("=");
|
||||
if(!string.IsNullOrWhiteSpace(value))
|
||||
sb.Append(HttpUtility.UrlEncode(value));
|
||||
sb.Append("&");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return String.Join("&", items.ToArray());
|
||||
if(sb.Length > 1)
|
||||
sb.Length--;
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1097,9 +1108,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public class SynchronousRestObjectRequester
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
|
||||
Reference in New Issue
Block a user