diff --git a/src/NzbDrone.Common/Http/Dispatchers/FallbackHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/FallbackHttpDispatcher.cs
index 707004c9d..01b60e012 100644
--- a/src/NzbDrone.Common/Http/Dispatchers/FallbackHttpDispatcher.cs
+++ b/src/NzbDrone.Common/Http/Dispatchers/FallbackHttpDispatcher.cs
@@ -34,18 +34,11 @@ namespace NzbDrone.Common.Http.Dispatchers
{
return _managedDispatcher.GetResponse(request, cookies);
}
- catch (Exception ex)
+ catch (TlsFailureException)
{
- if (ex.ToString().Contains("The authentication or decryption has failed."))
- {
- _logger.Debug("https request failed in tls error for {0}, trying curl fallback.", request.Url.Host);
+ _logger.Debug("https request failed in tls error for {0}, trying curl fallback.", request.Url.Host);
- _curlTLSFallbackCache.Set(request.Url.Host, true);
- }
- else
- {
- throw;
- }
+ _curlTLSFallbackCache.Set(request.Url.Host, true);
}
}
diff --git a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs
index 9841bbcb9..ff8cf3800 100644
--- a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs
+++ b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs
@@ -78,6 +78,10 @@ namespace NzbDrone.Common.Http.Dispatchers
{
throw new WebException($"DNS Name Resolution Failure: '{webRequest.RequestUri.Host}'", e.Status);
}
+ else if (e.Status == WebExceptionStatus.SendFailure && e.ToString().Contains("The authentication or decryption has failed."))
+ {
+ throw new TlsFailureException(webRequest, e);
+ }
else if (OsInfo.IsNotWindows)
{
throw new WebException($"{e.Message}: '{webRequest.RequestUri}'", e.Status);
diff --git a/src/NzbDrone.Common/Http/TlsFailureException.cs b/src/NzbDrone.Common/Http/TlsFailureException.cs
new file mode 100644
index 000000000..c1dcdd991
--- /dev/null
+++ b/src/NzbDrone.Common/Http/TlsFailureException.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+
+namespace NzbDrone.Common.Http
+{
+ public class TlsFailureException : WebException
+ {
+ public TlsFailureException(WebRequest request, WebException innerException)
+ : base("Failed to establish secure https connection to '" + request.RequestUri + "', libcurl fallback might be unavailable.", innerException, WebExceptionStatus.SecureChannelFailure, innerException.Response)
+ {
+
+ }
+
+ }
+}
diff --git a/src/NzbDrone.Common/NzbDrone.Common.csproj b/src/NzbDrone.Common/NzbDrone.Common.csproj
index 088272149..a2516ea68 100644
--- a/src/NzbDrone.Common/NzbDrone.Common.csproj
+++ b/src/NzbDrone.Common/NzbDrone.Common.csproj
@@ -172,6 +172,7 @@
+