rearranging variables in OSHttpRequest and adding Query property.

0.6.0-stable
Dr Scofield 2008-07-17 16:51:23 +00:00
parent e8412dcd42
commit 6ca23c1123
1 changed files with 45 additions and 22 deletions

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Net; using System.Net;
@ -37,131 +38,150 @@ namespace OpenSim.Framework.Servers
{ {
public class OSHttpRequest public class OSHttpRequest
{ {
/// <remarks>
/// soon to be deprecated
/// </remarks>
private string[] _acceptTypes;
private Encoding _contentEncoding;
private long _contentLength64;
private string _contentType;
// private CookieCollection _cookies;
private NameValueCollection _headers;
private string _httpMethod;
private Stream _inputStream;
// private bool _isSecureConnection;
// private bool _isAuthenticated;
private bool _keepAlive;
private bool _hasbody;
private string _rawUrl;
private Uri _url;
private NameValueCollection _queryString;
private string _userAgent;
private IPEndPoint _ipEndPoint;
private HttpRequest _request;
private HttpClientContext _context;
public string[] AcceptTypes public string[] AcceptTypes
{ {
get { return _acceptTypes; } get { return _acceptTypes; }
} }
private string[] _acceptTypes;
public Encoding ContentEncoding public Encoding ContentEncoding
{ {
get { return _contentEncoding; } get { return _contentEncoding; }
} }
private Encoding _contentEncoding;
public long ContentLength public long ContentLength
{ {
get { return _contentLength64; } get { return _contentLength64; }
} }
private long _contentLength64;
public long ContentLength64 public long ContentLength64
{ {
get { return ContentLength; } get { return ContentLength; }
} }
public string ContentType public string ContentType
{ {
get { return _contentType; } get { return _contentType; }
} }
private string _contentType;
// public CookieCollection Cookies // public CookieCollection Cookies
// { // {
// get { return _cookies; } // get { return _cookies; }
// } // }
// private CookieCollection _cookies;
public NameValueCollection Headers public NameValueCollection Headers
{ {
get { return _headers; } get { return _headers; }
} }
private NameValueCollection _headers;
public string HttpMethod public string HttpMethod
{ {
get { return _httpMethod; } get { return _httpMethod; }
} }
private string _httpMethod;
public Stream InputStream public Stream InputStream
{ {
get { return _inputStream; } get { return _inputStream; }
} }
private Stream _inputStream;
// public bool IsSecureConnection // public bool IsSecureConnection
// { // {
// get { return _isSecureConnection; } // get { return _isSecureConnection; }
// } // }
// private bool _isSecureConnection;
// public bool IsAuthenticated // public bool IsAuthenticated
// { // {
// get { return _isAuthenticated; } // get { return _isAuthenticated; }
// } // }
// private bool _isAuthenticated;
public bool HasEntityBody public bool HasEntityBody
{ {
get { return _hasbody; } get { return _hasbody; }
} }
private bool _hasbody;
public bool KeepAlive public bool KeepAlive
{ {
get { return _keepAlive; } get { return _keepAlive; }
} }
private bool _keepAlive;
public string RawUrl public string RawUrl
{ {
get { return _rawUrl; } get { return _rawUrl; }
} }
private string _rawUrl;
public Uri Url public Uri Url
{ {
get { return _url; } get { return _url; }
} }
private Uri _url;
public string UserAgent public string UserAgent
{ {
get { return _userAgent; } get { return _userAgent; }
} }
private string _userAgent;
public NameValueCollection QueryString public NameValueCollection QueryString
{ {
get { return _queryString; } get { return _queryString; }
} }
private NameValueCollection _queryString;
public Hashtable Query
{
get { return _query; }
}
private Hashtable _query;
public IPEndPoint RemoteIPEndPoint public IPEndPoint RemoteIPEndPoint
{ {
get { return _ipEndPoint; } get { return _ipEndPoint; }
} }
private IPEndPoint _ipEndPoint;
internal HttpRequest HttpRequest internal HttpRequest HttpRequest
{ {
get { return _request; } get { return _request; }
} }
private HttpRequest _request;
internal HttpClientContext HttpClientContext internal HttpClientContext HttpClientContext
{ {
get { return _context; } get { return _context; }
} }
private HttpClientContext _context;
/// <summary> /// <summary>
/// Internal whiteboard for handlers to store temporary stuff /// Internal whiteboard for handlers to store temporary stuff
@ -178,6 +198,7 @@ namespace OpenSim.Framework.Servers
{ {
} }
public OSHttpRequest(HttpListenerRequest req) public OSHttpRequest(HttpListenerRequest req)
{ {
_acceptTypes = req.AcceptTypes; _acceptTypes = req.AcceptTypes;
@ -221,9 +242,11 @@ namespace OpenSim.Framework.Servers
if (null != req.Headers["user-agent"]) if (null != req.Headers["user-agent"])
_userAgent = req.Headers["user-agent"]; _userAgent = req.Headers["user-agent"];
_queryString = new NameValueCollection(); _queryString = new NameValueCollection();
_query = new Hashtable();
foreach (KeyValuePair<string, HttpInputItem> q in req.QueryString) foreach (KeyValuePair<string, HttpInputItem> q in req.QueryString)
{ {
_queryString.Add(q.Key, q.Value.Value); _queryString.Add(q.Key, q.Value.Value);
_query[q.Key] = q.Value.Value;
} }
// TODO: requires change to HttpServer.HttpRequest // TODO: requires change to HttpServer.HttpRequest
_ipEndPoint = null; _ipEndPoint = null;