#if MONOTOUCH
return CFNetwork.GetDefaultProxy ();
#else
+#if MONODROID
+ // Return the system web proxy. This only works for ICS+.
+ var androidProxy = AndroidPlatform.GetDefaultProxy ();
+ if (androidProxy != null)
+ return androidProxy;
+#endif
#if !NET_2_1
if (IsWindows ()) {
int iProxyEnable = (int)Microsoft.Win32.Registry.GetValue ("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", "ProxyEnable", 0);
#if MONODROID
using System;
+using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
#if SECURITY_DEP
static readonly Converter<MSX.X509CertificateCollection, bool> trustEvaluateSsl;
static readonly Func<MSX.X509CertificateCollection, object, X509Certificate2, X509Chain, SslPolicyErrors, bool> trustEvaluateSsl2;
#endif // SECURITY_DEP
+ static readonly Func<IWebProxy> getDefaultProxy;
static AndroidPlatform ()
{
-#if SECURITY_DEP
var t = Type.GetType ("Android.Runtime.AndroidEnvironment, Mono.Android", throwOnError:true);
+#if SECURITY_DEP
trustEvaluateSsl2 = (Func<MSX.X509CertificateCollection, object, X509Certificate2, X509Chain, SslPolicyErrors, bool>)
Delegate.CreateDelegate (
typeof (Func<MSX.X509CertificateCollection, object, X509Certificate2, X509Chain, SslPolicyErrors, bool>),
ignoreCase:false,
throwOnBindFailure:true);
#endif // SECURITY_DEP
+ getDefaultProxy = (Func<IWebProxy>)Delegate.CreateDelegate (
+ typeof (Func<IWebProxy>), t, "GetDefaultProxy",
+ ignoreCase:false,
+ throwOnBindFailure:true);
}
#if SECURITY_DEP
return trustEvaluateSsl (collection);
}
#endif // SECURITY_DEP
+
+ internal static IWebProxy GetDefaultProxy ()
+ {
+ return getDefaultProxy ();
+ }
}
}
#endif // MONODROID