Merge remote branch 'upstream/master'
[mono.git] / mcs / class / System / System.Net / ServicePointManager.cs
index 3f647fdb95e88510e9ab591fde0dfbca633d4542..b277d9f89cc9430d8633987824445e1783f177e6 100644 (file)
@@ -36,7 +36,6 @@ using System.Configuration;
 using System.Net.Configuration;
 using System.Security.Cryptography.X509Certificates;
 
-#if NET_2_0
 using System.Globalization;
 using System.Net.Security;
 #if SECURITY_DEP
@@ -47,7 +46,6 @@ using Mono.Security.X509.Extensions;
 using Mono.Security.Protocol.Tls;
 using MSX = Mono.Security.X509;
 #endif
-#endif
 
 //
 // notes:
@@ -124,9 +122,7 @@ namespace System.Net
 #endif
                static bool useNagle;
 #endif
-#if NET_2_0
                static RemoteCertificateValidationCallback server_cert_cb;
-#endif
 
                // Fields
                
@@ -261,7 +257,6 @@ namespace System.Net
                        set { _securityProtocol = value; }
                }
 
-#if NET_2_0
                public static RemoteCertificateValidationCallback ServerCertificateValidationCallback
                {
                        get {
@@ -271,7 +266,6 @@ namespace System.Net
                                server_cert_cb = value;
                        }
                }
-#endif
 
 #if NET_1_1
                public static bool Expect100Continue {
@@ -383,7 +377,25 @@ namespace System.Net
                                        servicePoints.Remove (list.GetByIndex (i));
                        }
                }
-#if NET_2_0 && SECURITY_DEP
+#if MOONLIGHT && SECURITY_DEP
+               internal class ChainValidationHelper {
+                       object sender;
+
+                       public ChainValidationHelper (object sender)
+                       {
+                               this.sender = sender;
+                       }
+
+                       // no need to check certificates since we are either
+                       // (a) loading from the site of origin (and we accepted its certificate to load from it)
+                       // (b) loading from a cross-domain site and we downloaded the policy file using the browser stack
+                       //     i.e. the certificate was accepted (or the policy would not be valid)
+                       internal ValidationResult ValidateChain (Mono.Security.X509.X509CertificateCollection certs)
+                       {
+                               return new ValidationResult (true, false, 0);
+                       }
+               }
+#elif NET_2_0 && SECURITY_DEP
                internal class ChainValidationHelper {
                        object sender;
                        string host;