From e7508af2d9f34e0d9329598670fa028ec38337a4 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Thu, 26 Jun 2014 10:16:57 -0700 Subject: [PATCH] Include IHttpClientCertificateFeature changes. --- src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs | 4 ++-- .../RequestProcessing/ClientCertLoader.cs | 3 ++- src/Microsoft.Net.Server/RequestProcessing/Request.cs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs b/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs index 195dbdc..136d3ab 100644 --- a/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs +++ b/src/Microsoft.AspNet.Server.WebListener/FeatureContext.cs @@ -308,11 +308,11 @@ namespace Microsoft.AspNet.Server.WebListener set { _clientCert = value; } } - async Task IHttpClientCertificateFeature.GetClientCertificateAsync() + async Task IHttpClientCertificateFeature.GetClientCertificateAsync(CancellationToken cancellationToken) { if (_clientCert == null) { - _clientCert = await Request.GetClientCertificateAsync(); + _clientCert = await Request.GetClientCertificateAsync(cancellationToken); } return _clientCert; } diff --git a/src/Microsoft.Net.Server/RequestProcessing/ClientCertLoader.cs b/src/Microsoft.Net.Server/RequestProcessing/ClientCertLoader.cs index f1c4768..3f6228d 100644 --- a/src/Microsoft.Net.Server/RequestProcessing/ClientCertLoader.cs +++ b/src/Microsoft.Net.Server/RequestProcessing/ClientCertLoader.cs @@ -162,8 +162,9 @@ namespace Microsoft.Net.Server // ERROR_NOT_FOUND - which means the client did not provide the cert // If this is important, the server should respond with 403 forbidden // HTTP.SYS will not do this for you automatically - internal Task LoadClientCertificateAsync() + internal Task LoadClientCertificateAsync(CancellationToken cancellationToken) { + // TODO: cancellation support? Abort the request? uint size = CertBoblSize; bool retry; do diff --git a/src/Microsoft.Net.Server/RequestProcessing/Request.cs b/src/Microsoft.Net.Server/RequestProcessing/Request.cs index 2b3f4f1..ba535ac 100644 --- a/src/Microsoft.Net.Server/RequestProcessing/Request.cs +++ b/src/Microsoft.Net.Server/RequestProcessing/Request.cs @@ -455,7 +455,7 @@ namespace Microsoft.Net.Server // Populates the client certificate. The result may be null if there is no client cert. // TODO: Does it make sense for this to be invoked multiple times (e.g. renegotiate)? Client and server code appear to // enable this, but it's unclear what Http.Sys would do. - public async Task GetClientCertificateAsync() + public async Task GetClientCertificateAsync(CancellationToken cancellationToken = default(CancellationToken)) { if (SslStatus == SslStatus.Insecure) { @@ -471,7 +471,7 @@ namespace Microsoft.Net.Server ClientCertLoader certLoader = new ClientCertLoader(RequestContext); try { - await certLoader.LoadClientCertificateAsync().SupressContext(); + await certLoader.LoadClientCertificateAsync(cancellationToken).SupressContext(); // Populate the environment. if (certLoader.ClientCert != null) {