2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
authorPatrik Torstensson <totte@mono-cvs.ximian.com>
Wed, 10 Apr 2002 08:35:39 +0000 (08:35 -0000)
committerPatrik Torstensson <totte@mono-cvs.ximian.com>
Wed, 10 Apr 2002 08:35:39 +0000 (08:35 -0000)
    * HttpContext.cs: First implementation (basic support, few methods left to impl)
    * HttpException.cs: Partial implementation (basic support)
    * HttpHelper.cs: Header parse helper, used by runtime (non public)
    * HttpRequest.cs: Implementation (all methods there, not all fully impl)
    * HttpRequestStream.cs: Full implementation
    * HttpResponse.cs: Partial implementation(almost all methods)
    * HttpResponseHeader.cs: Header helper
    * HttpResponseStream.cs: Full implementation - Response stream support
    * HttpResponseStreamProxy.cs: Implementation - filter support
    * HttpRuntime.cs: Rewrite to support one IHttpModule (use for testing the runtime)
* HttpServerUtility.cs: Implemented usage of HttpContext for methods
                        and moved encoding functions to HttpUtility.

    * HttpUtility.cs: Added encoding/decoding functions from HttpServerUtility and
                      added the Attribute encoding functions.

    * HttpValueCollection.cs: Implementation.
    * HttpWorkerRequest.cs: Rewrite and implementation of all methods (ready)
    * HttpWriter.cs: Implementation (with filter support)

    * HttpFileCollection: Added dummy class (placeholder)
    * HttpApplication.cs: Added dummy class (placeholder)
    * HttpApplicationState.cs: Added dummy class (placeholder)
    * HttpBrowserCapabilities.cs: Added dummy class (placeholder)
    * HtttpCachePolicy.cs: Added dummy class (placeholder)
    * HttpClientCertificate.cs: Added dummy class (placeholder)
    * HttpSessionState.cs: Added dummy class (placeholder)
    * TraceContext.cs: Added dummy class (placeholder)

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

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpCookie.cs
mcs/class/System.Web/System.Web/HttpCookieCollection.cs
mcs/class/System.Web/System.Web/HttpRuntime.cs
mcs/class/System.Web/System.Web/HttpServerUtility.cs
mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
mcs/class/System.Web/System.Web/IHttpHandler.cs
mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
mcs/class/System.Web/System.Web/IHttpModule.cs

index 4d2f65bc35c04026bbcdf46c295719c43ab94999..f43257538fead30bad5262ada6cb3560ef53bb92 100644 (file)
@@ -1,3 +1,35 @@
+2002-04-10  Patrik Torstensson <patrik.torstensson@labs2.com>
+
+    * HttpContext.cs: First implementation (basic support, few methods left to impl)
+    * HttpException.cs: Partial implementation (basic support)
+    * HttpHelper.cs: Header parse helper, used by runtime (non public)
+    * HttpRequest.cs: Implementation (all methods there, not all fully impl)
+    * HttpRequestStream.cs: Full implementation
+    * HttpResponse.cs: Partial implementation(almost all methods)
+    * HttpResponseHeader.cs: Header helper
+    * HttpResponseStream.cs: Full implementation - Response stream support
+    * HttpResponseStreamProxy.cs: Implementation - filter support
+    * HttpRuntime.cs: Rewrite to support one IHttpModule (use for testing the runtime)
+       * HttpServerUtility.cs: Implemented usage of HttpContext for methods
+                               and moved encoding functions to HttpUtility.
+
+    * HttpUtility.cs: Added encoding/decoding functions from HttpServerUtility and
+                      added the Attribute encoding functions.
+
+    * HttpValueCollection.cs: Implementation.
+    * HttpWorkerRequest.cs: Rewrite and implementation of all methods (ready)
+    * HttpWriter.cs: Implementation (with filter support)    
+
+    * HttpFileCollection: Added dummy class (placeholder)
+    * HttpApplication.cs: Added dummy class (placeholder)
+    * HttpApplicationState.cs: Added dummy class (placeholder)
+    * HttpBrowserCapabilities.cs: Added dummy class (placeholder)
+    * HtttpCachePolicy.cs: Added dummy class (placeholder)
+    * HttpClientCertificate.cs: Added dummy class (placeholder)
+    * HttpSessionState.cs: Added dummy class (placeholder)
+    * TraceContext.cs: Added dummy class (placeholder)
+    
+
 2002/04/10  Nick Drochak <ndrochak@gol.com>
 
        * HttpServerUtility.cs: Fix build breaker.
index bc16a17cd67280c9b6a59bf958ec2d40811b90ac..efbb958bb6b3a7784d3ee143b9c0d13e091236ec 100644 (file)
-//
-// System.Web.HttpCookie.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Collections.Specialized;
-
-namespace System.Web
-{
-        public sealed class HttpCookie
-        {
-                private string _name;
-                private string _value = null;
-                private string _domain; //TODO: default to some pref.
-                private DateTime _expires;
-                private string _path;  //TODO: default is the current request path.
-                private bool _secure = false;
-                public HttpCookie(string name)
-                {
-                        _name = name;
-                }
-                public HttpCookie(string name, string value)
-                {
-                        _name = name;
-                        _value = value;
-                }
-                public string Domain
-                {
-                        get
-                        {
-                                return _domain;
-                        }
-                        set
-                        {
-                                _domain = value;
-                        }
-                }
-                public DateTime Expires
-                {
-                        get
-                        {
-                                return _expires;
-                        }
-                        set
-                        {
-                                _expires = value;
-                        }
-                }
-                public bool HasKeys
-                {
-                        get
-                        {
-                                return false; //TODO
-                        }
-               }
-               public string this[string key]
-               {
-//TODO: get/set subcookie.
-                        get {return "";}
-                        set {}
-               }
-               public string Name
-               {
-                        get
-                        {
-                                return _name;
-                        }
-                        set
-                        {
-                                _name = value;
-                        }
-                }
-                public string Path
-                {
-                        get
-                        {
-                                return _path;
-                        }
-                        set
-                        {
-                                _path = value;
-                        }
-                }
-                public bool Secure
-                {
-                        get
-                        {
-                                return _secure;
-                        }
-                        set
-                        {
-                                _secure = value;
-                        }
-                }
-                public string Value
-                {
-                        get
-                        {
-                                return _value;
-                        }
-                        set
-                        {
-                                _value = value;
-                        }
-                }
-                public NameValueCollection Values
-                {
-//TODO
-                        get {return null;}
-                }
-        }
-}
+//\r
+// System.Web.HttpCookie.cs\r
+//\r
+// Author:\r
+//   Bob Smith <bob@thestuff.net>\r
+//\r
+// (C) Bob Smith\r
+//\r
+\r
+using System;\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
+      public HttpCookie(string name) {\r
+         _name = name;\r
+      }\r
+      public HttpCookie(string name, string value) {\r
+         _name = name;\r
+         _value = value;\r
+      }\r
+      public string Domain {\r
+         get {\r
+            return _domain;\r
+         }\r
+         set {\r
+            _domain = value;\r
+         }\r
+      }\r
+      public DateTime Expires {\r
+         get {\r
+            return _expires;\r
+         }\r
+         set {\r
+            _expires = value;\r
+         }\r
+      }\r
+      public bool HasKeys {\r
+         get {\r
+            return false; //TODO\r
+         }\r
+      }\r
+      public string this[string key] {\r
+         //TODO: get/set subcookie.\r
+         get {return "";}\r
+         set {}\r
+      }\r
+      public string Name {\r
+         get {\r
+            return _name;\r
+         }\r
+         set {\r
+            _name = value;\r
+         }\r
+      }\r
+      public string Path {\r
+         get {\r
+            return _path;\r
+         }\r
+         set {\r
+            _path = value;\r
+         }\r
+      }\r
+      public bool Secure {\r
+         get {\r
+            return _secure;\r
+         }\r
+         set {\r
+            _secure = value;\r
+         }\r
+      }\r
+      public string Value {\r
+         get {\r
+            return _value;\r
+         }\r
+         set {\r
+            _value = value;\r
+         }\r
+      }\r
+      public NameValueCollection Values {\r
+         //TODO\r
+         get {return null;}\r
+      }\r
+   }\r
+}\r
index b13b38d1348f4992280d248706dae4c7cd94efc7..b2ae6693ec6c22bc2d1adfa8c415ef8a2761b271 100644 (file)
@@ -1,70 +1,55 @@
-//
-// System.Web.HttpCookieCollection.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-using System.Collections.Specialized;
-
-namespace System.Web
-{
-        public sealed class HttpCookieCollection : NameObjectCollectionBase
-        {
-                public HttpCookieCollection() {}
-                public string[] AllKeys
-                {
-                        get
-                        {
-                                return this.BaseGetAllKeys();
-                        }
-                }
-                public HttpCookie this[int index]
-                {
-                        get
-                        {
-                                return (HttpCookie)(this.BaseGet(index));
-                        }
-                }
-                public HttpCookie this[string name]
-                {
-                        get
-                        {
-                                return (HttpCookie)(this.BaseGet(name));
-                        }
-                }
-                public void Add(HttpCookie cookie)
-                {
-                        this.BaseAdd(cookie.Name, cookie);
-                }
-                public void Clear()
-                {
-                        this.BaseClear();
-                }
-                public void CopyTo(Array dest, int index)
-                {
-                        int i;
-                        HttpCookie cookie;
-                        for(i=0; i<this.Count; i++)
-                        {
-                                cookie=this[i];
-                                dest.SetValue(new HttpCookie(cookie.Name, cookie.Value), index+i);
-                        }
-                }
-                public string GetKey(int index)
-                {
-                        return this.BaseGetKey(index);
-                }
-                public void Remove(string name)
-                {
-                        this.BaseRemove(name);
-                }
-                public void Set(HttpCookie cookie)
-                {
-                        this.BaseSet(cookie.Name, cookie);
-                }
-        }
-}
+//\r
+// System.Web.HttpCookieCollection.cs\r
+//\r
+// Author:\r
+//   Bob Smith <bob@thestuff.net>\r
+//\r
+// (C) Bob Smith\r
+//\r
+\r
+using System;\r
+using System.Collections.Specialized;\r
+\r
+namespace System.Web {\r
+   public sealed class HttpCookieCollection : NameObjectCollectionBase {\r
+      public HttpCookieCollection() {}\r
+      public string[] AllKeys {\r
+         get {\r
+            return this.BaseGetAllKeys();\r
+         }\r
+      }\r
+      public HttpCookie this[int index] {\r
+         get {\r
+            return (HttpCookie)(this.BaseGet(index));\r
+         }\r
+      }\r
+      public HttpCookie this[string name] {\r
+         get {\r
+            return (HttpCookie)(this.BaseGet(name));\r
+         }\r
+      }\r
+      public void Add(HttpCookie cookie) {\r
+         this.BaseAdd(cookie.Name, cookie);\r
+      }\r
+      public void Clear() {\r
+         this.BaseClear();\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
+         }\r
+      }\r
+      public string GetKey(int index) {\r
+         return this.BaseGetKey(index);\r
+      }\r
+      public void Remove(string name) {\r
+         this.BaseRemove(name);\r
+      }\r
+      public void Set(HttpCookie cookie) {\r
+         this.BaseSet(cookie.Name, cookie);\r
+      }\r
+   }\r
+}\r
index 4dcf4621a675e11191b1407d88b8830166d1a632..cb3a4f4092946973ed6542b74645aaef76dd0c62 100644 (file)
-/**\r
- * Namespace: System.Web\r
- * Class:     HttpRuntime\r
- *\r
- * Author:  Gaurav Vaish\r
- * Contact: <gvaish@iitk.ac.in>\r
- * Status:  ?%\r
- *\r
- * (C) Gaurav Vaish (2001)\r
- */\r
-\r
+// \r
+// System.Web.HttpRuntime\r
+//\r
+// Author:\r
+//   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
+//   Gaurav Vaish (gvaish@iitk.ac.in)\r
+//\r
 using System;\r
+using System.Collections;\r
 using System.Security;\r
 using System.Security.Permissions;\r
-using System.Web.Caching;\r
 using System.Web.UI;\r
 using System.Web.Utils;\r
+using System.Web.Caching;\r
 \r
-namespace System.Web\r
-{\r
-       public sealed class HttpRuntime\r
-       {\r
-               internal static byte[]  autogenKeys;\r
-\r
-               private static bool        initialized;\r
-               private static string      installDir;\r
-               private static HttpRuntime runtime;\r
-\r
-               /// <summary>\r
-               /// Loading of ISAPI\r
-               /// </summary>\r
-               private static bool        isapiLoaded;\r
-\r
-               private Cache cache;\r
-\r
-               // Security permission helper objects\r
-               private static IStackWalk appPathDiscoveryStackWalk;\r
-               private static IStackWalk ctrlPrincipalStackWalk;\r
-               private static IStackWalk sensitiveInfoStackWalk;\r
-               private static IStackWalk unmgdCodeStackWalk;\r
-               private static IStackWalk unrestrictedStackWalk;\r
-               private static IStackWalk reflectionStackWalk;\r
-\r
-               private string appDomainAppPath;\r
-               private string appDomainAppVirtualPath;\r
-\r
-               private FileChangesMonitor fcm;\r
-\r
-               private Exception initErrorException;\r
-\r
-               static HttpRuntime()\r
-               {\r
-                       autogenKeys = new byte[88];\r
-                       initialized = false;\r
-                       isapiLoaded = false;\r
-\r
-                       appPathDiscoveryStackWalk = null;\r
-                       ctrlPrincipalStackWalk    = null;\r
-                       sensitiveInfoStackWalk    = null;\r
-                       unmgdCodeStackWalk        = null;\r
-                       unrestrictedStackWalk     = null;\r
-\r
-                       if(!DesignTimeParseData.InDesigner)\r
-                               Initialize();\r
-                       runtime     = new HttpRuntime();\r
-                       if(!DesignTimeParseData.InDesigner)\r
-                               runtime.Init();\r
-               }\r
-\r
-               //FIXME: IIS specific code. Need information on what to do for Apache?\r
-               internal static void Initialize()\r
-               {\r
-                       if(!initialized)\r
-                       {\r
-                               bool moduleObtained = false;\r
-                               string file = IISVersionInfo.GetLoadedModuleFilename("aspnet_isapi.dll");\r
-                               string dir = null;\r
-                               string version = null;\r
-                               if(file!=null)\r
-                               {\r
-                                       dir = file.Substring(0, file.LastIndexOf('\\'));\r
-                                       moduleObtained = true;\r
-                               }\r
-                               if(dir!=null && dir.Length > 0)\r
-                               {\r
-                                       try\r
-                                       {\r
-                                               version = IISVersionInfo.SystemWebVersion;\r
-                                               /* TODO: I need the code to read registry\r
-                                                * I need LOCAL_MACHINE\Software\Micorosoft\ASP.NET\<version>\r
-                                               */\r
-                                       } catch\r
-                                       {\r
-                                               dir = null;\r
-                                       }\r
-                               }\r
-                               if(dir==null || dir.Length == 0)\r
-                               {\r
-                                       string modulefile = (typeof(HttpRuntime)).Module.FullyQualifiedName;\r
-                                       dir = modulefile.Substring(0, modulefile.LastIndexOf('\\'));\r
-                               }\r
-                               if(!moduleObtained)\r
-                               {\r
-                                       //TODO: Now what? Module still not obtained\r
-                                       // Try loading using native calls. something like LoadLibrary(...) in *java*\r
-                                       // LoadLibrary(dir+"\\aspnet_asp.dll)\r
-                               }\r
-                               if(moduleObtained)\r
-                               {\r
-                                       //TODO: Initialize the library\r
-                                       // InitIsapiLibrary();\r
-                               }\r
-                               installDir  = dir;\r
-                               isapiLoaded = moduleObtained;\r
-                               initialized = true;\r
-                       }\r
-               }\r
-\r
-               [MonoTODO("Init")]\r
-               private void Init()\r
-               {\r
-                       initErrorException = null;\r
-                       cache = new Cache();\r
-                       appDomainAppPath = "";\r
-\r
-                       try\r
-                       {\r
-                               //FIXME: OS Check?\r
-                               //if(false)\r
-                               //      throw new PlatformNotSupportedException();\r
-                               //I am here <gvaish>\r
-                               throw new NotImplementedException();\r
-                       } catch(Exception e)\r
-                       {\r
-                               initErrorException = e;\r
-                       }\r
-               }\r
-\r
-               internal static string FormatResourceString(string key)\r
-               {\r
-                       return GetResourceString(key);\r
-               }\r
-\r
-               internal static string FormatResourceString(string key, string arg0)\r
-               {\r
-                       string format = GetResourceString(key);\r
-                       if(format==null)\r
-                               return null;\r
-                       return String.Format(format, arg0);\r
-               }\r
-\r
-               [MonoTODO("FormatResourceString(string, string, string)")]\r
-               internal static string FormatResourceString(string key, string arg0, string type)\r
-               {\r
-                       // String.Format(string, object, object);\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               [MonoTODO("FormatResourceString(string, string, string, string)")]\r
-               internal static string FormatResourceString(string key, string arg0, string arg1, string arg2)\r
-               {\r
-                       // String.Format(string, object, object, object);\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               [MonoTODO("FormatResourceString(string, string[]")]\r
-               internal static string FormatResourceString(string key, string[] args)\r
-               {\r
-                       // String.Format(string, object[]);\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               private static string GetResourceString(string key)\r
-               {\r
-                       return runtime.GetResourceStringFromResourceManager(key);\r
-               }\r
-\r
-               [MonoTODO("GetResourceStringFromResourceManager(string)")]\r
-               private string GetResourceStringFromResourceManager(string key)\r
-               {\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               public static Cache Cache\r
-               {\r
-                       get\r
-                       {\r
-                               return runtime.cache;\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string AppDomainAppId\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string AppDomainAppPath\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string AppDomainAppVirtualPath\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string AppDomainId\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string AspInstallDirectory\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string BinDirectory\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string ClrInstallDirectory\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string CodegenDir\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static bool IsOnUNCShare\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static string MachineConfigurationDirectory\r
-               {\r
-                       get\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static void Close()\r
-               {\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               internal static IStackWalk AppPathDiscovery\r
-               {\r
-                       get\r
-                       {\r
-                               if(appPathDiscoveryStackWalk == null)\r
-                               {\r
-                                       appPathDiscoveryStackWalk = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, runtime.appDomainAppPath);\r
-                               }\r
-                               return appPathDiscoveryStackWalk;\r
-                       }\r
-               }\r
-\r
-               internal static IStackWalk ControlPrincipal\r
-               {\r
-                       get\r
-                       {\r
-                               if(ctrlPrincipalStackWalk == null)\r
-                               {\r
-                                       ctrlPrincipalStackWalk = new SecurityPermission(SecurityPermissionFlag.ControlPrincipal);\r
-                               }\r
-                               return ctrlPrincipalStackWalk;\r
-                       }\r
-               }\r
-\r
-               internal static IStackWalk Reflection\r
-               {\r
-                       get\r
-                       {\r
-                               if(reflectionStackWalk == null)\r
-                               {\r
-                                       reflectionStackWalk = new ReflectionPermission(ReflectionPermissionFlag.TypeInformation | ReflectionPermissionFlag.MemberAccess);\r
-                               }\r
-                               return reflectionStackWalk;\r
-                       }\r
-               }\r
-\r
-               internal static IStackWalk SensitiveInformation\r
-               {\r
-                       get\r
-                       {\r
-                               if(sensitiveInfoStackWalk == null)\r
-                               {\r
-                                       sensitiveInfoStackWalk = new EnvironmentPermission(PermissionState.Unrestricted);\r
-                               }\r
-                               return sensitiveInfoStackWalk;\r
-                       }\r
-               }\r
-\r
-               internal static IStackWalk UnmanagedCode\r
-               {\r
-                       get\r
-                       {\r
-                               if(unmgdCodeStackWalk == null)\r
-                               {\r
-                                       unmgdCodeStackWalk = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);\r
-                               }\r
-                               return unmgdCodeStackWalk;\r
-                       }\r
-               }\r
-\r
-               internal static IStackWalk Unrestricted\r
-               {\r
-                       get\r
-                       {\r
-                               if(unrestrictedStackWalk == null)\r
-                               {\r
-                                       unrestrictedStackWalk = new PermissionSet(PermissionState.Unrestricted);\r
-                               }\r
-                               return unrestrictedStackWalk;\r
-                       }\r
-               }\r
-\r
-               internal static IStackWalk FileReadAccess(string file)\r
-               {\r
-                       return new FileIOPermission(FileIOPermissionAccess.Read, file);\r
-               }\r
-\r
-               internal static IStackWalk PathDiscoveryAccess(string path)\r
-               {\r
-                       return new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path);\r
-               }\r
-       }\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
+      // Security permission helper objects\r
+      private static IStackWalk appPathDiscoveryStackWalk;\r
+      private static IStackWalk ctrlPrincipalStackWalk;\r
+      private static IStackWalk sensitiveInfoStackWalk;\r
+      private static IStackWalk unmgdCodeStackWalk;\r
+      private static IStackWalk unrestrictedStackWalk;\r
+      private static IStackWalk reflectionStackWalk;\r
+\r
+      private static HttpRuntime _Runtime;\r
+      private Cache _Cache;\r
+\r
+      // TODO: Temp to test the framework..\r
+      IHttpHandler   _Handler;\r
+\r
+      static HttpRuntime() {\r
+         appPathDiscoveryStackWalk = null;\r
+         ctrlPrincipalStackWalk    = null;\r
+         sensitiveInfoStackWalk    = null;\r
+         unmgdCodeStackWalk        = null;\r
+         unrestrictedStackWalk     = null;\r
+         \r
+         _Runtime = new HttpRuntime();\r
+      }\r
+\r
+      public HttpRuntime() {\r
+         Init();\r
+      }\r
+\r
+      private void Init() {\r
+         _Cache = new Cache();\r
+      }\r
+\r
+      public static IHttpHandler Handler {\r
+         get {\r
+            return _Runtime._Handler;\r
+         }\r
+\r
+         set {\r
+            _Runtime._Handler = value;\r
+         }\r
+      }\r
+\r
+      public static void ProcessRequest(HttpWorkerRequest Request) {\r
+         if (null == _Runtime._Handler) {\r
+            throw new ArgumentException("No handler");\r
+         }\r
+\r
+         // just a test method to test the framework\r
+\r
+         HttpContext oContext = new HttpContext(Request);\r
+         _Runtime._Handler.ProcessRequest(oContext);\r
+\r
+         oContext.Response.FlushAtEndOfRequest();\r
+         Request.EndOfRequest();\r
+      }\r
+\r
+      public static Cache Cache {\r
+         get {\r
+            return _Runtime._Cache;\r
+         }\r
+      }      \r
+\r
+      [MonoTODO]\r
+      public static string AppDomainAppId {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string AppDomainAppPath {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string AppDomainAppVirtualPath {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string AppDomainId {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string AspInstallDirectory {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string BinDirectory {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string ClrInstallDirectory {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string CodegenDir {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static bool IsOnUNCShare {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static string MachineConfigurationDirectory {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      [MonoTODO]\r
+      public static void Close() {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      internal static string FormatResourceString(string key) {\r         return GetResourceString(key);\r      }\r\r
+      internal static string FormatResourceString(string key, string arg0) {\r
+         string format = GetResourceString(key);\r
+         if(format==null)\r
+            return null;\r
+         return String.Format(format, arg0);\r
+      }\r
+\r
+      [MonoTODO("FormatResourceString(string, string, string)")]\r
+      internal static string FormatResourceString(string key, string arg0, string type) {\r
+         // String.Format(string, object, object);\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO("FormatResourceString(string, string, string, string)")]\r
+      internal static string FormatResourceString(string key, string arg0, string arg1, string arg2) {\r
+         // String.Format(string, object, object, object);\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO("FormatResourceString(string, string[]")]\r
+      internal static string FormatResourceString(string key, string[] args) {\r
+         // String.Format(string, object[]);\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      private static string GetResourceString(string key) {\r
+         return _Runtime.GetResourceStringFromResourceManager(key);\r
+      }\r
+\r
+      [MonoTODO("GetResourceStringFromResourceManager(string)")]\r
+      private string GetResourceStringFromResourceManager(string key) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO("Get Application path from the appdomain object")]\r
+      internal static IStackWalk AppPathDiscovery {\r
+         get {\r
+            if(appPathDiscoveryStackWalk == null) {\r
+               appPathDiscoveryStackWalk = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, "<apppath>");\r
+            }\r
+            return appPathDiscoveryStackWalk;\r
+         }\r
+      }\r
+\r
+      internal static IStackWalk ControlPrincipal {\r
+         get {\r
+            if(ctrlPrincipalStackWalk == null) {\r
+               ctrlPrincipalStackWalk = new SecurityPermission(SecurityPermissionFlag.ControlPrincipal);\r
+            }\r
+            return ctrlPrincipalStackWalk;\r
+         }\r
+      }\r
+\r
+      internal static IStackWalk Reflection {\r
+         get {\r
+            if(reflectionStackWalk == null) {\r
+               reflectionStackWalk = new ReflectionPermission(ReflectionPermissionFlag.TypeInformation | ReflectionPermissionFlag.MemberAccess);\r
+            }\r
+            return reflectionStackWalk;\r
+         }\r
+      }\r
+\r
+      internal static IStackWalk SensitiveInformation {\r
+         get {\r
+            if(sensitiveInfoStackWalk == null) {\r
+               sensitiveInfoStackWalk = new EnvironmentPermission(PermissionState.Unrestricted);\r
+            }\r
+            return sensitiveInfoStackWalk;\r
+         }\r
+      }\r
+\r
+      internal static IStackWalk UnmanagedCode {\r
+         get {\r
+            if(unmgdCodeStackWalk == null) {\r
+               unmgdCodeStackWalk = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);\r
+            }\r
+            return unmgdCodeStackWalk;\r
+         }\r
+      }\r
+\r
+      internal static IStackWalk Unrestricted {\r
+         get {\r
+            if(unrestrictedStackWalk == null) {\r
+               unrestrictedStackWalk = new PermissionSet(PermissionState.Unrestricted);\r
+            }\r
+            return unrestrictedStackWalk;\r
+         }\r
+      }\r
+\r
+      internal static IStackWalk FileReadAccess(string file) {\r
+         return new FileIOPermission(FileIOPermissionAccess.Read, file);\r
+      }\r
+\r
+      internal static IStackWalk PathDiscoveryAccess(string path) {\r
+         return new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path);\r
+      }\r
+   }\r
 }\r
index 3a75b23520267d44da45517a69f2758bb38165cf..e58e1db1aaffae8fa25b2713eef2090fd8eb0fc0 100644 (file)
  * Class:     HttpServerUtility\r
  *\r
  * Author:  Wictor Wilén\r
- * Contact: <wictor@ibizkit.se>\r
+ * Contact: <wictor@ibizkit.se>, <patrik.torstensson@labs2.com>\r
  * Status:  ?%\r
  *\r
  * (C) Wictor Wilén (2002)\r
  * ---------------------------------------\r
  * 2002-03-27  Wictor          Started implementation\r
- * \r
- * TODO: move the encoding/decoding to the HttpUtility class   \r
+ * 2002-04-09  Patrik      Added HttpContext constructor\r
+ * 2002-04-10  Patrik      Moved encoding to HttpUtility and\r
+ *                         fixed all functions that used\r
+ *                         HttpContext\r
  * \r
  */\r
 using System;\r
 using System.IO;\r
 \r
-namespace System.Web\r
-{\r
-       /// <summary>\r
-       /// System.Web.\r
-       /// </summary>\r
-       public sealed class HttpServerUtility\r
-       {\r
-\r
-               // private stuff\r
-               private const string _hex = "0123456789ABCDEF";\r
-               private const string _chars = "<>;:.?=&@*+%/\\";\r
-               private static string _name = "";\r
-               \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
                \r
-               [MonoTODO()]\r
-               public HttpServerUtility(HttpContext Context)\r
-               {\r
-               }\r
+      [MonoTODO()]\r
+      public HttpServerUtility(HttpContext Context) {\r
+         _Context = Context;\r
+      }\r
                \r
-               // Properties\r
-\r
-\r
-               /// <summary>\r
-               /// Gets the server's computer name.\r
-               /// </summary>\r
-               public string MachineName \r
-               {\r
-                       get\r
-                       {\r
-                               if(_name.Length == 0)\r
-                               {\r
-                                       _name = Environment.MachineName;\r
-                               }\r
-                               return _name;\r
-                       }\r
-               }\r
-               /// <summary>\r
-               /// Gets and sets the request time-out in seconds.\r
-               /// </summary>\r
-               [MonoTODO()]\r
-               public int ScriptTimeout \r
-               {\r
-                       get\r
-                       {\r
-                               throw new System.NotImplementedException();\r
-                       } \r
-                       set\r
-                       {\r
-                               throw new System.NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               // Methods\r
-\r
-               /// <summary>\r
-               /// Clears the previous exception.\r
-               /// </summary>\r
-               [MonoTODO()]\r
-               public void ClearError()\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
+      // Properties\r
+\r
+\r
+      /// <summary>\r
+      /// Gets the server's computer name.\r
+      /// </summary>\r
+      public string MachineName {\r
+         get {\r
+            if(_name.Length == 0) {\r
+               _name = Environment.MachineName;\r
+            }\r
+            return _name;\r
+         }\r
+      }\r
+      /// <summary>\r
+      /// Gets and sets the request time-out in seconds.\r
+      /// </summary>\r
+      [MonoTODO()]\r
+      public int ScriptTimeout {\r
+         get {\r
+            throw new System.NotImplementedException();\r
+         } \r
+         set {\r
+            throw new System.NotImplementedException();\r
+         }\r
+      }\r
+\r
+      // Methods\r
+\r
+      /// <summary>\r
+      /// Clears the previous exception.\r
+      /// </summary>\r
+      public void ClearError() {\r
+         _Context.ClearError();\r
+      }\r
 \r
                \r
-               /// <summary>\r
-               /// Creates a server instance of a COM object identified by the object's Programmatic Identifier (ProgID).\r
-               /// </summary>\r
-               /// <param name="progID">The class or type of object to be instantiated. </param>\r
-               /// <returns>The new object.</returns>\r
-               public object CreateObject(string progID)\r
-               {\r
-                       return CreateObject(Type.GetTypeFromProgID(progID));\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Creates a server instance of a COM object identified by the object's type.\r
-               /// </summary>\r
-               /// <param name="type">A Type representing the object to create. </param>\r
-               /// <returns>The new object.</returns>\r
-               [MonoTODO()]\r
-               public object CreateObject(Type type)\r
-               {       \r
-                       Object o;\r
-                       o = Activator.CreateInstance(type);\r
+      /// <summary>\r
+      /// Creates a server instance of a COM object identified by the object's Programmatic Identifier (ProgID).\r
+      /// </summary>\r
+      /// <param name="progID">The class or type of object to be instantiated. </param>\r
+      /// <returns>The new object.</returns>\r
+      public object CreateObject(string progID) {\r
+         return CreateObject(Type.GetTypeFromProgID(progID));\r
+      }\r
+\r
+\r
+      /// <summary>\r
+      /// Creates a server instance of a COM object identified by the object's type.\r
+      /// </summary>\r
+      /// <param name="type">A Type representing the object to create. </param>\r
+      /// <returns>The new object.</returns>\r
+      [MonoTODO()]\r
+      public object CreateObject(Type type) {  \r
+         Object o;\r
+         o = Activator.CreateInstance(type);\r
                        \r
-                       // TODO: Call OnStartPage()\r
-\r
-                       return o;\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Creates a server instance of a COM object identified by the object's class identifier (CLSID).\r
-               /// </summary>\r
-               /// <param name="clsid">The class identifier of the object to be instantiated. </param>\r
-               /// <returns>The new object.</returns>\r
-               public object CreateObjectFromClsid(string clsid)\r
-               {\r
-                       Guid guid = new Guid(clsid);\r
-                       return CreateObject(Type.GetTypeFromCLSID(guid));\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Executes a request to another page using the specified URL path to the page.\r
-               /// </summary>\r
-               /// <param name="path">The URL path of the new request. </param>\r
-               [MonoTODO()]\r
-               public void Execute(string path)\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Executes a request to another page using the specified URL path to the page. A TextWriter captures output from the page.\r
-               /// </summary>\r
-               /// <param name="path">The URL path of the new request. </param>\r
-               /// <param name="writer">The TextWriter to capture the output. </param>\r
-               [MonoTODO()]\r
-               public void Execute(string path, TextWriter writer )\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-\r
-               /// <summary>\r
-               /// Returns the previous exception.\r
-               /// </summary>\r
-               /// <returns>The previous exception that was thrown.</returns>\r
-               [MonoTODO()]\r
-               public Exception GetLastError()\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-\r
-               /// <summary>\r
-               /// Decodes an HTML-encoded string and returns the decoded string.\r
-               /// </summary>\r
-               /// <param name="s">The HTML string to decode. </param>\r
-               /// <returns>The decoded text.</returns>\r
-               [MonoTODO()]\r
-               public string HtmlDecode(string s)\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.\r
-               /// </summary>\r
-               /// <param name="s">The HTML string to decode</param>\r
-               /// <param name="output">The TextWriter output stream containing the decoded string. </param>\r
-               [MonoTODO()]\r
-               public void HtmlDecode(string s, TextWriter output)\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-\r
-               /// <summary>\r
-               /// HTML-encodes a string and returns the encoded string.\r
-               /// </summary>\r
-               /// <param name="s">The text string to encode. </param>\r
-               /// <returns>The HTML-encoded text.</returns>\r
-               public string HtmlEncode(string s)\r
-               {\r
-                       string dest = "";\r
-                       long len = s.Length;\r
-                       int v;\r
-\r
-\r
-\r
-                       for(int i = 0; i < len; i++)\r
-                       {\r
-                               switch(s[i])\r
-                               {\r
-                                       case '>':\r
-                                               dest += "&gt;";\r
-                                               break;\r
-                                       case '<':\r
-                                               dest += "&lt;";\r
-                                               break;\r
-                                       case '"':\r
-                                               dest += "&quot;";\r
-                                               break;\r
-                                       case '&':\r
-                                               dest += "&amp;";\r
-                                               break;\r
-                                       default:\r
-                                               if(s[i] >= 128)\r
-                                               {\r
-                                                       dest += "&H";\r
-                                                       v = (int) s[i];\r
-                                                       dest += v.ToString() ;\r
-                                                       \r
-                                               }\r
-                                               else\r
-                                                       dest += s[i];\r
-                                               break;\r
-                               }\r
-                       }\r
-                       return dest;\r
-               }\r
-\r
-\r
-               \r
-\r
-               /// <summary>\r
-               /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.\r
-               /// </summary>\r
-               /// <param name="s">The string to encode. </param>\r
-               /// <param name="output">The TextWriter output stream containing the encoded string. </param>\r
-               public void HtmlEncode( string s, TextWriter output)\r
-               {\r
-                       output.Write(HtmlEncode(s));\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Returns the physical file path that corresponds to the specified virtual path on the Web server.\r
-               /// </summary>\r
-               /// <param name="path">The virtual path on the Web server. </param>\r
-               /// <returns>The physical file path that corresponds to path.</returns>\r
-               [MonoTODO()]\r
-               public string MapPath(string path)\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-\r
-               /// <summary>\r
-               /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page.\r
-               /// </summary>\r
-               /// <param name="path">The URL path of the new page on the server to execute. </param>\r
-               [MonoTODO()]\r
-               public void Transfer(string path)\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page. Specifies whether to clear the QueryString and Form collections.\r
-               /// </summary>\r
-               /// <param name="path">The URL path of the new page on the server to execute. </param>\r
-               /// <param name="preserveForm">If true, the QueryString and Form collections are preserved. If false, they are cleared. The default is false. </param>\r
-               [MonoTODO()]\r
-               public void Transfer(string path, bool preserveForm     )\r
-               {\r
-                       throw new System.NotImplementedException();\r
-               }\r
-\r
-\r
-\r
-               /// <summary>\r
-               /// URL-decodes a string and returns the decoded string.\r
-               /// </summary>\r
-               /// <param name="s">The text string to decode. </param>\r
-               /// <returns>The decoded text.</returns>\r
-               /// <remarks>\r
-               /// Post/html encoding @ ftp://ftp.isi.edu/in-notes/rfc1866.txt\r
-               /// Uncomment the line marked with RFC1738 to get pure RFC1738\r
-               /// and it will also consider the RFC1866 (ftp://ftp.isi.edu/in-notes/rfc1866.txt)\r
-               /// `application/x-www-form-urlencoded' format\r
-               /// </remarks>\r
-               public string UrlDecode(string s)\r
-               {\r
-                       string dest = "";\r
-                       long len = s.Length;\r
-                       string tmp = "";\r
-\r
-\r
-                       for(int i = 0; i < len; i++)\r
-                       {\r
-                               if(s[i] == '%')\r
-                               {\r
-                                       tmp = s[i+1].ToString ();\r
-                                       tmp += s[i+2];\r
-                                       dest += char.Parse(tmp);\r
-                               } \r
-                               else if( s[i] == '+')\r
-                               {\r
-                                       dest += " ";\r
-                               }\r
-                               else\r
-                                       dest += s[i];\r
-\r
-                       }\r
-                       return dest;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.\r
-               /// </summary>\r
-               /// <param name="s"></param>\r
-               /// <param name="output"></param>\r
-               public void UrlDecode(string s, TextWriter output)\r
-               {\r
-                       output.Write(UrlDecode(s));\r
-               }\r
-\r
-               /// <summary>\r
-               /// URL-encodes a string and returns the encoded string.\r
-               /// </summary>\r
-               /// <param name="s">The text to URL-encode. </param>\r
-               /// <returns>The URL encoded text.</returns>\r
-               public string UrlEncode(string s)\r
-               {\r
-                       string dest = "";\r
-                       long len = s.Length;\r
-                       int h1, h2;\r
-\r
-\r
-                       for(int i = 0; i < len; i++)\r
-                       {\r
-                               if(s[i] == ' ') // space character is replaced with '+'\r
-                                       dest += "+";\r
-                               else if ( _chars.IndexOf(s[i]) >= 0 )\r
-                               {\r
-                                       h1 = (int)s[i] % 16;\r
-                                       h2 = (int)s[i] / 16;\r
-                                       dest += "%";\r
-                                       dest += _hex[h1].ToString();\r
-                                       dest += _hex[h2].ToString();\r
-                               }\r
-                               else\r
-                                       dest += s[i].ToString();\r
-\r
-                       }\r
-                       return dest;\r
-               }\r
-\r
-               /// <summary>\r
-               /// URL encodes a string and sends the resulting output to a TextWriter output stream.\r
-               /// </summary>\r
-               /// <param name="s">The text string to encode. </param>\r
-               /// <param name="output">The TextWriter output stream containing the encoded string. </param>\r
-               public void UrlEncode(string s, TextWriter output)\r
-               {\r
-                       output.Write(UrlEncode(s));\r
-               }\r
-\r
-               /// <summary>\r
-               /// URL-encodes the path portion of a URL string and returns the encoded string.\r
-               /// </summary>\r
-               /// <param name="s">The text to URL-encode.</param>\r
-               /// <returns>The URL encoded text.</returns>\r
-               /// <remarks>Does not do any browser specific adjustments, just encode everything</remarks>\r
-               public string UrlPathEncode(string s)\r
-               {\r
-                       // find the path portion (?)\r
-                       int idx = s.IndexOf("?");\r
-                       string s2 = s.Substring(0, idx-1);\r
-                       s2 = UrlEncode(s2);\r
-                       s2 += s.Substring(idx);\r
-\r
-                       return s2;\r
-               }\r
-\r
-       }\r
+         // TODO: Call OnStartPage()\r
+\r
+         return o;\r
+      }\r
+\r
+\r
+      /// <summary>\r
+      /// Creates a server instance of a COM object identified by the object's class identifier (CLSID).\r
+      /// </summary>\r
+      /// <param name="clsid">The class identifier of the object to be instantiated. </param>\r
+      /// <returns>The new object.</returns>\r
+      public object CreateObjectFromClsid(string clsid) {\r
+         Guid guid = new Guid(clsid);\r
+         return CreateObject(Type.GetTypeFromCLSID(guid));\r
+      }\r
+\r
+\r
+      /// <summary>\r
+      /// Executes a request to another page using the specified URL path to the page.\r
+      /// </summary>\r
+      /// <param name="path">The URL path of the new request. </param>\r
+      [MonoTODO()]\r
+      public void Execute(string path) {\r
+         throw new System.NotImplementedException();\r
+      }\r
+\r
+\r
+      /// <summary>\r
+      /// Executes a request to another page using the specified URL path to the page. A TextWriter captures output from the page.\r
+      /// </summary>\r
+      /// <param name="path">The URL path of the new request. </param>\r
+      /// <param name="writer">The TextWriter to capture the output. </param>\r
+      [MonoTODO()]\r
+      public void Execute(string path, TextWriter writer ) {\r
+         throw new System.NotImplementedException();\r
+      }\r
+\r
+\r
+\r
+      /// <summary>\r
+      /// Returns the previous exception.\r
+      /// </summary>\r
+      /// <returns>The previous exception that was thrown.</returns>\r
+      [MonoTODO()]\r
+      public Exception GetLastError() {\r
+         throw new System.NotImplementedException();\r
+      }\r
+\r
+\r
+\r
+      /// <summary>\r
+      /// Decodes an HTML-encoded string and returns the decoded string.\r
+      /// </summary>\r
+      /// <param name="s">The HTML string to decode. </param>\r
+      /// <returns>The decoded text.</returns>\r
+      [MonoTODO()]\r
+      public string HtmlDecode(string s) {\r
+         return HttpUtility.HtmlDecode(s);\r
+      }\r
+\r
+\r
+      /// <summary>\r
+      /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.\r
+      /// </summary>\r
+      /// <param name="s">The HTML string to decode</param>\r
+      /// <param name="output">The TextWriter output stream containing the decoded string. </param>\r
+      public void HtmlDecode(string s, TextWriter output) {\r
+         output.Write(HttpUtility.HtmlDecode(s));\r
+      }\r
+\r
+      /// <summary>\r
+      /// HTML-encodes a string and returns the encoded string.\r
+      /// </summary>\r
+      /// <param name="s">The text string to encode. </param>\r
+      /// <returns>The HTML-encoded text.</returns>\r
+      public string HtmlEncode(string s) {\r
+         return HttpUtility.HtmlEncode(s);\r
+      }\r
+\r
+      /// <summary>\r
+      /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.\r
+      /// </summary>\r
+      /// <param name="s">The string to encode. </param>\r
+      /// <param name="output">The TextWriter output stream containing the encoded string. </param>\r
+      public void HtmlEncode(  string s, TextWriter output) {\r
+         output.Write(HtmlEncode(s));\r
+      }\r
+\r
+\r
+      /// <summary>\r
+      /// Returns the physical file path that corresponds to the specified virtual path on the Web server.\r
+      /// </summary>\r
+      /// <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
+         return _Context.Request.MapPath(path);\r
+      }\r
+\r
+      /// <summary>\r
+      /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page.\r
+      /// </summary>\r
+      /// <param name="path">The URL path of the new page on the server to execute. </param>\r
+      [MonoTODO()]\r
+      public void Transfer(string path) {\r
+         throw new System.NotImplementedException();\r
+      }\r
+\r
+      /// <summary>\r
+      /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page. Specifies whether to clear the QueryString and Form collections.\r
+      /// </summary>\r
+      /// <param name="path">The URL path of the new page on the server to execute. </param>\r
+      /// <param name="preserveForm">If true, the QueryString and Form collections are preserved. If false, they are cleared. The default is false. </param>\r
+      [MonoTODO()]\r
+      public void Transfer(string path, bool preserveForm      ) {\r
+         throw new System.NotImplementedException();\r
+      }\r
+\r
+      /// <summary>\r
+      /// URL-decodes a string and returns the decoded string.\r
+      /// </summary>\r
+      /// <param name="s">The text string to decode. </param>\r
+      /// <returns>The decoded text.</returns>\r
+      /// <remarks>\r
+      /// Post/html encoding @ ftp://ftp.isi.edu/in-notes/rfc1866.txt\r
+      /// Uncomment the line marked with RFC1738 to get pure RFC1738\r
+      /// and it will also consider the RFC1866 (ftp://ftp.isi.edu/in-notes/rfc1866.txt)\r
+      /// `application/x-www-form-urlencoded' format\r
+      /// </remarks>\r
+      public string UrlDecode(string s) {\r
+         return HttpUtility.UrlDecode(s);\r
+      }\r
+\r
+      /// <summary>\r
+      /// Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.\r
+      /// </summary>\r
+      /// <param name="s"></param>\r
+      /// <param name="output"></param>\r
+      public void UrlDecode(string s, TextWriter output) {\r
+         output.Write(UrlDecode(s));\r
+      }\r
+\r
+      /// <summary>\r
+      /// URL-encodes a string and returns the encoded string.\r
+      /// </summary>\r
+      /// <param name="s">The text to URL-encode. </param>\r
+      /// <returns>The URL encoded text.</returns>\r
+      public string UrlEncode(string s) {\r
+         return HttpUtility.UrlEncode(s);\r
+      }\r
+\r
+      /// <summary>\r
+      /// URL encodes a string and sends the resulting output to a TextWriter output stream.\r
+      /// </summary>\r
+      /// <param name="s">The text string to encode. </param>\r
+      /// <param name="output">The TextWriter output stream containing the encoded string. </param>\r
+      public void UrlEncode(string s,  TextWriter output) {\r
+         output.Write(UrlEncode(s));\r
+      }\r
+\r
+      /// <summary>\r
+      /// URL-encodes the path portion of a URL string and returns the encoded string.\r
+      /// </summary>\r
+      /// <param name="s">The text to URL-encode.</param>\r
+      /// <returns>The URL encoded text.</returns>\r
+      /// <remarks>Does not do any browser specific adjustments, just encode everything</remarks>\r
+      public string UrlPathEncode(string s) {\r
+         // find the path portion (?)\r
+         int idx = s.IndexOf("?");\r
+         string s2 = s.Substring(0, idx-1);\r
+         s2 = UrlEncode(s2);\r
+         s2 += s.Substring(idx);\r
+\r
+         return s2;\r
+      }\r
+\r
+   }\r
 }\r
index 88504cb55cdf7db673ab9876eadfeaa038a1715b..d52d047002a0e7f97c3171f1eb4d0f4c712740f5 100644 (file)
-//
-// System.Web.HttpWorkerRequest.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-using System;
-
-namespace System.Web
-{
-        public abstract class HttpWorkerRequest
-        {
-                public const int HeaderAccept = 20;
-                public const int HeaderAcceptCharset = 21;
-                public const int HeaderAcceptEncoding = 22;
-                public const int HeaderAcceptLanguage = 23;
-                public const int HeaderAcceptRanges = 20;
-                public const int HeaderAge = 21;
-                public const int HeaderAllow = 10;
-                public const int HeaderAuthorization = 24;
-                public const int HeaderCacheControl = 0;
-                public const int HeaderConnection = 1;
-                public const int HeaderContentEncoding = 13;
-                public const int HeaderContentLanguage = 14;
-                public const int HeaderContentLength = 11;
-                public const int HeaderContentLocation = 15;
-                public const int HeaderContentMd5 = 16;
-                public const int HeaderContentRange = 17;
-                public const int HeaderContentType = 12;
-                public const int HeaderCookie = 25;
-                public const int HeaderDate = 2;
-                public const int HeaderEtag = 22;
-                public const int HeaderExpect = 26;
-                public const int HeaderExpires = 18;
-                public const int HeaderFrom = 27;
-                public const int HeaderHost = 28;
-                public const int HeaderIfMatch = 29;
-                public const int HeaderIfModifiedSince = 30;
-                public const int HeaderIfNoneMatch = 31;
-                public const int HeaderIfRange = 32;
-                public const int HeaderIfUnmodifiedSince = 33;
-                public const int HeaderKeepAlive = 3;
-                public const int HeaderLastModified = 19;
-                public const int HeaderLocation = 23;
-                public const int HeaderMaxForwards = 34;
-                public const int HeaderPragma = 4;
-                public const int HeaderProxyAuthenticate = 24;
-                public const int HeaderProxyAuthorization = 35;
-                public const int HeaderRange = 37;
-                public const int HeaderReferer = 36;
-                public const int HeaderRetryAfter = 25;
-                public const int HeaderServer = 26;
-                public const int HeaderSetCookie = 27;
-                public const int HeaderTe = 38;
-                public const int HeaderTrailer = 5;
-                public const int HeaderTransferEncoding = 6;
-                public const int HeaderUpgrade = 7;
-                public const int HeaderUserAgent = 39;
-                public const int HeaderVary = 28;
-                public const int HeaderVia = 8;
-                public const int HeaderWarning = 9;
-                public const int HeaderWwwAuthenticate = 29;
-                public const int ReasonCachePolicy = 2;
-                public const int ReasonCacheSecurity = 3;
-                public const int ReasonClientDisconnect = 4;
-                public const int ReasonDefault = 0;
-                public const int ReasonFileHandleCacheMiss = 1;
-                public const int ReasonResponseCacheMiss = 0;
-                public const int RequestHeaderMaximum = 40;
-                public const int ResponseHeaderMaximum = 30;
-
-public static int GetKnownRequestHeaderIndex(string header);
-public static string GetKnownRequestHeaderName(int index);
-public static int GetKnownResponseHeaderIndex(string header);
-public static string GetKnownResponseHeaderName(int index);
-public static string GetStatusDescription(int code);
-public virtual string MachineConfigPath {get;}
-public virtual string MachineInstallDirectory {get;}
-
-                protected HttpWorkerRequest() {}
-
-public virtual void CloseConnection();
-public abstract void EndOfRequest();
-public abstract void FlushResponse(bool finalFlush);
-public virtual string GetAppPath();
-public virtual string GetAppPathTranslated();
-public virtual string GetAppPoolID();
-public virtual long GetBytesRead();
-public virtual byte[] GetClientCertificate();
-public virtual byte[] GetClientCertificateBinaryIssuer();
-public virtual int GetClientCertificateEncoding();
-public virtual byte[] GetClientCertificatePublicKey();
-public virtual DateTime GetClientCertificateValidFrom();
-public virtual DateTime GetClientCertificateValidUntil();
-public virtual long GetConnectionID();
-public virtual string GetFilePath();
-public virtual string GetFilePathTranslated();
-public abstract string GetHttpVerbName();
-public abstract string GetHttpVersion();
-public virtual string GetKnownRequestHeader(int index);
-public abstract string GetLocalAddress();
-public abstract int GetLocalPort();
-public virtual string GetPathInfo();
-public virtual byte[] GetPreloadedEntityBody();
-public virtual string GetProtocol();
-public abstract string GetQueryString();
-public virtual byte[] GetQueryStringRawBytes();
-public abstract string GetRawUrl();
-public abstract string GetRemoteAddress();
-public virtual string GetRemoteName();
-public abstract int GetRemotePort();
-public virtual int GetRequestReason();
-public virtual string GetServerName();
-public virtual string GetServerVariable(string name);
-public virtual string GetUnknownRequestHeader(string name);
-public virtual string[][] GetUnknownRequestHeaders();
-public abstract string GetUriPath();
-public virtual long GetUrlContextID();
-public virtual IntPtr GetUserToken();
-public virtual IntPtr GetVirtualPathToken();
-public bool HasEntityBody();
-public virtual bool HeadersSent();
-public virtual bool IsClientConnected();
-public virtual bool IsEntireEntityBodyIsPreloaded();
-public virtual bool IsSecure();
-public virtual string MapPath(string virtualPath);
-public virtual int ReadEntityBody(byte[] buffer, int size);
-public virtual void SendCalculatedContentLength(int contentLength);
-public abstract void SendKnownResponseHeader(int index, string value);
-public abstract void SendResponseFromFile(IntPtr handle, long offset, long length);
-public abstract void SendResponseFromFile(string filename, long offset, long length);
-public abstract void SendResponseFromMemory(byte[] data, int length);
-public virtual void SendResponseFromMemory(IntPtr data, int length);
-public abstract void SendStatus(int statusCode, string statusDescription);
-public abstract void SendUnknownResponseHeader(string name, string value);
-public virtual void SetEndOfSendNotification(HttpWorkerRequest.EndOfSendNotification callback, object extraData);
-        }
-}
+// \r
+// System.Web.HttpResponseStreamProxy\r
+//\r
+// Author:\r
+//   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
+//   (constants from Bob Smith (bob@thestuff.net))\r
+//\r
+using System;\r
+using System.Collections;\r
+\r
+namespace System.Web {\r
+   public abstract class HttpWorkerRequest {\r
+      public delegate void EndOfSendNotification(HttpWorkerRequest wr, object extraData);\r
+\r
+      public const int HeaderAccept = 20;\r
+      public const int HeaderAcceptCharset = 21;\r
+      public const int HeaderAcceptEncoding = 22;\r
+      public const int HeaderAcceptLanguage = 23;\r
+      public const int HeaderAcceptRanges = 20;\r
+      public const int HeaderAge = 21;\r
+      public const int HeaderAllow = 10;\r
+      public const int HeaderAuthorization = 24;\r
+      public const int HeaderCacheControl = 0;\r
+      public const int HeaderConnection = 1;\r
+      public const int HeaderContentEncoding = 13;\r
+      public const int HeaderContentLanguage = 14;\r
+      public const int HeaderContentLength = 11;\r
+      public const int HeaderContentLocation = 15;\r
+      public const int HeaderContentMd5 = 16;\r
+      public const int HeaderContentRange = 17;\r
+      public const int HeaderContentType = 12;\r
+      public const int HeaderCookie = 25;\r
+      public const int HeaderDate = 2;\r
+      public const int HeaderEtag = 22;\r
+      public const int HeaderExpect = 26;\r
+      public const int HeaderExpires = 18;\r
+      public const int HeaderFrom = 27;\r
+      public const int HeaderHost = 28;\r
+      public const int HeaderIfMatch = 29;\r
+      public const int HeaderIfModifiedSince = 30;\r
+      public const int HeaderIfNoneMatch = 31;\r
+      public const int HeaderIfRange = 32;\r
+      public const int HeaderIfUnmodifiedSince = 33;\r
+      public const int HeaderKeepAlive = 3;\r
+      public const int HeaderLastModified = 19;\r
+      public const int HeaderLocation = 23;\r
+      public const int HeaderMaxForwards = 34;\r
+      public const int HeaderPragma = 4;\r
+      public const int HeaderProxyAuthenticate = 24;\r
+      public const int HeaderProxyAuthorization = 35;\r
+      public const int HeaderRange = 37;\r
+      public const int HeaderReferer = 36;\r
+      public const int HeaderRetryAfter = 25;\r
+      public const int HeaderServer = 26;\r
+      public const int HeaderSetCookie = 27;\r
+      public const int HeaderTe = 38;\r
+      public const int HeaderTrailer = 5;\r
+      public const int HeaderTransferEncoding = 6;\r
+      public const int HeaderUpgrade = 7;\r
+      public const int HeaderUserAgent = 39;\r
+      public const int HeaderVary = 28;\r
+      public const int HeaderVia = 8;\r
+      public const int HeaderWarning = 9;\r
+      public const int HeaderWwwAuthenticate = 29;\r
+      public const int ReasonCachePolicy = 2;\r
+      public const int ReasonCacheSecurity = 3;\r
+      public const int ReasonClientDisconnect = 4;\r
+      public const int ReasonDefault = 0;\r
+      public const int ReasonFileHandleCacheMiss = 1;\r
+      public const int ReasonResponseCacheMiss = 0;\r
+      public const int RequestHeaderMaximum = 40;\r
+      public const int ResponseHeaderMaximum = 30;\r
+\r
+      static string [][] s_HttpStatusDescriptions;\r
+      static string [] s_HttpRequestHeaderNames;\r
+      static string [] s_HttpResponseHeaderNames;\r
+\r
+      static Hashtable s_HttpResponseHeadersTable;\r
+      static Hashtable s_HttpRequestHeaderTable;\r
+\r
+      static HttpWorkerRequest() {\r
+         string[] sSubCodes;\r
+\r
+         s_HttpStatusDescriptions = new string[6][];\r
+\r
+         sSubCodes = new String[3];\r
+         sSubCodes[0] = "Continue";\r
+         sSubCodes[1] = "Switching Protocols";\r
+         sSubCodes[2] = "Processing";\r
+         s_HttpStatusDescriptions[1] = sSubCodes;\r
+\r
+         sSubCodes = new String[8];\r
+         sSubCodes[0] = "OK";\r
+         sSubCodes[1] = "Created";\r
+         sSubCodes[2] = "Accepted";\r
+         sSubCodes[3] = "Non-Authoritative Information";\r
+         sSubCodes[4] = "No Content";\r
+         sSubCodes[5] = "Reset Content";\r
+         sSubCodes[6] = "Partial Content";\r
+         sSubCodes[7] = "Multi-Status";\r
+         s_HttpStatusDescriptions[2] = sSubCodes;\r
+         \r
+         sSubCodes = new String[8];\r
+         sSubCodes[0] = "Multiple Choices";\r
+         sSubCodes[1] = "Moved Permanently";\r
+         sSubCodes[2] = "Found";\r
+         sSubCodes[3] = "See Other";\r
+         sSubCodes[4] = "Not Modified";\r
+         sSubCodes[5] = "Use Proxy";\r
+         sSubCodes[6] = "";\r
+         sSubCodes[7] = "Temporary Redirect";\r
+         s_HttpStatusDescriptions[3] = sSubCodes;\r
+\r
+         sSubCodes = new String[24];\r
+         sSubCodes[0] = "Bad Request";\r
+         sSubCodes[1] = "Unauthorized";\r
+         sSubCodes[2] = "Payment Required";\r
+         sSubCodes[3] = "Forbidden";\r
+         sSubCodes[4] = "Not Found";\r
+         sSubCodes[5] = "Method Not Allowed";\r
+         sSubCodes[6] = "Not Acceptable";\r
+         sSubCodes[7] = "Proxy Authentication Required";\r
+         sSubCodes[8] = "Request Timeout";\r
+         sSubCodes[9] = "Conflict";\r
+         sSubCodes[10] = "Gone";\r
+         sSubCodes[11] = "Length Required";\r
+         sSubCodes[12] = "Precondition Failed";\r
+         sSubCodes[13] = "Request Entity Too Large";\r
+         sSubCodes[14] = "Request-Uri Too Long";\r
+         sSubCodes[15] = "Unsupported Media Type";\r
+         sSubCodes[16] = "Requested Range Not Satisfiable";\r
+         sSubCodes[17] = "Expectation Failed";\r
+         sSubCodes[18] = "";\r
+         sSubCodes[19] = "";\r
+         sSubCodes[20] = "";\r
+         sSubCodes[21] = "Unprocessable Entity";\r
+         sSubCodes[22] = "Locked";\r
+         sSubCodes[23] = "Failed Dependency";\r
+         s_HttpStatusDescriptions[4] = sSubCodes;\r
+         \r
+         sSubCodes = new String[8];\r
+         sSubCodes[0] = "Internal Server Error";\r
+         sSubCodes[1] = "Not Implemented";\r
+         sSubCodes[2] = "Bad Gateway";\r
+         sSubCodes[3] = "Service Unavailable";\r
+         sSubCodes[4] = "Gateway Timeout";\r
+         sSubCodes[5] = "Http Version Not Supported";\r
+         sSubCodes[6] = "";\r
+         sSubCodes[7] = "Insufficient Storage";\r
+         s_HttpStatusDescriptions[5] = sSubCodes;     \r
\r
+         InitLookupTables();\r
+      }\r
+\r
+      protected HttpWorkerRequest() {\r
+      }\r
+\r
+      static private void InitLookupTables() {\r
+         // Performance arrays\r
+         s_HttpRequestHeaderNames = new string[40];\r
+         s_HttpResponseHeaderNames = new string[30];\r
+\r
+         // Lookup tables (name -> id)\r
+         s_HttpRequestHeaderTable = new Hashtable();\r
+         s_HttpResponseHeadersTable = new Hashtable();\r
+\r
+         AddHeader(true, true, 0, "Cache-Control");\r
+         AddHeader(true, true, 1, "Connection");\r
+         AddHeader(true, true, 2, "Date");\r
+         AddHeader(true, true, 3, "Keep-Alive");\r
+         AddHeader(true, true, 4, "Pragma");\r
+         AddHeader(true, true, 5, "Trailer");\r
+         AddHeader(true, true, 6, "Transfer-Encoding");\r
+         AddHeader(true, true, 7, "Upgrade");\r
+         AddHeader(true, true, 8, "Via");\r
+         AddHeader(true, true, 9, "Warning");\r
+         AddHeader(true, true, 10, "Allow");\r
+         AddHeader(true, true, 11, "Content-Length");\r
+         AddHeader(true, true, 12, "Content-Type");\r
+         AddHeader(true, true, 13, "Content-Encoding");\r
+         AddHeader(true, true, 14, "Content-Language");\r
+         AddHeader(true, true, 15, "Content-Location");\r
+         AddHeader(true, true, 16, "Content-MD5");\r
+         AddHeader(true, true, 17, "Content-Range");\r
+         AddHeader(true, true, 18, "Expires");\r
+         AddHeader(true, true, 19, "Last-Modified");\r
+         AddHeader(true, false, 20, "Accept");\r
+         AddHeader(true, false, 21, "Accept-Charset");\r
+         AddHeader(true, false, 22, "Accept-Encoding");\r
+         AddHeader(true, false, 23, "Accept-Language");\r
+         AddHeader(true, false, 24, "Authorization");\r
+         AddHeader(true, false, 25, "Cookie");\r
+         AddHeader(true, false, 26, "Expect");\r
+         AddHeader(true, false, 27, "From");\r
+         AddHeader(true, false, 28, "Host");\r
+         AddHeader(true, false, 29, "If-Match");\r
+         AddHeader(true, false, 30, "If-Modified-Since");\r
+         AddHeader(true, false, 31, "If-None-Match");\r
+         AddHeader(true, false, 32, "If-Range");\r
+         AddHeader(true, false, 33, "If-Unmodified-Since");\r
+         AddHeader(true, false, 34, "Max-Forwards");\r
+         AddHeader(true, false, 35, "Proxy-Authorization");\r
+         AddHeader(true, false, 36, "Referer");\r
+         AddHeader(true, false, 37, "Range");\r
+         AddHeader(true, false, 38, "TE");\r
+         AddHeader(true, false, 39, "User-Agent");\r
+         AddHeader(false, true, 20, "Accept-Ranges");\r
+         AddHeader(false, true, 21, "Age");\r
+         AddHeader(false, true, 22, "ETag");\r
+         AddHeader(false, true, 23, "Location");\r
+         AddHeader(false, true, 24, "Proxy-Authenticate");\r
+         AddHeader(false, true, 25, "Retry-After");\r
+         AddHeader(false, true, 26, "Server");\r
+         AddHeader(false, true, 27, "Set-Cookie");\r
+         AddHeader(false, true, 28, "Vary");\r
+         AddHeader(false, true, 29, "WWW-Authenticate");\r
+      }\r
+\r
+      static private void AddHeader(bool bRequest, bool bResponse, int iID, string sHeader) {\r
+         if (bResponse) {\r
+            s_HttpResponseHeaderNames[iID] = sHeader;\r
+            s_HttpResponseHeadersTable.Add(sHeader, iID);\r
+         }\r
+\r
+         if (bRequest) {\r
+            s_HttpRequestHeaderNames[iID] = sHeader;\r
+            s_HttpRequestHeaderTable.Add(sHeader, iID);\r
+         }\r
+      }\r
+\r
+      public virtual void CloseConnection() {}\r
+      public abstract void EndOfRequest();\r
+      public abstract void FlushResponse(bool finalFlush);\r
+      \r
+      public virtual string GetAppPath() {\r
+         return null;\r
+      }\r
+      \r
+      public virtual string GetAppPathTranslated() {\r
+         return null;\r
+      }\r
+      \r
+      public virtual string GetAppPoolID() {\r
+         return null;\r
+      }\r
+      \r
+      public virtual long GetBytesRead() {\r
+         return 0;\r
+      }\r
+      \r
+      public virtual byte[] GetClientCertificate() {\r
+         return new byte[0];\r
+      }\r
+      \r
+      public virtual byte[] GetClientCertificateBinaryIssuer() {\r
+         return new byte[0];\r
+      }\r
+      \r
+      public virtual int GetClientCertificateEncoding() {\r
+         return 0;\r
+      }\r
+      \r
+      public virtual byte[] GetClientCertificatePublicKey() {\r
+         return new byte[0];\r
+      }\r
+      \r
+      public virtual DateTime GetClientCertificateValidFrom() {\r
+         return DateTime.Now;\r
+      }\r
+\r
+      public virtual DateTime GetClientCertificateValidUntil() {\r
+         return DateTime.Now;\r
+      }\r
+\r
+      public virtual long GetConnectionID() {\r
+         return 0;\r
+      }\r
+      \r
+      public virtual string GetFilePath() {\r
+         return GetUriPath();\r
+      }\r
+   \r
+      public virtual string GetFilePathTranslated() {\r
+         return null;\r
+      }\r
+      \r
+      public abstract string GetHttpVerbName();\r
+      public abstract string GetHttpVersion();\r
+      \r
+      public virtual string GetKnownRequestHeader(int index) {\r
+         return null;\r
+      }\r
+      \r
+      public static int GetKnownRequestHeaderIndex(string header) {\r
+         object Index;\r
+         Index = s_HttpRequestHeaderTable[header];\r
+         if (null != Index) {\r
+            return (Int32) Index;\r
+         }\r
+\r
+         return -1;\r
+      }\r
+\r
+      public static string GetKnownRequestHeaderName(int index) {\r
+         return s_HttpRequestHeaderNames[index];\r
+      }\r
+\r
+      public static int GetKnownResponseHeaderIndex(string header) {\r
+         object Index;\r
+\r
+         Index = s_HttpResponseHeadersTable[header];\r
+         if (null != Index) {\r
+            return (Int32) Index;\r
+         }\r
+\r
+         return -1;\r
+      }\r
+\r
+      public static string GetKnownResponseHeaderName(int index) {\r
+         return s_HttpResponseHeaderNames[index];\r
+      }\r
+\r
+      public abstract string GetLocalAddress();\r
+      public abstract int GetLocalPort();\r
+      \r
+      public virtual string GetPathInfo() {\r
+         return "";\r
+      }\r
+      \r
+      public virtual byte[] GetPreloadedEntityBody() {\r
+         return null;\r
+      }\r
+      \r
+      public virtual string GetProtocol() {\r
+         if (IsSecure()) {\r
+            return "HTTPS";\r
+         } \r
+         \r
+         return "HTTP";\r
+      }\r
+      \r
+      public abstract string GetQueryString();\r
+      \r
+      public virtual byte[] GetQueryStringRawBytes() {\r
+         return null;\r
+      }\r
+      \r
+      public abstract string GetRawUrl();\r
+      public abstract string GetRemoteAddress();\r
+      \r
+      public virtual string GetRemoteName() {\r
+         return GetRemoteAddress();\r
+      }\r
+      \r
+      public abstract int GetRemotePort();\r
+\r
+      public virtual int GetRequestReason() {\r
+         return 0;\r
+      }\r
+      \r
+      public virtual string GetServerName() {\r
+         return GetLocalAddress();  \r
+      }\r
+      \r
+      public virtual string GetServerVariable(string name) {\r
+         return null;\r
+      }\r
+\r
+      public static string GetStatusDescription(int code) {\r
+         if (code>= 100 && code < 600) {\r
+            int iMajor = code / 100;\r
+            int iMinor = code % 100;\r
+            if (iMinor < (int) s_HttpStatusDescriptions[iMajor].Length) {\r
+               return s_HttpStatusDescriptions[iMajor][iMinor];\r
+            }\r
+         }\r
+\r
+         return "";\r
+      }\r
+      \r
+      public virtual string GetUnknownRequestHeader(string name) {\r
+         return null;\r
+      }\r
+      \r
+      public virtual string[][] GetUnknownRequestHeaders() {\r
+         return null;\r
+      }\r
+\r
+      public abstract string GetUriPath();\r
+\r
+      public virtual long GetUrlContextID() {\r
+         return 0;\r
+      }\r
+      \r
+      public virtual IntPtr GetUserToken() {\r
+         throw new NotSupportedException();\r
+      }\r
+      \r
+      public virtual IntPtr GetVirtualPathToken() {\r
+         throw new NotSupportedException();\r
+      }\r
+      \r
+      public bool HasEntityBody() {\r
+         string sContentLength = GetKnownRequestHeader(HeaderContentLength);\r
+         if (null != sContentLength && sContentLength != "0") {\r
+            return true;\r
+         }\r
+\r
+         if (null != GetKnownRequestHeader(HeaderTransferEncoding)) {\r
+            return true;\r
+         }\r
+         \r
+         if (null != GetPreloadedEntityBody() || IsEntireEntityBodyIsPreloaded()) {\r
+            return true;\r
+         }\r
+\r
+         return false;\r
+      }\r
+      \r
+      public virtual bool HeadersSent() {\r
+         return true;\r
+      }\r
+      \r
+      public virtual bool IsClientConnected() {\r
+         return true;\r
+      }\r
+      \r
+      public virtual bool IsEntireEntityBodyIsPreloaded() {\r
+         return false;\r
+      }\r
+      \r
+      public virtual bool IsSecure() {\r
+         return false;\r
+      }\r
+      \r
+      public virtual string MapPath(string virtualPath) {\r
+         return null;\r
+      }\r
+      \r
+      public virtual int ReadEntityBody(byte[] buffer, int size) {\r
+         return 0;\r
+      }\r
+      \r
+      public virtual void SendCalculatedContentLength(int contentLength) {\r
+      }\r
+      \r
+      public abstract void SendKnownResponseHeader(int index, string value);\r
+      public abstract void SendResponseFromFile(IntPtr handle, long offset, long length);\r
+      public abstract void SendResponseFromFile(string filename, long offset, long length);\r
+      public abstract void SendResponseFromMemory(byte[] data, int length);\r
+      \r
+      [MonoTODO("Should we support this method? We could just use the stringresource to build a string and then send it via SendResponseFromMemory?")]\r
+      public virtual void SendResponseFromMemory(IntPtr data, int length) {\r
+         throw new NotSupportedException();\r
+      }\r
+      \r
+      public abstract void SendStatus(int statusCode, string statusDescription);\r
+      public abstract void SendUnknownResponseHeader(string name, string value);\r
+      \r
+      public virtual void SetEndOfSendNotification(HttpWorkerRequest.EndOfSendNotification callback, object extraData) {\r
+      }\r
+\r
+      public virtual string MachineConfigPath {\r
+         get {\r
+            return null;\r
+         }\r
+      }\r
+      \r
+      public virtual string MachineInstallDirectory {\r
+         get {\r
+            return null;\r
+         }\r
+      }\r
+   }\r
+}\r
+\r
index 42b13299c6818aa2577a26f8b3add49a74cf5f86..06e62cba463b2d11b0b66cf233cd647d12187d52 100644 (file)
@@ -1,19 +1,18 @@
-//
-// System.Web.IHttpAsyncHandler.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-namespace System.Web
-{
-        public interface IHttpAsyncHandler : IHttpHandler
-        {
-                IAsyncResult BeginProcessRequest(HttpContext context,
-                                                 AsyncCallback cb,
-                                                 object extraData);
-                void EndProcessRequest(IAsyncResult result);
-        }
-}
+//\r
+// System.Web.IHttpAsyncHandler.cs\r
+//\r
+// Author:\r
+//   Bob Smith <bob@thestuff.net>\r
+//\r
+// (C) Bob Smith\r
+//\r
+namespace System.Web\r
+{\r
+   public interface IHttpAsyncHandler : IHttpHandler\r
+   {\r
+      IAsyncResult BeginProcessRequest(HttpContext context,\r
+                                       AsyncCallback cb,\r
+                                       object extraData);\r
+      void EndProcessRequest(IAsyncResult result);\r
+   }\r
+}\r
index 9cc39cf02819d53e4e4ab544670a14a5bd3043ef..8bad2c1b1bd6c9a2588d899f9114aff9814cce2d 100644 (file)
@@ -1,17 +1,16 @@
-//
-// System.IHttpHandler.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-namespace System.Web
-{
-        public interface IHttpHandler
-        {
-                bool IsReusable {get;}
-                void ProcessRequest(HttpContext context);
-        }
-}
+//\r
+// System.IHttpHandler.cs\r
+//\r
+// Author:\r
+//   Bob Smith <bob@thestuff.net>\r
+//\r
+// (C) Bob Smith\r
+//\r
+namespace System.Web\r
+{\r
+   public interface IHttpHandler\r
+   {\r
+      bool IsReusable { get; }\r
+      void ProcessRequest(HttpContext context);\r
+   }\r
+}\r
index 836953d8a37f3310b2c697750375443b15806e36..b8cc4a3d2c5403958be90f7f6e1a7a8afc8f6cc6 100644 (file)
@@ -1,20 +1,19 @@
-//
-// System.Web.IHttpHandlerFactory.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-namespace System.Web
-{
-        public interface IHttpHandlerFactory
-        {
-                IHttpHandler GetHandler(HttpContext context,
-                                        string requestType,
-                                        string url,
-                                        string pathTranslated);
-                void ReleaseHandler(IHttpHandler handler);
-        }
-}
+//\r
+// System.Web.IHttpHandlerFactory.cs\r
+//\r
+// Author:\r
+//   Bob Smith <bob@thestuff.net>\r
+//\r
+// (C) Bob Smith\r
+//\r
+namespace System.Web\r
+{\r
+   public interface IHttpHandlerFactory\r
+   {\r
+      IHttpHandler GetHandler(HttpContext context,\r
+                              string requestType,\r
+                              string url,\r
+                              string pathTranslated);\r
+      void ReleaseHandler(IHttpHandler handler);\r
+   }\r
+}\r
index a000b15049daba301b25a92c2f3c5e6bae000180..a98d2f54d29b61de5d1d30f91c9a623c6384a29c 100644 (file)
@@ -1,17 +1,14 @@
-//
-// System.Web.IHttpModule.cs
-//
-// Author:
-//   Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
-
-namespace System.Web
-{
-        public interface IHttpModule
-        {
-                void Dispose();
-                void Init(HttpApplication context);
-        }
-}
+//\r
+// System.Web.IHttpModule.cs\r
+//\r
+// Author:\r
+//   Bob Smith <bob@thestuff.net>\r
+//\r
+// (C) Bob Smith\r
+//\r
+namespace System.Web {\r
+   public interface IHttpModule {\r
+      void Dispose();\r
+      void Init(HttpApplication context);\r
+   }\r
+}\r