Skip to content

Commit

Permalink
Merge pull request #2580 from ItsVeryWindy/master
Browse files Browse the repository at this point in the history
Updates to WebRequestHandler
  • Loading branch information
tritao committed Feb 27, 2016
2 parents 71e8d4d + 2d1ab0e commit 3c2f3d4
Showing 1 changed file with 14 additions and 3 deletions.
Expand Up @@ -42,6 +42,7 @@ public class WebRequestHandler : HttpClientHandler
int readWriteTimeout;
RemoteCertificateValidationCallback serverCertificateValidationCallback;
bool unsafeAuthenticatedConnectionSharing;
X509CertificateCollection clientCertificates;

public WebRequestHandler ()
{
Expand All @@ -54,6 +55,7 @@ public WebRequestHandler ()
readWriteTimeout = 300000;
serverCertificateValidationCallback = null;
unsafeAuthenticatedConnectionSharing = false;
clientCertificates = new X509CertificateCollection();
}

public bool AllowPipelining {
Expand All @@ -80,9 +82,14 @@ public WebRequestHandler ()
}
}

[MonoTODO]
public X509CertificateCollection ClientCertificates {
get { throw new NotImplementedException (); }
get {
if (this.ClientCertificateOptions != ClientCertificateOption.Manual) {
throw new InvalidOperationException("The ClientCertificateOptions property must be set to 'Manual' to use this property.");
}

return clientCertificates;
}
}

[MonoTODO]
Expand Down Expand Up @@ -118,7 +125,6 @@ public WebRequestHandler ()
}
}

[MonoTODO]
public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
get { return serverCertificateValidationCallback; }
set {
Expand Down Expand Up @@ -146,6 +152,11 @@ internal override HttpWebRequest CreateWebRequest (HttpRequestMessage request)
wr.MaximumResponseHeadersLength = maxResponseHeadersLength;
wr.ReadWriteTimeout = readWriteTimeout;
wr.UnsafeAuthenticatedConnectionSharing = unsafeAuthenticatedConnectionSharing;
wr.ServerCertificateValidationCallback = serverCertificateValidationCallback;

if (this.ClientCertificateOptions == ClientCertificateOption.Manual) {
wr.ClientCertificates = clientCertificates;
}

return wr;
}
Expand Down

0 comments on commit 3c2f3d4

Please sign in to comment.