Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ protected bool IgnoreIfConnectionFailed (AggregateException aex, out bool connec
if (IgnoreIfConnectionFailed (aex.InnerException as WebException, out connectionFailed))
return true;

return IgnoreIfSocketException (aex, out connectionFailed);
if (IgnoreIfSocketException (aex, out connectionFailed))
return true;

return IgnoreIfSSLFailure (aex, out connectionFailed);
}

bool IgnoreIfConnectionFailed (HttpRequestException hrex, out bool connectionFailed)
Expand Down Expand Up @@ -168,6 +171,28 @@ bool IgnoreIfSocketException (Exception ex, out bool connectionFailed)
}
return false;
}

bool IgnoreIfSSLFailure (Exception ex, out bool connectionFailed)
{
connectionFailed = false;
// Check the exception and all inner exceptions for transient SSL errors
var current = ex;
while (current != null) {
if (current is System.IO.IOException ioEx) {
var message = ioEx.Message ?? "";
if (message.Contains ("SSL", StringComparison.OrdinalIgnoreCase) &&
(message.Contains ("BAD_DECRYPT", StringComparison.OrdinalIgnoreCase) ||
message.Contains ("DECRYPTION_FAILED", StringComparison.OrdinalIgnoreCase) ||
message.Contains ("protocol error", StringComparison.OrdinalIgnoreCase))) {
connectionFailed = true;
Assert.Ignore ($"Ignoring transient SSL error: {ioEx}");
return true;
}
}
current = current.InnerException;
}
return false;
}
Comment thread
jonathanpeppers marked this conversation as resolved.
Outdated
}

[Category ("AndroidClientHandler")]
Expand Down
Loading