[System] Suppress a few instances of CS0618 obsolete warnings
[mono.git] / mcs / class / System / System.Net / HttpWebRequest.cs
index 63d0eb39238c4bdf2d5eaf16eb69adef7c2562e0..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;
@@ -133,8 +133,10 @@ namespace System.Net
                static HttpWebRequest ()
                {
                        defaultMaxResponseHeadersLength = 64 * 1024;
-#if !NET_2_1
+#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)
@@ -145,7 +147,7 @@ namespace System.Net
 #endif
                }
 
-#if NET_2_1
+#if MOBILE
                public
 #else
                internal
@@ -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)
@@ -382,7 +384,7 @@ namespace System.Net
                                SetSpecialHeaders(headerName, HttpProtocolUtils.date2string(dateTime));
                }
 
-#if !NET_2_1
+#if !MOBILE
                [MonoTODO]
                public static new RequestCachePolicy DefaultCachePolicy
                {
@@ -450,7 +452,7 @@ namespace System.Net
                                        newWebHeaders.Add(headerName,webHeaders[headerName]);
                                }
 
-                               webHeaders = newWebHeaders;
+                               this.webHeaders = newWebHeaders;
                        }
                }
                
@@ -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)
@@ -963,7 +971,7 @@ namespace System.Net
                        initialMethod = method;
 
                        SimpleAsyncResult.RunWithLock (locker, CheckIfForceWrite, inner => {
-                               var synch = inner.CompletedSynchronously;
+                               var synch = inner.CompletedSynchronouslyPeek;
 
                                if (inner.GotException) {
                                        aread.SetCompleted (synch, inner.Exception);
@@ -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 ();
@@ -1374,7 +1385,7 @@ namespace System.Net
                                        }
 
                                        if (asyncWrite != null) {
-                                               asyncWrite.SetCompleted (inner.CompletedSynchronously, writeStream);
+                                               asyncWrite.SetCompleted (inner.CompletedSynchronouslyPeek, writeStream);
                                                asyncWrite.DoCallback ();
                                                asyncWrite = null;
                                        }