[System]: Add new internal HttpWebRequest APIs for MonoTlsProvider / MonoTlsSettings.
authorMartin Baulig <martin.baulig@xamarin.com>
Mon, 12 Oct 2015 21:22:34 +0000 (17:22 -0400)
committerMartin Baulig <martin.baulig@xamarin.com>
Mon, 12 Oct 2015 21:28:37 +0000 (17:28 -0400)
The new internal constructor allows a per-request MonoTlsProvider and
related MonoTlsSettings; also expose these as new internal properties.

(cherry picked from commit 31988df75077c11ed87c77ab34e5b77b5913a32b)

mcs/class/System/System.Net/HttpWebRequest.cs

index b9cc121d03c7f6dc1455782f6dbf692a96539330..ce72d14b6c9ae51e8ecb66a0742675bcdb520135 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if SECURITY_DEP
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+#endif
+
 using System;
 using System.Collections;
 using System.Configuration;
@@ -39,11 +48,13 @@ using System.IO;
 using System.Net;
 using System.Net.Cache;
 using System.Net.Sockets;
+using System.Net.Security;
 using System.Runtime.Remoting.Messaging;
 using System.Runtime.Serialization;
 using System.Security.Cryptography.X509Certificates;
 using System.Text;
 using System.Threading;
+using Mono.Net.Security;
 
 namespace System.Net 
 {
@@ -101,6 +112,10 @@ namespace System.Net
                int maxResponseHeadersLength;
                static int defaultMaxResponseHeadersLength;
                int readWriteTimeout = 300000; // ms
+               IMonoTlsProvider tlsProvider;
+#if SECURITY_DEP
+               MonoTlsSettings tlsSettings;
+#endif
 
                enum NtlmAuthState {
                        None,
@@ -143,6 +158,15 @@ namespace System.Net
                        ThrowOnError = true;
                        ResetAuthorization ();
                }
+
+#if SECURITY_DEP
+               internal HttpWebRequest (Uri uri, IMonoTlsProvider tlsProvider, MonoTlsSettings settings = null)
+                       : this (uri)
+               {
+                       this.tlsProvider = tlsProvider;
+                       this.tlsSettings = settings;
+               }
+#endif
                
                [Obsolete ("Serialization is obsoleted for this type", false)]
                protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) 
@@ -240,6 +264,16 @@ namespace System.Net
                                method != "TRACE";
                        }
                }
+
+               internal IMonoTlsProvider TlsProvider {
+                       get { return tlsProvider; }
+               }
+
+#if SECURITY_DEP
+               internal MonoTlsSettings TlsSettings {
+                       get { return tlsSettings; }
+               }
+#endif
                
                public X509CertificateCollection ClientCertificates {
                        get {