Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / System / System.Net.Configuration / HttpWebRequestElement.cs
index 9d8836238482e54df0c1874b865cad01e62068b0..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)
 //
 
 //
@@ -27,9 +28,9 @@
 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
+       //
 
-#if NET_2_0 && XML_DEP
+#if CONFIGURATION_DEP
 
 using System.Configuration;
 
@@ -39,33 +40,78 @@ namespace System.Net.Configuration
        {
                #region Fields
 
-               ConfigurationPropertyCollection properties;
-               static ConfigurationProperty maximumResponseHeadersLength = new ConfigurationProperty ("MaximumResponseHeadersLength", typeof (int), 64);
+               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 (maximumResponseHeadersLength);
+
+                       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; }
+               [ConfigurationProperty("maximumErrorResponseLength", DefaultValue = "64")]
+               public int MaximumErrorResponseLength {
+                       get { return (int) base[maximumErrorResponseLengthProp]; }
+                       set { base [maximumErrorResponseLengthProp] = value; }
                }
 
+               [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")]
+               public int MaximumUnauthorizedUploadLength {
+                       get { return (int) base [maximumUnauthorizedUploadLengthProp]; }
+                       set { base [maximumUnauthorizedUploadLengthProp] = value; }
+               }
+
+               [ConfigurationProperty("useUnsafeHeaderParsing", DefaultValue = "False")]
+               public bool UseUnsafeHeaderParsing {
+                       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
        }
 }