Imported Upstream version 4.4.0.40

Former-commit-id: 6427cc082e74df30afc535fd906a3494b74b0817
This commit is contained in:
Xamarin Public Jenkins
2016-03-16 12:38:19 -04:00
parent f3e3aab35a
commit a632333cc7
110 changed files with 1496 additions and 556 deletions

View File

@ -160,7 +160,7 @@ namespace Mono.Net.Security
certValidationCallback = new ServerCertValidationCallback (callback);
}
certSelectionCallback = Private.CallbackHelpers.MonoToInternal (settings.ClientCertificateSelectionCallback);
fallbackToSPM = settings.UseServicePointManagerCallback;
fallbackToSPM = settings.UseServicePointManagerCallback ?? stream != null;
}
if (stream != null) {
@ -264,7 +264,7 @@ namespace Mono.Net.Security
leaf = certs [0];
if (tlsStream != null)
request.ServicePoint.SetServerCertificate (leaf);
request.ServicePoint.UpdateServerCertificate (leaf);
if (leaf == null) {
errors |= SslPolicyErrors.RemoteCertificateNotAvailable;

View File

@ -109,13 +109,19 @@ namespace Mono.Net.Security
ServicePointManager.CheckCertificateRevocationList);
status = WebExceptionStatus.Success;
} catch (Exception ex) {
status = WebExceptionStatus.SecureChannelFailure;
throw;
} finally {
if (CertificateValidationFailed)
status = WebExceptionStatus.TrustFailure;
request.ServicePoint.SetClientCertificate (sslStream.InternalLocalCertificate);
if (status != WebExceptionStatus.Success)
if (status == WebExceptionStatus.Success)
request.ServicePoint.UpdateClientCertificate (sslStream.InternalLocalCertificate);
else {
request.ServicePoint.UpdateClientCertificate (null);
sslStream = null;
}
}
try {