Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to WebRequestHandler #2580

Merged
merged 2 commits into from Feb 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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