diff options
author | Oliver Neal <ItsVeryWindy@users.noreply.github.com> | 2016-02-10 00:52:37 +0300 |
---|---|---|
committer | Oliver Neal <oliver.neal@comparethemarket.com> | 2016-02-19 18:41:52 +0300 |
commit | 2d1ab0ef20447e200b26746134f8466db07fb56c (patch) | |
tree | d016ea98a298e3e15cfc663ad072211db6345ecb /mcs/class/System.Net.Http.WebRequest | |
parent | 9dc8e0289d22a79df421bd06849496358c7de92a (diff) |
updated client certificates to handle non-manual case
Diffstat (limited to 'mcs/class/System.Net.Http.WebRequest')
-rw-r--r-- | mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs b/mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs index 4b6649b430a..79b64375652 100644 --- a/mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs +++ b/mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs @@ -83,7 +83,13 @@ namespace System.Net.Http } public X509CertificateCollection ClientCertificates { - get { return clientCertificates; } + get { + if (this.ClientCertificateOptions != ClientCertificateOption.Manual) { + throw new InvalidOperationException("The ClientCertificateOptions property must be set to 'Manual' to use this property."); + } + + return clientCertificates; + } } [MonoTODO] @@ -147,7 +153,10 @@ namespace System.Net.Http wr.ReadWriteTimeout = readWriteTimeout; wr.UnsafeAuthenticatedConnectionSharing = unsafeAuthenticatedConnectionSharing; wr.ServerCertificateValidationCallback = serverCertificateValidationCallback; - wr.ClientCertificates = clientCertificates; + + if (this.ClientCertificateOptions == ClientCertificateOption.Manual) { + wr.ClientCertificates = clientCertificates; + } return wr; } |