[System] Suppress a few instances of CS0618 obsolete warnings
[mono.git] / mcs / class / System / System.Net / HttpWebRequest.cs
index 9f94783258dfa6a4067bebd666584507334cfd6c..d05722051f93453ff405de19e8c76bf99fa2d380 100644 (file)
@@ -112,8 +112,8 @@ namespace System.Net
                int maxResponseHeadersLength;
                static int defaultMaxResponseHeadersLength;
                int readWriteTimeout = 300000; // ms
-               IMonoTlsProvider tlsProvider;
 #if SECURITY_DEP
+               MonoTlsProvider tlsProvider;
                MonoTlsSettings tlsSettings;
 #endif
                ServerCertValidationCallback certValidationCallback;
@@ -134,7 +134,9 @@ namespace System.Net
                {
                        defaultMaxResponseHeadersLength = 64 * 1024;
 #if !MOBILE
+#pragma warning disable 618
                        NetConfig config = ConfigurationSettings.GetConfig ("system.net/settings") as NetConfig;
+#pragma warning restore 618
                        if (config != null) {
                                int x = config.MaxResponseHeadersLength;
                                if (x != -1)
@@ -161,7 +163,7 @@ namespace System.Net
                }
 
 #if SECURITY_DEP
-               internal HttpWebRequest (Uri uri, IMonoTlsProvider tlsProvider, MonoTlsSettings settings = null)
+               internal HttpWebRequest (Uri uri, MonoTlsProvider tlsProvider, MonoTlsSettings settings = null)
                        : this (uri)
                {
                        this.tlsProvider = tlsProvider;
@@ -226,12 +228,12 @@ namespace System.Net
                        internal set { actualUri = value; } // Used by Ftp+proxy
                }
                
-               public bool AllowAutoRedirect {
+               public virtual bool AllowAutoRedirect {
                        get { return allowAutoRedirect; }
                        set { this.allowAutoRedirect = value; }
                }
                
-               public bool AllowWriteStreamBuffering {
+               public virtual bool AllowWriteStreamBuffering {
                        get { return allowBuffering; }
                        set { allowBuffering = value; }
                }
@@ -274,16 +276,16 @@ namespace System.Net
                        }
                }
 
-               internal IMonoTlsProvider TlsProvider {
+#if SECURITY_DEP
+               internal MonoTlsProvider TlsProvider {
                        get { return tlsProvider; }
                }
 
-#if SECURITY_DEP
                internal MonoTlsSettings TlsSettings {
                        get { return tlsSettings; }
                }
 #endif
-               
+
                public X509CertificateCollection ClientCertificates {
                        get {
                                if (certificates == null)
@@ -918,6 +920,12 @@ namespace System.Net
                        return EndGetRequestStream (asyncResult);
                }
 
+               [MonoTODO]
+               public Stream GetRequestStream (out TransportContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
                bool CheckIfForceWrite (SimpleAsyncResult result)
                {
                        if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering)
@@ -1025,9 +1033,9 @@ namespace System.Net
                        return result.Response;
                }
                
-               public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
+               public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext context)
                {
-                       transportContext = null;
+                       context = null;
                        return EndGetRequestStream (asyncResult);
                }
 
@@ -1314,8 +1322,11 @@ namespace System.Net
                                        msg = "Error: " + status;
                                        wex = new WebException (msg, status);
                                } else {
-                                       msg = String.Format ("Error: {0} ({1})", status, exc.Message);
-                                       wex = new WebException (msg, status, WebExceptionInternalStatus.RequestFatal, exc);
+                                       wex = exc as WebException;
+                                       if (wex == null) {
+                                               msg = String.Format ("Error: {0} ({1})", status, exc.Message);
+                                               wex = new WebException (msg, status, WebExceptionInternalStatus.RequestFatal, exc);
+                                       }
                                }
                                r.SetCompleted (false, wex);
                                r.DoCallback ();