change osrequest Query back to hashtable, add QueryAsDictionary as new better option. (recover compatibily with current external modules
parent
745a469af8
commit
e0ba96055c
|
@ -51,7 +51,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
bool IsSecured { get; }
|
||||
bool KeepAlive { get; }
|
||||
NameValueCollection QueryString { get; }
|
||||
Dictionary<string, string> Query { get; }
|
||||
Hashtable Query { get; }
|
||||
Dictionary<string, string> QueryAsDictionary { get; } //faster than Query
|
||||
string RawUrl { get; }
|
||||
IPEndPoint RemoteIPEndPoint { get; }
|
||||
Uri Url { get; }
|
||||
|
|
|
@ -123,17 +123,28 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
get { return _request.QueryString;}
|
||||
}
|
||||
|
||||
public Dictionary<string,string> Query
|
||||
private Hashtable _queryAsHashtable = null;
|
||||
public Hashtable Query
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_queryKeyValues == null)
|
||||
BuildQueryDictionary();
|
||||
return _queryKeyValues;
|
||||
if (_queryAsHashtable == null)
|
||||
BuildQueryHashtable();
|
||||
return _queryAsHashtable;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, string> _queryKeyValues = null;
|
||||
//faster than Query
|
||||
private Dictionary<string, string> _queryAsDictionay = null;
|
||||
public Dictionary<string,string> QueryAsDictionary
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_queryAsDictionay == null)
|
||||
BuildQueryDictionary();
|
||||
return _queryAsDictionay;
|
||||
}
|
||||
}
|
||||
|
||||
/// <value>
|
||||
/// POST request values, if applicable
|
||||
|
@ -150,6 +161,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
get { return _request.RemoteIPEndPoint; }
|
||||
}
|
||||
|
||||
public IPEndPoint LocalIPEndPoint
|
||||
{
|
||||
get { return _request.LocalIPEndPoint; }
|
||||
}
|
||||
|
||||
public Uri Url
|
||||
{
|
||||
get { return _request.Uri; }
|
||||
|
@ -216,19 +232,35 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
private void BuildQueryDictionary()
|
||||
{
|
||||
NameValueCollection q = _request.QueryString;
|
||||
_queryKeyValues = new Dictionary<string, string>(); // only key value pairs
|
||||
_queryAsDictionay = new Dictionary<string, string>(); // only key value pairs
|
||||
for(int i = 0; i <q.Count; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
var name = q.GetKey(i);
|
||||
if(!string.IsNullOrEmpty(name))
|
||||
_queryKeyValues[name] = q[i];
|
||||
_queryAsDictionay[name] = q[i];
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildQueryHashtable()
|
||||
{
|
||||
NameValueCollection q = _request.QueryString;
|
||||
_queryAsHashtable = new Hashtable();
|
||||
for (int i = 0; i < q.Count; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
var name = q.GetKey(i);
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
_queryAsDictionay[name] = q[i];
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder me = new StringBuilder();
|
||||
|
|
|
@ -137,11 +137,19 @@ namespace OpenSim.Tests.Common
|
|||
}
|
||||
}
|
||||
|
||||
public Dictionary<string,string> Query
|
||||
public Hashtable Query
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, string> QueryAsDictionary
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue