ServicePoint: Use DateTime.UtcNow internally, which avoids looking up the timezone...
[mono.git] / mcs / class / System / System.Net.Configuration / HttpWebRequestElement.cs
index 105bfa24a72e9615f47a63a7278695a2c142f93b..9d7a6a3c26929f8703059fbc987aeeafaf3b330e 100644 (file)
@@ -3,9 +3,10 @@
 //
 // Authors:
 //     Tim Coleman (tim@timcoleman.com)
+//     Chris Toshok (toshok@ximian.com)
 //
 // Copyright (C) Tim Coleman, 2004
-// (c) 2004 Novell, Inc. (http://www.novell.com)
+// (C) 2004,2005 Novell, Inc. (http://www.novell.com)
 //
 
 //
@@ -29,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        //
 
-#if NET_2_0 && CONFIGURATION_DEP
+#if CONFIGURATION_DEP
 
 using System.Configuration;
 
@@ -39,60 +40,78 @@ namespace System.Net.Configuration
        {
                #region Fields
 
-               ConfigurationPropertyCollection properties;
-               static ConfigurationProperty maximumErrorResponseLength = new ConfigurationProperty("maximumErrorResponseLength", typeof(int), 64);
-               static ConfigurationProperty maximumResponseHeadersLength = new ConfigurationProperty ("maximumResponseHeadersLength", typeof (int), 64);
-               static ConfigurationProperty maximumUnauthorizedUploadLength = new ConfigurationProperty("maximumUnauthorizedUploadLength", typeof(int), -1);
-               static ConfigurationProperty useUnsafeHeaderParsing = new ConfigurationProperty("useUnsafeHeaderParsing", typeof(bool), false);
+               static ConfigurationProperty maximumErrorResponseLengthProp;
+               static ConfigurationProperty maximumResponseHeadersLengthProp;
+               static ConfigurationProperty maximumUnauthorizedUploadLengthProp;
+               static ConfigurationProperty useUnsafeHeaderParsingProp;
+               static ConfigurationPropertyCollection properties;
 
                #endregion // Fields
 
                #region Constructors
 
-               public HttpWebRequestElement ()
+               static HttpWebRequestElement ()
                {
+                       maximumErrorResponseLengthProp = new ConfigurationProperty ("maximumErrorResponseLength", typeof (int), 64);
+                       maximumResponseHeadersLengthProp = new ConfigurationProperty ("maximumResponseHeadersLength", typeof (int), 64);
+                       maximumUnauthorizedUploadLengthProp = new ConfigurationProperty ("maximumUnauthorizedUploadLength", typeof (int), -1);
+                       useUnsafeHeaderParsingProp = new ConfigurationProperty ("useUnsafeHeaderParsing", typeof (bool), false);
                        properties = new ConfigurationPropertyCollection ();
-                       properties.Add (maximumErrorResponseLength);
-                       properties.Add (maximumResponseHeadersLength);
-                       properties.Add (maximumUnauthorizedUploadLength);
-                       properties.Add (useUnsafeHeaderParsing);
+
+                       properties.Add (maximumErrorResponseLengthProp);
+                       properties.Add (maximumResponseHeadersLengthProp);
+                       properties.Add (maximumUnauthorizedUploadLengthProp);
+                       properties.Add (useUnsafeHeaderParsingProp);
+               }
+
+               public HttpWebRequestElement ()
+               {
                }
 
                #endregion // Constructors
 
                #region Properties
 
-               protected override ConfigurationPropertyCollection Properties {
-                       get { return properties; }
-               }
-
-               [MonoTODO ("Use value for HttpWebRequest.DefaultMaximumErrorResponseLength?")]
-               [ConfigurationProperty("maximumErrorResponseLength", DefaultValue=64)]
+               [ConfigurationProperty("maximumErrorResponseLength", DefaultValue = "64")]
                public int MaximumErrorResponseLength {
-                       get { return (int) base[maximumErrorResponseLength]; }
-                       set { base [maximumErrorResponseLength] = value; }
+                       get { return (int) base[maximumErrorResponseLengthProp]; }
+                       set { base [maximumErrorResponseLengthProp] = value; }
                }
 
-               [MonoTODO ("Use value for HttpWebRequest.DefaultMaximumResponseHeadersLength?")]
-               [ConfigurationProperty("maximumResponseHeadersLength", DefaultValue=64)]
+               [ConfigurationProperty("maximumResponseHeadersLength", DefaultValue = "64")]
                public int MaximumResponseHeadersLength {
-                       get { return (int) base [maximumResponseHeadersLength]; }
-                       set { base [maximumResponseHeadersLength] = value; }
+                       get { return (int) base [maximumResponseHeadersLengthProp]; }
+                       set { base [maximumResponseHeadersLengthProp] = value; }
                }
 
-               [ConfigurationProperty("maximumUnauthorizedUploadLength", DefaultValue=-1)]
+               [ConfigurationProperty("maximumUnauthorizedUploadLength", DefaultValue = "-1")]
                public int MaximumUnauthorizedUploadLength {
-                       get { return (int) base [maximumUnauthorizedUploadLength]; }
-                       set { base [maximumUnauthorizedUploadLength] = value; }
+                       get { return (int) base [maximumUnauthorizedUploadLengthProp]; }
+                       set { base [maximumUnauthorizedUploadLengthProp] = value; }
                }
 
-               [ConfigurationProperty("useUnsafeHeaderParsing", DefaultValue=false)]
+               [ConfigurationProperty("useUnsafeHeaderParsing", DefaultValue = "False")]
                public bool UseUnsafeHeaderParsing {
-                       get { return (bool) base [useUnsafeHeaderParsing]; }
-                       set { base[useUnsafeHeaderParsing] = value; }
+                       get { return (bool) base [useUnsafeHeaderParsingProp]; }
+                       set { base[useUnsafeHeaderParsingProp] = value; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
                }
 
                #endregion // Properties
+
+
+               #region Methods
+
+               [MonoTODO]
+               protected override void PostDeserialize ()
+               {
+                       base.PostDeserialize ();
+               }
+
+               #endregion // Methods
        }
 }