diff --git a/.gitignore b/.gitignore index ffac3b9..fe8de75 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build/ *.xam packages .vs +*Resource.designer.cs diff --git a/ModernHttpClient.nuspec b/ModernHttpClient.nuspec index fafc804..88e32df 100644 --- a/ModernHttpClient.nuspec +++ b/ModernHttpClient.nuspec @@ -1,7 +1,7 @@ - 2.5.1 + 2.6.0 Switch Media, Paul Betts Switch Media, Paul Betts https://github.com/paulcbetts/ModernHttpClient/blob/master/COPYING diff --git a/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs b/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs index 610999d..4f2c950 100644 --- a/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs +++ b/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs @@ -54,20 +54,25 @@ public class NativeMessageHandler : HttpClientHandler public bool DisableCaching { get; set; } public NativeMessageHandler(): this(false, false) { } - public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null, SslProtocol? minimumSSLProtocol = null) + public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { var configuration = NSUrlSessionConfiguration.DefaultSessionConfiguration; // System.Net.ServicePointManager.SecurityProtocol provides a mechanism for specifying supported protocol types // for System.Net. Since iOS only provides an API for a minimum and maximum protocol we are not able to port // this configuration directly and instead use the specified minimum value when one is specified. - if (minimumSSLProtocol.HasValue) { - configuration.TLSMinimumSupportedProtocol = minimumSSLProtocol.Value; - } - - session = NSUrlSession.FromConfiguration( - NSUrlSessionConfiguration.DefaultSessionConfiguration, - new DataTaskDelegate(this), null); + var sp = ServicePointManager.SecurityProtocol; + if ((sp & SecurityProtocolType.Ssl3) != 0) + configuration.TLSMinimumSupportedProtocol = SslProtocol.Ssl_3_0; + else if ((sp & SecurityProtocolType.Tls) != 0) + configuration.TLSMinimumSupportedProtocol = SslProtocol.Tls_1_0; + else if ((sp & SecurityProtocolType.Tls11) != 0) + configuration.TLSMinimumSupportedProtocol = SslProtocol.Tls_1_1; + else if ((sp & SecurityProtocolType.Tls12) != 0) + configuration.TLSMinimumSupportedProtocol = SslProtocol.Tls_1_2; + + INSUrlSessionDelegate sessionDelegate = new DataTaskDelegate (this); + session = NSUrlSession.FromConfiguration (NSUrlSessionConfiguration.DefaultSessionConfiguration, sessionDelegate, null); this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; this.customSSLVerification = customSSLVerification; diff --git a/src/Playground.Android/Resources/Resource.designer.cs b/src/Playground.Android/Resources/Resource.designer.cs deleted file mode 100644 index b947db6..0000000 --- a/src/Playground.Android/Resources/Resource.designer.cs +++ /dev/null @@ -1,131 +0,0 @@ -#pragma warning disable 1591 -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.17020 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: Android.Runtime.ResourceDesignerAttribute("Playground.Android.Resource", IsApplication=true)] - -namespace Playground.Android -{ - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] - public partial class Resource - { - - static Resource() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues(); - } - - public static void UpdateIdValues() - { - global::ModernHttpClient.Resource.String.library_name = global::Playground.Android.Resource.String.library_name; - } - - public partial class Attribute - { - - static Attribute() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues(); - } - - private Attribute() - { - } - } - - public partial class Drawable - { - - // aapt resource value: 0x7f020000 - public const int Icon = 2130837504; - - static Drawable() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues(); - } - - private Drawable() - { - } - } - - public partial class Id - { - - // aapt resource value: 0x7f050001 - public const int cancelButton = 2131034113; - - // aapt resource value: 0x7f050000 - public const int doIt = 2131034112; - - // aapt resource value: 0x7f050004 - public const int md5sum = 2131034116; - - // aapt resource value: 0x7f050005 - public const int progress = 2131034117; - - // aapt resource value: 0x7f050003 - public const int result = 2131034115; - - // aapt resource value: 0x7f050002 - public const int status = 2131034114; - - static Id() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues(); - } - - private Id() - { - } - } - - public partial class Layout - { - - // aapt resource value: 0x7f030000 - public const int Main = 2130903040; - - static Layout() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues(); - } - - private Layout() - { - } - } - - public partial class String - { - - // aapt resource value: 0x7f040002 - public const int app_name = 2130968578; - - // aapt resource value: 0x7f040001 - public const int hello = 2130968577; - - // aapt resource value: 0x7f040000 - public const int library_name = 2130968576; - - static String() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues(); - } - - private String() - { - } - } - } -} -#pragma warning restore 1591