Fixed: Recent changes to log messages prevented curl fallback from being triggered for tls1.2.
fixes #2089
This commit is contained in:
parent
970006a4fe
commit
ba01b636b9
|
@ -34,19 +34,12 @@ namespace NzbDrone.Common.Http.Dispatchers
|
||||||
{
|
{
|
||||||
return _managedDispatcher.GetResponse(request, cookies);
|
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);
|
_curlTLSFallbackCache.Set(request.Url.Host, true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_curlDispatcher.CheckAvailability())
|
if (_curlDispatcher.CheckAvailability())
|
||||||
|
|
|
@ -78,6 +78,10 @@ namespace NzbDrone.Common.Http.Dispatchers
|
||||||
{
|
{
|
||||||
throw new WebException($"DNS Name Resolution Failure: '{webRequest.RequestUri.Host}'", e.Status);
|
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)
|
else if (OsInfo.IsNotWindows)
|
||||||
{
|
{
|
||||||
throw new WebException($"{e.Message}: '{webRequest.RequestUri}'", e.Status);
|
throw new WebException($"{e.Message}: '{webRequest.RequestUri}'", e.Status);
|
||||||
|
|
|
@ -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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -172,6 +172,7 @@
|
||||||
<Compile Include="Http\HttpRequestBuilder.cs" />
|
<Compile Include="Http\HttpRequestBuilder.cs" />
|
||||||
<Compile Include="Http\HttpRequestBuilderFactory.cs" />
|
<Compile Include="Http\HttpRequestBuilderFactory.cs" />
|
||||||
<Compile Include="Http\Proxy\ProxyType.cs" />
|
<Compile Include="Http\Proxy\ProxyType.cs" />
|
||||||
|
<Compile Include="Http\TlsFailureException.cs" />
|
||||||
<Compile Include="Http\TooManyRequestsException.cs" />
|
<Compile Include="Http\TooManyRequestsException.cs" />
|
||||||
<Compile Include="Extensions\IEnumerableExtensions.cs" />
|
<Compile Include="Extensions\IEnumerableExtensions.cs" />
|
||||||
<Compile Include="Http\UserAgentBuilder.cs" />
|
<Compile Include="Http\UserAgentBuilder.cs" />
|
||||||
|
|
Loading…
Reference in New Issue