Tweak CurlHandler SSL not supported messages to be more helpful (dotnet/corefx#27043)
authorStephen Toub <stoub@microsoft.com>
Mon, 12 Feb 2018 10:27:57 +0000 (05:27 -0500)
committerGitHub <noreply@github.com>
Mon, 12 Feb 2018 10:27:57 +0000 (05:27 -0500)
* Tweak CurlHandler SSL not supported messages to be more helpful

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/9cde3e174b2495cbcdf95995aea0bea4030d4aa9

src/libraries/System.Net.Http/src/Resources/Strings.resx
src/libraries/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.Linux.cs
src/libraries/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.OSX.cs

index 0962eca..eda5a3b 100644 (file)
   <data name="ObjectDisposed_StreamClosed" xml:space="preserve">
     <value>Can not access a closed Stream.</value>
   </data>
-  <data name="net_http_libcurl_callback_notsupported" xml:space="preserve">
-    <value>The handler does not support custom handling of certificates with this combination of libcurl ({0}) and its SSL backend ("{1}").</value>
+  <data name="net_http_libcurl_callback_notsupported_sslbackend" xml:space="preserve">
+    <value>The handler does not support custom handling of certificates with this combination of libcurl ({0}) and its SSL backend ("{1}"). An SSL backend based on "{2}" is required. Consider using System.Net.Http.SocketsHttpHandler.</value>
   </data>
-  <data name="net_http_libcurl_clientcerts_notsupported" xml:space="preserve">
-    <value>The handler does not support client authentication certificates with this combination of libcurl ({0}) and its SSL backend ("{1}").</value>
+  <data name="net_http_libcurl_callback_notsupported_os" xml:space="preserve">
+    <value>The handler does not support custom handling of certificates on this operating system. Consider using System.Net.Http.SocketsHttpHandler.</value>
   </data>
-  <data name="net_http_libcurl_revocation_notsupported" xml:space="preserve">
-    <value>The handler does not support changing revocation settings with this combination of libcurl ({0}) and its SSL backend ("{1}").</value>
+  <data name="net_http_libcurl_clientcerts_notsupported_sslbackend" xml:space="preserve">
+    <value>The handler does not support client authentication certificates with this combination of libcurl ({0}) and its SSL backend ("{1}"). An SSL backend based on "{2}" is required. Consider using System.Net.Http.SocketsHttpHandler.</value>
+  </data>
+  <data name="net_http_libcurl_clientcerts_notsupported_os" xml:space="preserve">
+    <value>The handler does not support client authentication certificates on this operating system. Consider using System.Net.Http.SocketsHttpHandler.</value>
+  </data>
+  <data name="net_http_libcurl_revocation_notsupported_sslbackend" xml:space="preserve">
+    <value>The handler does not support changing revocation settings with this combination of libcurl ({0}) and its SSL backend ("{1}"). An SSL backend based on "{2}" is required. Consider using System.Net.Http.SocketsHttpHandler.</value>
   </data>
   <data name="net_http_feature_requires_Windows10Version1607" xml:space="preserve">
     <value>Using this feature requires Windows 10 Version 1607.</value>
index 993d28b..9b93cf4 100644 (file)
@@ -127,12 +127,12 @@ namespace System.Net.Http
             {
                 if (certProvider != null)
                 {
-                    throw new PlatformNotSupportedException(SR.Format(SR.net_http_libcurl_clientcerts_notsupported, CurlVersionDescription, CurlSslVersionDescription));
+                    throw new PlatformNotSupportedException(SR.Format(SR.net_http_libcurl_clientcerts_notsupported_sslbackend, CurlVersionDescription, CurlSslVersionDescription, Interop.Http.OpenSsl10Description));
                 }
 
                 if (easy._handler.CheckCertificateRevocationList)
                 {
-                    throw new PlatformNotSupportedException(SR.Format(SR.net_http_libcurl_revocation_notsupported, CurlVersionDescription, CurlSslVersionDescription));
+                    throw new PlatformNotSupportedException(SR.Format(SR.net_http_libcurl_revocation_notsupported_sslbackend, CurlVersionDescription, CurlSslVersionDescription, Interop.Http.OpenSsl10Description));
                 }
 
                 if (easy._handler.ServerCertificateCustomValidationCallback != null)
@@ -145,7 +145,7 @@ namespace System.Net.Http
                     }
                     else
                     {
-                        throw new PlatformNotSupportedException(SR.Format(SR.net_http_libcurl_callback_notsupported, CurlVersionDescription, CurlSslVersionDescription));
+                        throw new PlatformNotSupportedException(SR.Format(SR.net_http_libcurl_callback_notsupported_sslbackend, CurlVersionDescription, CurlSslVersionDescription, Interop.Http.OpenSsl10Description));
                     }
                 }
                 else
index 134cfec..4b2c029 100644 (file)
@@ -29,11 +29,7 @@ namespace System.Net.Http
                     // only via writing it to a file and letting it load the PFX.
                     // This would require that a) we write said file, and b) that it contaminate the default
                     // keychain (because their PFX loader loads to the default keychain).
-                    throw new PlatformNotSupportedException(
-                        SR.Format(
-                            SR.net_http_libcurl_clientcerts_notsupported,
-                            CurlVersionDescription,
-                            CurlSslVersionDescription));
+                    throw new PlatformNotSupportedException(SR.net_http_libcurl_clientcerts_notsupported_os);
                 }
 
                 // Revocation checking is always on for darwinssl (SecureTransport).
@@ -44,9 +40,10 @@ namespace System.Net.Http
                 {
                     throw new PlatformNotSupportedException(
                         SR.Format(
-                            SR.net_http_libcurl_revocation_notsupported,
+                            SR.net_http_libcurl_revocation_notsupported_sslbackend,
                             CurlVersionDescription,
-                            CurlSslVersionDescription));
+                            CurlSslVersionDescription,
+                            Interop.Http.SecureTransportDescription));
                 }
 
                 if (easy._handler.ServerCertificateCustomValidationCallback != null)
@@ -87,11 +84,7 @@ namespace System.Net.Http
                     }
                     else
                     {
-                        throw new PlatformNotSupportedException(
-                            SR.Format(
-                                SR.net_http_libcurl_callback_notsupported,
-                                CurlVersionDescription,
-                                CurlSslVersionDescription));
+                        throw new PlatformNotSupportedException(SR.net_http_libcurl_callback_notsupported_os);
                     }
                 }