Author: mhabersack
Date: 2007-01-05 16:27:01 -0500 (Fri, 05 Jan 2007)
New Revision: 70559

Modified:
   trunk/mcs/class/System.Web/System.Web/ChangeLog
   trunk/mcs/class/System.Web/System.Web/HttpResponse.cs
Log:
Implement the HeaderEncoding 2.0 property

Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog     2007-01-05 20:43:36 UTC 
(rev 70558)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog     2007-01-05 21:27:01 UTC 
(rev 70559)
@@ -1,3 +1,7 @@
+2007-01-05  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * HttpResponse.cs: Implement the HeaderEncoding property.
+
 2007-01-04  Andreia Gaita  <[EMAIL PROTECTED]>
 
        * HttpRuntime.cs: Add check for NET_2_0 when initializing

Modified: trunk/mcs/class/System.Web/System.Web/HttpResponse.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpResponse.cs       2007-01-05 
20:43:36 UTC (rev 70558)
+++ trunk/mcs/class/System.Web/System.Web/HttpResponse.cs       2007-01-05 
21:27:01 UTC (rev 70559)
@@ -36,6 +36,7 @@
 using System.Web.Caching;
 using System.Threading;
 using System.Web.Util;
+using System.Web.Configuration;
 using System.Globalization;
 using System.Security.Permissions;
 
@@ -99,6 +100,7 @@
 
 #if NET_2_0
                bool is_request_being_redirected;
+               Encoding headerEncoding;
 #endif
                
                internal HttpResponse ()
@@ -249,13 +251,29 @@
                        }
                }
 #if NET_2_0
-               [MonoTODO ("Not implemented")]
                public Encoding HeaderEncoding {
-                       get { throw new NotImplementedException (); }
+                       get {
+                               if (headerEncoding == null) {
+                                       GlobalizationSection gs = 
WebConfigurationManager.GetSection ("system.web/globalization")
+                                               as GlobalizationSection;
+                                       if (gs == null)
+                                               headerEncoding = Encoding.UTF8;
+                                       else {
+                                               headerEncoding = 
gs.ResponseHeaderEncoding;
+                                               if (headerEncoding == 
Encoding.Unicode)
+                                                       throw new HttpException 
("HeaderEncoding must not be Unicode");
+                                       }
+                               }
+                               return headerEncoding;
+                       }
                        set {
+                               if (headers_sent)
+                                       throw new HttpException ("headers have 
already been sent");
                                if (value == null)
                                        throw new ArgumentNullException 
("HeaderEncoding");
-                               throw new NotImplementedException ();
+                               if (value == Encoding.Unicode)
+                                       throw new HttpException 
("HeaderEncoding must not be Unicode");
+                               headerEncoding = value;
                        }
                }
 #endif

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to