2002-04-11 Patrik Torstensson <patrik.torstensson@labs2.com>
authorPatrik Torstensson <totte@mono-cvs.ximian.com>
Thu, 11 Apr 2002 13:59:28 +0000 (13:59 -0000)
committerPatrik Torstensson <totte@mono-cvs.ximian.com>
Thu, 11 Apr 2002 13:59:28 +0000 (13:59 -0000)
* HttpException.cs: 95% ready, only windows dependent code left
* HttpFileCollection.cs: Finished.
* HttpRequest.cs: Minor fixes and fixed signature problems
* HttpResponse.cs: Implementation of missing methods and signature problems
* HttpResponseHeader.cs: Fixed signature problems
* HttpRuntime.cs: Fixed signature problems
* HttpServerUtility.cs: Added support for HttpApplication
* HttpSessionState.cs: Fixed signature issues
* HttpUtility.cs: fixed signature issues
* HttpValueCollection.cs: Support for cookie parsing and fixed signature issues
* HttpWorkerRequest.cs: Fixed small signature issue
* HttpWriter.cs: Fixed signature issue
* HttpApplication.cs: Basic implementation
* HttpApplicationState.cs: Small fixes to support major change comming up
* HttpBrowserCapabilities.cs: Added Type method
* HttpClientCertificate.cs: Almost ready, needs to parse certificate.
* HttpContext.cs: Fixed signature issues and added last methods.
* HttpCookie.cs: Full implementation
* HttpCookieCollection.cs: Full implementation
* TraceContext.cs: Methods implemented.
* HttpPostedFile.cs: Placeholder
* HttpStaticObjectsCollection.cs: Placeholder
* HttpModuleCollection.cs: Ready, will be used during the major revamp.

* Fixed a number of other small signature problems also (class status page)

svn path=/trunk/mcs/; revision=3762

23 files changed:
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpApplication.cs
mcs/class/System.Web/System.Web/HttpApplicationState.cs
mcs/class/System.Web/System.Web/HttpBrowserCapabilites.cs
mcs/class/System.Web/System.Web/HttpClientCertificate.cs
mcs/class/System.Web/System.Web/HttpContext.cs
mcs/class/System.Web/System.Web/HttpCookie.cs
mcs/class/System.Web/System.Web/HttpCookieCollection.cs
mcs/class/System.Web/System.Web/HttpException.cs
mcs/class/System.Web/System.Web/HttpFileCollection.cs
mcs/class/System.Web/System.Web/HttpRequest.cs
mcs/class/System.Web/System.Web/HttpResponse.cs
mcs/class/System.Web/System.Web/HttpResponseHeader.cs
mcs/class/System.Web/System.Web/HttpRuntime.cs
mcs/class/System.Web/System.Web/HttpServerUtility.cs
mcs/class/System.Web/System.Web/HttpSessionState.cs
mcs/class/System.Web/System.Web/HttpUtility.cs
mcs/class/System.Web/System.Web/HttpValueCollection.cs
mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
mcs/class/System.Web/System.Web/HttpWriter.cs
mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
mcs/class/System.Web/System.Web/TraceContext.cs
mcs/class/System.Web/System.Web/TraceMode.cs

index f6a8ce1cdfa7b080ce3ef6cbba9fb351cdb1a1a9..95dcf92121a7bbb63d2370a7a6fcaec3fca1168e 100644 (file)
@@ -1,3 +1,32 @@
+2002-04-11  Patrik Torstensson <patrik.torstensson@labs2.com>
+
+       * HttpException.cs: 95% ready, only windows dependent code left
+       * HttpFileCollection.cs: Finished.
+       * HttpRequest.cs: Minor fixes and fixed signature problems
+       * HttpResponse.cs: Implementation of missing methods and signature problems
+       * HttpResponseHeader.cs: Fixed signature problems
+       * HttpRuntime.cs: Fixed signature problems
+       * HttpServerUtility.cs: Added support for HttpApplication
+       * HttpSessionState.cs: Fixed signature issues
+       * HttpUtility.cs: fixed signature issues
+       * HttpValueCollection.cs: Support for cookie parsing and fixed signature issues
+       * HttpWorkerRequest.cs: Fixed small signature issue
+       * HttpWriter.cs: Fixed signature issue
+       * HttpApplication.cs: Basic implementation
+       * HttpApplicationState.cs: Small fixes to support major change comming up
+       * HttpBrowserCapabilities.cs: Added Type method
+       * HttpClientCertificate.cs: Almost ready, needs to parse certificate.
+       * HttpContext.cs: Fixed signature issues and added last methods.
+       * HttpCookie.cs: Full implementation
+       * HttpCookieCollection.cs: Full implementation
+       * TraceContext.cs: Methods implemented.
+       * HttpPostedFile.cs: Placeholder
+       * HttpStaticObjectsCollection.cs: Placeholder
+       * HttpModuleCollection.cs: Ready, will be used during the major revamp.
+       
+       * Fixed a number of other small signature problems also (class status page)
+       
+       
 2002-04-10  Patrik Torstensson <patrik.torstensson@labs2.com>
 
     * HttpWorkerRequest.EndOfSendNotification.cs Removed (included in WorkerRequest)
index 7446a591bdb178688106d014e3890299295214b0..21a20a1c1d6d621cc0e931949f9a0e0b5cbe57e9 100644 (file)
 //   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
 //\r
 using System;\r
+using System.ComponentModel;\r
 \r
 namespace System.Web {\r
    [MonoTODO()]\r
-   public class HttpApplication {\r
+   public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable {\r
+      private bool _CompleteRequest;\r
+\r
+      private HttpContext _Context;\r
+      private HttpContext _OverrideContext;\r
+         \r
+      private bool _InPreRequestResponseMode;\r
+\r
+      private ISite _Site;\r
+      private HttpModuleCollection _ModuleCollection;\r
+      private HttpSessionState _Session;\r
+\r
+      public event EventHandler AcquireRequestState;\r
+      public event EventHandler AuthenticateRequest;\r
+      public event EventHandler AuthorizeRequest;\r
+      public event EventHandler BeginRequest;\r
+      public event EventHandler Disposed;\r
+      public event EventHandler EndRequest;\r
+      public event EventHandler Error;\r
+      public event EventHandler PostRequestHandlerExecute;\r
+      public event EventHandler PreRequestHandlerExecute;\r
+      public event EventHandler PreSendRequestContent;\r
+      public event EventHandler PreSendRequestHeaders;\r
+      public event EventHandler ReleaseRequestState;\r
+      public event EventHandler ResolveRequestCache;\r
+      public event EventHandler UpdateRequestCache;\r
+\r
+      [MonoTODO()]\r
       public HttpApplication() {\r
-         //\r
-         // TODO: Add constructor logic here\r
-         //\r
+         // Init HTTP context and the methods from HttpRuntime....\r
+      }\r
+\r
+      internal void ClearError() {\r
+         // Called from Server Utility\r
+      }\r
+\r
+      public HttpContext Context {\r
+         get {\r
+            if (null != _OverrideContext) {\r
+               return _OverrideContext;\r
+            }\r
+\r
+            return _Context;\r
+         }\r
+      }\r
+\r
+      public HttpModuleCollection Modules {\r
+         get {\r
+            if (null == _ModuleCollection) {\r
+               _ModuleCollection = new HttpModuleCollection();\r
+            }\r
+\r
+            return _ModuleCollection;\r
+         }\r
+      }\r
+\r
+      public HttpRequest Request {\r
+         get {\r
+            if (null != _Context && (!_InPreRequestResponseMode)) {\r
+               return _Context.Request;\r
+            }\r
+\r
+            throw new HttpException("Cant get request object");\r
+         }\r
+      }\r
+\r
+      public HttpResponse Response {\r
+         get {\r
+            if (null != _Context && (!_InPreRequestResponseMode)) {\r
+               return _Context.Response;\r
+            }\r
+\r
+            throw new HttpException("Cant get response object");\r
+         }\r
+      }\r
+\r
+      public HttpServerUtility Server {\r
+         get {\r
+            if (null != _Context) {\r
+               return _Context.Server;\r
+            }\r
+\r
+            return new HttpServerUtility(this);\r
+         }\r
+      }\r
+\r
+      public HttpSessionState Session {\r
+         get {\r
+            if (null != _Session) {\r
+               return _Session;\r
+            }\r
+\r
+            if (null != _Context && null != _Context.Session) {\r
+               return _Context.Session;\r
+            }\r
+\r
+            throw new HttpException("Failed to get session object");\r
+         }\r
+      }\r
+\r
+      public virtual string GetVaryByCustomString(HttpContext context, string custom) {\r
+         if (custom.ToLower() == "browser") {\r
+            return context.Request.Browser.Type;\r
+         }\r
+\r
+         return string.Empty;\r
+      }\r
+\r
+      [MonoTODO()]\r
+      IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      void IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      void IHttpHandler.ProcessRequest(HttpContext context) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      bool IHttpHandler.IsReusable {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      public ISite Site {\r
+         get {\r
+            return _Site;\r
+         }\r
+\r
+         set {\r
+            _Site = value;\r
+         }\r
+      }\r
+\r
+      public void CompleteRequest() {\r
+         _CompleteRequest = true;\r
+      }\r
+\r
+      [MonoTODO("Cleanup")]\r
+      public virtual void Dispose() {\r
+         \r
+      }\r
+\r
+      public virtual void Init() {\r
       }\r
    }\r
 }\r
index 2cd99bdd9de7ba53ec3da79dadd1c7de7e510f68..ce02569a2081371e8df5eefa796115c829f92fb3 100644 (file)
@@ -5,16 +5,14 @@
 //   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
 //\r
 using System;\r
+using System.Web;\r
+using System.Collections.Specialized;\r
 \r
 namespace System.Web {\r
 \r
-   [MonoTODO()]\r
-   public class HttpApplicationState {\r
+   public class HttpApplicationState : NameObjectCollectionBase {\r
       [MonoTODO()]\r
       internal HttpApplicationState() {\r
-         //\r
-         // TODO: Add constructor logic here\r
-         //\r
       }\r
    }\r
 }\r
index 7591692f44df533741783d892835bbcbff05b8b8..5d3487dbbb7074d8c25f32e11d0fcd29e0289fef 100644 (file)
@@ -14,5 +14,12 @@ namespace System.Web {
          // TODO: Add constructor logic here\r
          //\r
       }\r
+\r
+      [MonoTODO()]\r
+      public string Type {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
    }\r
 }\r
index b729f90a8f5fb0395b16766108da81e0cb0efdc4..fb4b540ab9f4e869419b3b0e0b889610f760fd90 100644 (file)
 //   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
 //\r
 using System;\r
+using System.Web;\r
+using System.Collections.Specialized;\r
 \r
 namespace System.Web {\r
    [MonoTODO()]\r
-   public class HttpClientCertificate {\r
-      public HttpClientCertificate() {\r
-         //\r
-         // TODO: Add constructor logic here\r
-         //\r
+   public class HttpClientCertificate : NameObjectCollectionBase {\r
+      private HttpContext _Context;\r
+      private byte [] _BinaryIssuer;\r
+      private int _CertEncoding;\r
+      private byte [] _Certificate;\r
+      private string _Cookie;\r
+      private int _Flags;\r
+      private string _Issuer;      \r
+      private int _KeySize;\r
+      private byte [] _PublicKey;\r
+      private int _SecretKeySize;\r
+      private string _SerialNumber;\r
+      private string _ServerIssuer;\r
+      private string _ServerSubject;\r
+      private string _Subject;\r
+\r
+      private DateTime _ValidFrom;\r
+      private DateTime _ValidTo;\r
+\r
+      [MonoTODO("Decode ceritificate from Server variables.. CGI standard?")]\r
+      internal HttpClientCertificate(HttpContext Context) {\r
+         _Context = Context;\r
+         _Flags = 0;\r
+      }\r
+\r
+      public byte [] BinaryIssuer {\r
+         get {\r
+            return _BinaryIssuer;\r
+         }\r
+      }\r
+\r
+      public int CertEncoding {\r
+         get {\r
+            return _CertEncoding;\r
+         }\r
+      }\r
+\r
+      public byte [] Certificate {\r
+         get {\r
+            return _Certificate;\r
+         }\r
+      }\r
+\r
+      public string Cookie {\r
+         get {\r
+            return _Cookie;\r
+         }\r
+      }\r
+\r
+      public int Flags {\r
+         get {\r
+            return _Flags;\r
+         }\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public bool IsPresent {\r
+         get {\r
+            return false;\r
+         }\r
+      }\r
+\r
+      public string Issuer {\r
+         get {\r
+            return _Issuer;\r
+         }\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public bool IsValid {\r
+         get {\r
+            return false;\r
+         }\r
+      }\r
+\r
+      public int KeySize {\r
+         get {\r
+            return _KeySize;\r
+         }\r
+      }\r
+\r
+      public byte [] PublicKey {\r
+         get {\r
+            return _PublicKey;\r
+         }\r
+      }\r
+\r
+      public int SecretKeySize {\r
+         get {\r
+            return _SecretKeySize;\r
+         }\r
+      }\r
+\r
+      public string SerialNumber {\r
+         get {\r
+            return _SerialNumber;\r
+         }\r
+      }\r
+\r
+      public string ServerIssuer {\r
+         get {\r
+            return _ServerIssuer;\r
+         }\r
+      }\r
+\r
+      public string ServerSubject { \r
+         get {\r
+            return _ServerSubject;\r
+         }\r
+      }\r
+\r
+      public string Subject { \r
+         get {\r
+            return _Subject;\r
+         }\r
+      }\r
+\r
+      public DateTime ValidFrom {\r
+         get {\r
+            return _ValidFrom;\r
+         }\r
+      }\r
+\r
+      public DateTime ValidUntil {\r
+         get {\r
+            return ValidUntil;\r
+         }\r
       }\r
    }\r
 }\r
index a5994dbbb9c92406f8c01423ffd4678849165f31..4e6ca908acd42ff03c187aea7f85502b98e07503 100644 (file)
@@ -12,7 +12,7 @@ using System.Threading;
 \r
 namespace System.Web {\r
    [MonoTODO("HttpContext - Should also keep the script timeout info")]\r
-   public class HttpContext : IServiceProvider {\r
+   public sealed class HttpContext : IServiceProvider {\r
       private Exception []     _arrExceptions;\r
 \r
       private HttpResponse     _oResponse;\r
@@ -172,6 +172,10 @@ namespace System.Web {
          get {\r
             throw new NotImplementedException();\r
          }\r
+\r
+         set {\r
+            throw new NotImplementedException();\r
+         }\r
       }\r
 \r
       public DateTime Timestamp {\r
index efbb958bb6b3a7784d3ee143b9c0d13e091236ec..f53cdc7ce94c5ae42ae55d2443b160396f2fefc8 100644 (file)
-//\r
-// System.Web.HttpCookie.cs\r
+// \r
+// System.Web.HttpCookie\r
 //\r
 // Author:\r
-//   Bob Smith <bob@thestuff.net>\r
-//\r
-// (C) Bob Smith\r
+//   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
 //\r
-\r
 using System;\r
+using System.Text;\r
+using System.Web;\r
 using System.Collections.Specialized;\r
 \r
 namespace System.Web {\r
    public sealed class HttpCookie {\r
-      private string _name;\r
-      private string _value = null;\r
-      private string _domain; //TODO: default to some pref.\r
-      private DateTime _expires;\r
-      private string _path;  //TODO: default is the current request path.\r
-      private bool _secure = false;\r
+      private string _Name;\r
+      private string _Value;\r
+      private string _Domain;\r
+      private DateTime _Expires;\r
+      private bool _ExpiresSet;\r
+      private string _Path;  \r
+      private bool _Secure = false;\r
+      \r
+      private HttpValueCollection _Values;\r
+\r
+      internal HttpCookie() {\r
+         _Path = "/";\r
+      }\r
+\r
       public HttpCookie(string name) {\r
-         _name = name;\r
+         _Path = "/";\r
+         _Name = name;\r
       }\r
+\r
       public HttpCookie(string name, string value) {\r
-         _name = name;\r
-         _value = value;\r
+         _Name = name;\r
+         _Value = value;\r
       }\r
+\r
+      HttpResponseHeader GetCookieHeader() {\r
+         StringBuilder oSetCookie = new StringBuilder();\r
+\r
+         if (null != _Name && _Name.Length > 0) {\r
+            oSetCookie.Append(_Name);\r
+            oSetCookie.Append("=");\r
+         }\r
+\r
+         if (null != _Values) {\r
+            oSetCookie.Append(_Values.ToString(false));\r
+         } else if (null != _Value) {\r
+            oSetCookie.Append(_Value);\r
+         }\r
+\r
+         if (null != _Domain && _Domain.Length > 0) {\r
+            oSetCookie.Append("; domain=");\r
+            oSetCookie.Append(_Domain);\r
+         }\r
+\r
+         if (null != _Path && Path.Length > 0) {\r
+            oSetCookie.Append("; path=");\r
+            oSetCookie.Append(_Path);\r
+         }\r
+\r
+         if (_Secure) {\r
+            oSetCookie.Append("; secure");\r
+         }\r
+\r
+         return new HttpResponseHeader(HttpWorkerRequest.HeaderSetCookie, oSetCookie.ToString());\r
+      }\r
+\r
       public string Domain {\r
          get {\r
-            return _domain;\r
+            return _Domain;\r
          }\r
          set {\r
-            _domain = value;\r
+            _Domain = value;\r
          }\r
       }\r
+\r
       public DateTime Expires {\r
          get {\r
-            return _expires;\r
+            if (!_ExpiresSet) {\r
+               return DateTime.MinValue;\r
+            }\r
+\r
+            return _Expires;\r
          }\r
+\r
          set {\r
-            _expires = value;\r
+            _ExpiresSet = true;\r
+            _Expires = value;\r
          }\r
       }\r
+\r
       public bool HasKeys {\r
          get {\r
-            return false; //TODO\r
+            return Values.HasKeys();\r
          }\r
       }\r
+\r
       public string this[string key] {\r
-         //TODO: get/set subcookie.\r
-         get {return "";}\r
-         set {}\r
+         get {\r
+            return Values[key];\r
+         }\r
+         \r
+         set {\r
+            Values[key] = value;\r
+         }\r
       }\r
+\r
       public string Name {\r
          get {\r
-            return _name;\r
+            return _Name;\r
          }\r
+\r
          set {\r
-            _name = value;\r
+            _Name = value;\r
          }\r
       }\r
+\r
       public string Path {\r
          get {\r
-            return _path;\r
+            return _Path;\r
          }\r
+\r
          set {\r
-            _path = value;\r
+            _Path = value;\r
          }\r
       }\r
+\r
       public bool Secure {\r
          get {\r
-            return _secure;\r
+            return _Secure;\r
          }\r
          set {\r
-            _secure = value;\r
+            _Secure = value;\r
          }\r
       }\r
+\r
       public string Value {\r
          get {\r
-            return _value;\r
+            if (null != _Values) {\r
+               return _Values.ToString(false);\r
+            }\r
+            \r
+            return _Value;\r
          }\r
          set {\r
-            _value = value;\r
+            if (null != _Values) {\r
+               _Values.Reset();\r
+               _Values.Add(null, value);\r
+               return;\r
+            }\r
+\r
+            _Value = value;\r
          }\r
       }\r
+\r
       public NameValueCollection Values {\r
-         //TODO\r
-         get {return null;}\r
+         get {\r
+            if (null == _Values) {\r
+               _Values = new HttpValueCollection();\r
+               if (null != _Value) {\r
+                  // Do we have multiple keys\r
+                  if (_Value.IndexOf("&") >= 0 || _Value.IndexOf("=") >= 0) {\r
+                     _Values.FillFromCookieString(_Value);\r
+                  } else {\r
+                     _Values.Add(null, _Value);\r
+                  }\r
+\r
+                  _Value = null;\r
+               }\r
+            }\r
+\r
+            return _Values;\r
+         }\r
       }\r
    }\r
 }\r
index b2ae6693ec6c22bc2d1adfa8c415ef8a2761b271..e3918e4a4f0105c4daad1fb0b78b3a22f1cd80cf 100644 (file)
-//\r
-// System.Web.HttpCookieCollection.cs\r
+// \r
+// System.Web.HttpCookieCollection\r
 //\r
 // Author:\r
-//   Bob Smith <bob@thestuff.net>\r
-//\r
-// (C) Bob Smith\r
+//   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
+//   (First impl Bob Smith <bob@thestuff.net>)\r
 //\r
 \r
 using System;\r
+using System.Web;\r
 using System.Collections.Specialized;\r
 \r
 namespace System.Web {\r
    public sealed class HttpCookieCollection : NameObjectCollectionBase {\r
-      public HttpCookieCollection() {}\r
-      public string[] AllKeys {\r
+      private HttpCookie [] _AllCookies;\r
+      private string [] _AllKeys;\r
+      \r
+      private HttpResponse _Response;\r
+\r
+      internal HttpCookieCollection(HttpResponse Response, bool ReadOnly) : base() {\r
+         _Response = Response;\r
+         IsReadOnly = ReadOnly;\r
+      }\r
+\r
+      public HttpCookieCollection() {\r
+      }\r
+      \r
+      public string [] AllKeys {\r
          get {\r
-            return this.BaseGetAllKeys();\r
+            if (null == _AllKeys) {\r
+               _AllKeys = BaseGetAllKeys();\r
+            }\r
+\r
+            return _AllKeys;\r
          }\r
       }\r
+      \r
       public HttpCookie this[int index] {\r
          get {\r
-            return (HttpCookie)(this.BaseGet(index));\r
+            return Get(index);\r
          }\r
       }\r
+      \r
       public HttpCookie this[string name] {\r
          get {\r
-            return (HttpCookie)(this.BaseGet(name));\r
+            return Get(name);\r
          }\r
       }\r
+\r
       public void Add(HttpCookie cookie) {\r
-         this.BaseAdd(cookie.Name, cookie);\r
+         if (null != _Response) {\r
+            _Response.GoingToChangeCookieColl();\r
+         }\r
+\r
+         // empy performance cache\r
+         _AllCookies = null;\r
+         _AllKeys = null;\r
+\r
+         BaseAdd(cookie.Name, cookie);\r
+\r
+         if (null != _Response) {\r
+            _Response.OnCookieAdd(cookie);\r
+         }\r
       }\r
+\r
       public void Clear() {\r
+         _AllCookies = null;\r
+         _AllKeys = null;\r
          this.BaseClear();\r
       }\r
+\r
       public void CopyTo(Array dest, int index) {\r
-         int i;\r
-         HttpCookie cookie;\r
-         for(i=0; i<this.Count; i++) {\r
-            cookie=this[i];\r
-            dest.SetValue(new HttpCookie(cookie.Name, cookie.Value), index+i);\r
+         if (null == _AllCookies) {\r
+            _AllCookies = new HttpCookie[Count];\r
+\r
+            for (int i = 0; i != Count; i++) {\r
+               _AllCookies[i] = Get(i);\r
+            }\r
+         }\r
+\r
+         if (null != _AllCookies) {\r
+            _AllCookies.CopyTo(dest, index);\r
          }\r
       }\r
+\r
+      public HttpCookie Get(int index) {\r
+         return (HttpCookie) BaseGet(index);\r
+      }\r
+\r
+      public HttpCookie Get(string name) {\r
+         HttpCookie oRet = (HttpCookie) BaseGet(name);\r
+         if (null == oRet && _Response != null) {\r
+            _AllCookies = null;\r
+            _AllKeys = null;\r
+\r
+            _Response.GoingToChangeCookieColl();\r
+            \r
+            oRet = new HttpCookie(name);\r
+            BaseAdd(name, oRet);\r
+\r
+            _Response.OnCookieAdd(oRet);\r
+         }\r
+\r
+         return oRet;\r
+      }\r
+\r
       public string GetKey(int index) {\r
          return this.BaseGetKey(index);\r
       }\r
+\r
       public void Remove(string name) {\r
+         if (null != _Response) {\r
+            _Response.GoingToChangeCookieColl();\r
+         }\r
+\r
+         _AllCookies = null;\r
+         _AllKeys = null;\r
          this.BaseRemove(name);\r
+         \r
+         if (null != _Response) {\r
+            _Response.ChangedCookieColl();\r
+         }\r
       }\r
+\r
       public void Set(HttpCookie cookie) {\r
+         if (null != _Response) {\r
+            _Response.GoingToChangeCookieColl();\r
+         }\r
+\r
+         _AllCookies = null;\r
+         _AllKeys = null;\r
          this.BaseSet(cookie.Name, cookie);\r
+\r
+         if (null != _Response) {\r
+            _Response.ChangedCookieColl();\r
+         }\r
       }\r
    }\r
 }\r
index 4dcc44ea6aea3dee703af8c0c30fbf87559b686e..594b825baf37b0bddb242a7e419c2fec8b803d14 100644 (file)
@@ -11,6 +11,10 @@ namespace System.Web {
    [MonoTODO("This class contains a lot of windows specific methods, solve this.. :)")]\r
    public class HttpException : ExternalException {\r
       private int _HttpCode;\r
+      private int _HR;\r
+\r
+      public HttpException() : base() {\r
+      }\r
 \r
       public HttpException(string sMessage) : base(sMessage) {\r
       }\r
@@ -22,12 +26,34 @@ namespace System.Web {
          _HttpCode = iHttpCode;\r
       }\r
 \r
+      public HttpException(int iHttpCode, string sMessage, int iHR) : base(sMessage) {\r
+         _HttpCode = iHttpCode;\r
+         _HR = iHR;\r
+      }\r
+\r
+      public HttpException(string sMessage, int iHR) : base(sMessage) {\r
+         _HR = iHR;\r
+      }\r
+\r
       public HttpException(int iHttpCode, string sMessage, Exception InnerException) : base(sMessage, InnerException) {\r
          _HttpCode = iHttpCode;\r
       }\r
+      \r
+      [MonoTODO("Should get an correct html message depending on error type")]\r
+      public string GetHtmlErrorMessage() {\r
+         throw new NotImplementedException();\r
+      }\r
 \r
+      [MonoTODO("Check error type and Set the correct error code")]\r
       public int GetHttpCode() {\r
          return _HttpCode;\r
       }\r
+\r
+      [MonoTODO("Get the last error code")]\r
+      public static HttpException CreateFromLastError(string Message) {\r
+         return new HttpException(Message);\r
+      }\r
+\r
+\r
    }\r
 }\r
index 934e627d4e6c9be76d8a284526e20c1959a71c08..423a5d4f6056f6c4e400d5be2ba9a3dd85987312 100644 (file)
@@ -5,14 +5,69 @@
 //   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
 //\r
 using System;\r
+using System.Collections.Specialized;\r
 \r
 namespace System.Web {\r
-   [MonoTODO()]\r
-   public class HttpFileCollection {\r
-      public HttpFileCollection() {\r
-         //\r
-         // TODO: Add constructor logic here\r
-         //\r
+   public sealed class HttpFileCollection : NameObjectCollectionBase {\r
+      private HttpPostedFile [] _AllFiles;\r
+      private string [] _AllKeys;\r
+\r
+      internal HttpFileCollection() : base() {\r
+      }\r
+\r
+      internal void AddFile(string name, HttpPostedFile file) {\r
+         _AllFiles = null;\r
+         _AllKeys = null;\r
+\r
+         BaseAdd(name, file);\r
+      }\r
+\r
+      public void CopyTo(Array Dest, int index) {\r
+         if (null == _AllFiles) {\r
+            _AllFiles = new HttpPostedFile[Count];\r
+            for (int i = 0; i != Count; i++) {\r
+               _AllFiles[i] = Get(i);\r
+            }\r
+         }\r
+\r
+         if (null != _AllFiles) {\r
+            _AllFiles.CopyTo(Dest, index);\r
+         }\r
+      }\r
+\r
+      public HttpPostedFile Get(string Name) {\r
+         return (HttpPostedFile) BaseGet(Name);\r
+      }\r
+\r
+      public HttpPostedFile Get(int index) {\r
+         return (HttpPostedFile) BaseGet(index);\r
+      }\r
+\r
+      public string GetKey(int index) {\r
+         return BaseGetKey(index);\r
+      }\r
+\r
+      public string [] AllKeys {\r
+         get {\r
+            if (null == _AllKeys) {\r
+               _AllKeys = BaseGetAllKeys();\r
+            }\r
+\r
+            return _AllKeys;\r
+         }\r
+      }\r
+      \r
+      public HttpPostedFile this [string name] {\r
+         get {\r
+            return Get(name);\r
+         }\r
+      }\r
+\r
+      public HttpPostedFile this [int index] {\r
+         get {\r
+            return Get(index);\r
+         }\r
       }\r
+   \r
    }\r
 }\r
index effb68a43a3799291cc49ca77737950c35b6df65..62e716689cc72743b137a52be2f70c075eb1cab7 100644 (file)
@@ -11,21 +11,8 @@ using System.IO;
 using System.Text;\r
 \r
 namespace System.Web {\r
-   //-- Methods from HttpRequest not implemented\r
-   //          public HttpFileCollection Files {get;}\r
-   //          public HttpBrowserCapabilities Browser {get; set;}\r
-   //          public HttpClientCertificate ClientCertificate {get;}\r
-   //          public string ApplicationPath {get;}\r
-   //          public HttpCookieCollection Cookies {get;}\r
-   //          public Stream Filter {get; set;}\r
-   //          public string MapPath(string virtualPath, string baseVirtualDir, bool allowCrossAppMapping);\r
-   //          public string MapPath(string virtualPath);\r
-   //          public int [] MapImageCoordinates(string imageFieldName);\r
-   //          public string FilePath {get;}\r
-   //          public Uri UrlReferrer \r
-\r
    [MonoTODO("Review security in all path access function")]\r
-   public class HttpRequest {\r
+   public sealed class HttpRequest {\r
       private string []        _arrAcceptTypes;\r
       private string []        _arrUserLanguages;\r
 \r
@@ -57,6 +44,7 @@ namespace System.Web {
 \r
       private HttpWorkerRequest _WorkerRequest;\r
       private HttpRequestStream        _oInputStream;\r
+      private HttpClientCertificate _ClientCert;\r
 \r
       private HttpValueCollection _oServerVariables;\r
       private HttpValueCollection _oHeaders;\r
@@ -285,10 +273,13 @@ namespace System.Web {
          }\r
       }\r
 \r
-      [MonoTODO()]\r
       public HttpClientCertificate ClientCertificate {\r
          get {\r
-            throw new NotImplementedException();\r
+            if (null == _ClientCert) {\r
+               _ClientCert = new HttpClientCertificate(_oContext);\r
+            }\r
+\r
+            return _ClientCert;\r
          }\r
       }\r
 \r
@@ -622,6 +613,10 @@ namespace System.Web {
          \r
             return _sRequestType;\r
          }\r
+\r
+         set {\r
+            _sRequestType = value;\r
+         }\r
       }\r
                \r
       \r
index 0150439549a37027958d052ef3a1b69c0d8ce9b3..e907db13656f0acdc77d1ba53b85176150373370 100644 (file)
@@ -30,12 +30,15 @@ namespace System.Web {
       private long _lContentLength;\r
       private int _iStatusCode;\r
 \r
+      private bool _ClientDisconnected;\r
+\r
       private string   _sContentType;\r
       private string   _sCacheControl;\r
       private string   _sTransferEncoding;\r
       private string   _sCharset;\r
       private string   _sStatusDescription;\r
 \r
+      private HttpCookieCollection _Cookies;\r
       private HttpCachePolicy _CachePolicy;\r
 \r
       private Encoding _ContentEncoding;\r
@@ -46,7 +49,31 @@ namespace System.Web {
 \r
       private HttpWorkerRequest _WorkerRequest;\r
 \r
-      public HttpResponse(HttpWorkerRequest WorkerRequest, HttpContext Context) {\r
+      [MonoTODO("Verify that this really works")]\r
+      internal HttpResponse(TextWriter output) {\r
+         _bBuffering = true;\r
+         _bFlushing = false;\r
+         _bHeadersSent = false;\r
+\r
+         _Headers = new ArrayList();\r
+\r
+         _sContentType = "text/html";\r
+\r
+         _iStatusCode = 200;\r
+         _sCharset = null;\r
+         _sCacheControl = null;\r
+\r
+         _lContentLength = 0;\r
+         _bSuppressContent = false;\r
+         _bSuppressHeaders = false;\r
+         _bClientDisconnected = false;\r
+\r
+         _bChunked = false;\r
+\r
+         _TextWriter = output;\r
+      }\r
+\r
+      internal HttpResponse(HttpWorkerRequest WorkerRequest, HttpContext Context) {\r
          _Context = Context;\r
          _WorkerRequest = WorkerRequest;\r
 \r
@@ -122,6 +149,8 @@ namespace System.Web {
             oHeaders.Add(new HttpResponseHeader(HttpWorkerRequest.HeaderTransferEncoding, _sTransferEncoding));\r
          }\r
 \r
+         // TODO: Add Cookie headers..\r
+\r
          return oHeaders;\r
       }\r
 \r
@@ -136,6 +165,67 @@ namespace System.Web {
          _bHeadersSent = true;\r
       }\r
 \r
+      public string Status {\r
+         get {\r
+            return StatusCode.ToString() + " " + StatusDescription;\r
+         }\r
+\r
+         set {\r
+            string sMsg = "OK";\r
+            int iCode = 200;\r
+\r
+            try {\r
+               iCode = Int32.Parse(value.Substring(0, value.IndexOf(' ')));\r
+               sMsg = value.Substring(value.IndexOf(' ') + 1);\r
+            }\r
+            catch(Exception) {\r
+               throw new HttpException("Invalid status string");\r
+            }\r
+\r
+            StatusCode = iCode;\r
+            StatusDescription = sMsg;\r
+         }\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void AddCacheItemDependencies(ArrayList cacheKeys) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void AddCacheItemDependency(string cacheKey) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void AddFileDependencies(ArrayList filenames) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void AddFileDependency(string filename) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      public void AddHeader(string name, string value) {\r
+         AppendHeader(name, value);\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void AppendCookie(HttpCookie cookie) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void AppendToLog(string param) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public string ApplyAppPathModifier(string virtualPath) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
       public bool Buffer {\r
          get {\r
             return BufferOutput;\r
@@ -238,10 +328,12 @@ namespace System.Web {
          }\r
       }\r
 \r
-      [MonoTODO("Set status in the cache policy")]\r
       public HttpCookieCollection Cookies {\r
          get {\r
-            throw new NotImplementedException();\r
+            if (null == _Cookies) {\r
+               _Cookies = new HttpCookieCollection(this, false);\r
+            }\r
+            return _Cookies;\r
          }\r
       }\r
 \r
@@ -256,8 +348,8 @@ namespace System.Web {
          }\r
       }\r
 \r
-      [MonoTODO("Set expires in the cache policy")]\r
-      public int ExpiresAbsolut {\r
+      [MonoTODO("Set expiresabsolute in the cache policy")]\r
+      public int ExpiresAbsolute {\r
          get {\r
             throw new NotImplementedException();\r
          }\r
@@ -266,6 +358,38 @@ namespace System.Web {
             throw new NotImplementedException();\r
          }\r
       }\r
+\r
+      public Stream Filter {\r
+         get {\r
+            if (_Writer != null) {\r
+               return _Writer.GetActiveFilter();\r
+            }\r
+            return null;\r
+         }\r
+\r
+         set {\r
+            if (_Writer == null) {\r
+               throw new HttpException("Filtering is not allowed");\r
+            }\r
+\r
+            _Writer.ActivateFilter(value);\r
+         }\r
+      }\r
+\r
+      public bool IsClientConnected {\r
+         get {\r
+            if (_ClientDisconnected) {\r
+               return false;\r
+            }\r
+\r
+            if (null != _WorkerRequest && (!_WorkerRequest.IsClientConnected())) {\r
+               _ClientDisconnected = false;\r
+               return false;\r
+            }\r
+\r
+            return true;\r
+         }\r
+      }\r
       \r
       public TextWriter Output {\r
          get {\r
@@ -578,5 +702,49 @@ namespace System.Web {
       public void Write(char [] buffer, int index, int count) {\r
          _TextWriter.Write(buffer, index, count);\r
       }\r
+\r
+      [MonoTODO()]\r
+      public static void RemoveOutputCacheItem(string path) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void SetCookie(HttpCookie cookie) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      public void WriteFile(string filename) {\r
+         WriteFile(filename, false);\r
+      }\r
+\r
+      [MonoTODO()]\r
+      public void WriteFile(string filename, bool readIntoMemory) {\r
+         throw new NotImplementedException();\r
+      }\r
+      \r
+      [MonoTODO()]\r
+      public void WriteFile(string filename, long offset, long size) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO("Should we support fileHandle ptrs?")]\r
+      public void WriteFile(IntPtr fileHandle, long offset, long size) {\r
+      }   \r
+\r
+      [MonoTODO()]\r
+      internal void OnCookieAdd(HttpCookie cookie) {\r
+      }\r
+\r
+      [MonoTODO("Do we need this?")]\r
+      internal void OnCookieChange(HttpCookie cookie) {\r
+      }\r
+\r
+      [MonoTODO()]\r
+      internal void GoingToChangeCookieColl() {\r
+      }\r
+\r
+      [MonoTODO()]\r
+      internal void ChangedCookieColl() {\r
+      }\r
    }\r
 }\r
index 49b356c2fefa7c70a706990519b74cb9fddbd7d1..f390a674d44de2e56a4860c5fff3611fd5984cd0 100644 (file)
@@ -12,12 +12,12 @@ namespace System.Web {
       private string _sValue;\r
       private int _iKnowHeaderId;\r
 \r
-      public HttpResponseHeader(int KnowHeaderId, string value) {\r
+      internal HttpResponseHeader(int KnowHeaderId, string value) {\r
          _iKnowHeaderId = KnowHeaderId;\r
          _sValue = value;\r
       }\r
 \r
-      public HttpResponseHeader(string header, string value) {\r
+      internal HttpResponseHeader(string header, string value) {\r
          _sHeader = header;\r
          _sValue = value;\r
       }\r
index cb3a4f4092946973ed6542b74645aaef76dd0c62..079e39841a6bd00552fc32ea6c6542f960272b58 100644 (file)
@@ -15,7 +15,7 @@ using System.Web.Caching;
 \r
 namespace System.Web {\r
    [MonoTODO("Make corrent right now this is a simple impl to give us a base for testing... the methods here are not complete or valid")]\r
-   public class HttpRuntime {\r
+   public sealed class HttpRuntime {\r
       // Security permission helper objects\r
       private static IStackWalk appPathDiscoveryStackWalk;\r
       private static IStackWalk ctrlPrincipalStackWalk;\r
index e58e1db1aaffae8fa25b2713eef2090fd8eb0fc0..c41d72d9d56340e4a43f03e12ca9350e26c2e96b 100644 (file)
@@ -19,20 +19,23 @@ using System;
 using System.IO;\r
 \r
 namespace System.Web {\r
-   /// <summary>\r
-   /// System.Web.\r
-   /// </summary>\r
    public sealed class HttpServerUtility {\r
 \r
       private static string _name = "";\r
 \r
       private HttpContext _Context;\r
+      private HttpApplication _Application;\r
                \r
       [MonoTODO()]\r
-      public HttpServerUtility(HttpContext Context) {\r
+      internal HttpServerUtility(HttpContext Context) {\r
          _Context = Context;\r
       }\r
                \r
+      [MonoTODO()]\r
+      internal HttpServerUtility(HttpApplication app) {\r
+         _Application = app;\r
+      }\r
+\r
       // Properties\r
 \r
 \r
@@ -66,7 +69,14 @@ namespace System.Web {
       /// Clears the previous exception.\r
       /// </summary>\r
       public void ClearError() {\r
-         _Context.ClearError();\r
+         if (null != _Context) {\r
+            _Context.ClearError();\r
+            return;\r
+         }\r
+\r
+         if (null != _Application) {\r
+            _Application.ClearError();\r
+         }\r
       }\r
 \r
                \r
@@ -185,6 +195,10 @@ namespace System.Web {
       /// <param name="path">The virtual path on the Web server. </param>\r
       /// <returns>The physical file path that corresponds to path.</returns>\r
       public string MapPath(string path) {\r
+         if (null == _Context) {\r
+            throw new HttpException("MapPath is not available");\r
+         }\r
+\r
          return _Context.Request.MapPath(path);\r
       }\r
 \r
index 6ff0ad2438436e2be4bc2d6462b5de9007b48f23..5500050c19280fbc86d7a26db728ce2180a3a0f9 100644 (file)
@@ -10,9 +10,6 @@ namespace System.Web {
    [MonoTODO()]\r
    public class HttpSessionState {\r
       public HttpSessionState() {\r
-         //\r
-         // TODO: Add constructor logic here\r
-         //\r
       }\r
    }\r
 }\r
index 1b06c38f188c5cc1ec624ae2f133f5dd218d6dc0..206b8abb961811d9736bc1f0be2fe2037da1d2f0 100644 (file)
@@ -10,8 +10,7 @@ using System.Text;
 using System.IO;\r
 \r
 namespace System.Web {\r
-   [MonoTODO()]\r
-   public class HttpUtility {\r
+   public sealed class HttpUtility {\r
       // private stuff\r
       private const string _hex = "0123456789ABCDEF";\r
       private const string _chars = "<>;:.?=&@*+%/\\";\r
@@ -75,6 +74,8 @@ namespace System.Web {
          return dest;\r
       }\r
 \r
+\r
+\r
       public static string UrlEncode(string str) {\r
          return UrlDecode(str, Encoding.UTF8);\r
       }\r
index 28577b9b6f8c805e021ac7dcd9452580303e591a..d5e370f2c11d9c02cd1e7fb878e9c813d7a8f92d 100644 (file)
@@ -6,6 +6,7 @@
 //\r
 using System;\r
 using System.Collections.Specialized;\r
+using System.Runtime.Serialization;\r
 using System.Text;\r
 \r
 namespace System.Web {\r
@@ -28,6 +29,9 @@ namespace System.Web {
          IsReadOnly = ReadOnly;\r
       }\r
 \r
+      protected HttpValueCollection(SerializationInfo info, StreamingContext context) : base(info, context) {\r
+      }\r
+      \r
       // string = header1: value1\r\nheader2: value2\r
       internal void FillFromHeaders(string sHeaders, Encoding encoding) {\r
          _bHeaders = true;\r
@@ -99,6 +103,10 @@ namespace System.Web {
          FillFromQueryString(sData, Encoding.UTF8);\r
       }\r
 \r
+      internal void FillFromCookieString(string sData) {\r
+         FillFromQueryString(sData, Encoding.UTF8);\r
+      }\r
+\r
       internal void MakeReadOnly() {\r
          IsReadOnly = true;\r
       }\r
index d52d047002a0e7f97c3171f1eb4d0f4c712740f5..e1bf3c981a7ccef807c678d8464960b0272a7eb9 100644 (file)
@@ -382,6 +382,7 @@ namespace System.Web {
          return null;\r
       }\r
       \r
+      [CLSCompliant(false)]\r
       public virtual string[][] GetUnknownRequestHeaders() {\r
          return null;\r
       }\r
index 8ea6ab7afeb5032bc3024eb2162374e32481cd56..f34dc5c33edad1eb4b339a778327a7a4f3b1bfeb 100644 (file)
@@ -9,7 +9,7 @@ using System.IO;
 using System.Text;\r
 \r
 namespace System.Web {\r
-   public class HttpWriter : TextWriter {\r
+   public sealed class HttpWriter : TextWriter {\r
       private HttpResponse     _Response;\r
                \r
       private HttpResponseStream _ResponseStream;\r
index 1b8586ebc05b331016eca95f126934db53490366..e8c8ed21de2e9d6013d8be93bc51930fa7c53ced 100644 (file)
@@ -7,17 +7,16 @@
 // (C) Bob Smith
 //
 
-namespace System.Web
-{
-        public enum ProcessShutdownReason
-        {
-                IdleTimeout,
-                MemoryLimitExceeded,
-                None,
-                PingFailed,
-                RequestQueueLimit,
-                RequestsLimit,
-                Timeout,
-                Unexpected
-        }
+namespace System.Web {
+   public enum ProcessShutdownReason {
+      DeadlockSuspected,
+      IdleTimeout,
+      MemoryLimitExceeded,
+      None,
+      PingFailed,
+      RequestQueueLimit,
+      RequestsLimit,
+      Timeout,
+      Unexpected
+   }
 }
\ No newline at end of file
index a07dbc593e5e06fe935b1a10135b54cfe00b30a1..bfc1b8f36572c7334f66cfe85d56e3a776e8f779 100644 (file)
@@ -7,9 +7,63 @@
 using System;\r
 \r
 namespace System.Web {\r
-   [MonoTODO()]\r
-   public class TraceContext {\r
+   public sealed class TraceContext {\r
+      private HttpContext _Context;\r
+      private bool _Enabled;\r
+      private TraceMode _Mode;\r
+\r
       public TraceContext(HttpContext Context) {\r
+         _Context = Context;\r
+         _Enabled = true;\r
+      }\r
+\r
+      public bool IsEnabled {\r
+         get {\r
+            return _Enabled;\r
+         }\r
+\r
+         set {\r
+            _Enabled = value;\r
+         }\r
+      }\r
+\r
+      public TraceMode TraceMode {\r
+         get {\r
+            return _Mode;\r
+         }\r
+\r
+         set {\r
+            _Mode = value;\r
+         }\r
+      }\r
+\r
+      public void Warn(string msg) {\r
+         Write(String.Empty, msg, null, true);\r
+      }\r
+\r
+      public void Warn(string category, string msg) {\r
+         Write(category, msg, null, true);\r
+      }\r
+\r
+      public void Warn(string category, string msg, Exception error) {\r
+         Write(category, msg, error, true);\r
+      }\r
+\r
+      public void Write(string msg) {\r
+         Write(String.Empty, msg, null, true);\r
+      }\r
+\r
+      public void Write(string category, string msg) {\r
+         Write(category, msg, null, true);\r
+      }\r
+\r
+      public void Write(string category, string msg, Exception error) {\r
+         Write(category, msg, error, true);\r
+      }\r
+\r
+      [MonoTODO("Save the data into a web dataset directly...")]\r
+      public void Write(string category, string msg, Exception error, bool Warning) {\r
+         throw new NotImplementedException();\r
       }\r
    }\r
 }\r
index 125491211101d9ef73a37be759c80426c74c2e74..0bc88d0ca64b6d2e91b6db4a3d0f8daff8547d24 100644 (file)
@@ -7,11 +7,10 @@
 // (C) Bob Smith
 //
 
-namespace System.Web
-{
-        public enum TraceMode
-        {
-                SortByCategory,
-                SortByTime
-        }
+namespace System.Web {
+   public enum TraceMode {
+      Default,               
+      SortByCategory,
+      SortByTime
+   }
 }