From 4b76d93801ba277fcd5a440790ef6d29b7703a06 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Mon, 25 Aug 2014 14:18:18 -0700 Subject: [PATCH] Change spelling of Cancelled to Canceled. Cleanup. --- .../Constants.cs | 1 - src/Microsoft.Net.Http.Server/Constants.cs | 43 ------------------- src/Microsoft.Net.Http.Server/Helpers.cs | 2 +- .../RequestProcessing/RequestContext.cs | 2 +- .../RequestProcessing/RequestStream.cs | 2 +- .../RequestProcessing/ResponseStream.cs | 10 ++--- .../WebSocketHttpListenerDuplexStream.cs | 2 +- .../RequestTests.cs | 3 -- .../ServerTests.cs | 4 +- .../RequestBodyTests.cs | 2 +- .../ResponseBodyTests.cs | 4 +- .../ServerTests.cs | 4 +- 12 files changed, 16 insertions(+), 63 deletions(-) diff --git a/src/Microsoft.AspNet.Security.Windows/Constants.cs b/src/Microsoft.AspNet.Security.Windows/Constants.cs index 733190a708..f5f618cd83 100644 --- a/src/Microsoft.AspNet.Security.Windows/Constants.cs +++ b/src/Microsoft.AspNet.Security.Windows/Constants.cs @@ -27,7 +27,6 @@ namespace Microsoft.AspNet.Security.Windows { internal const string VersionKey = "owin.Version"; internal const string OwinVersion = "1.0"; - internal const string CallCancelledKey = "owin.CallCancelled"; internal const string RequestBodyKey = "owin.RequestBody"; internal const string RequestHeadersKey = "owin.RequestHeaders"; diff --git a/src/Microsoft.Net.Http.Server/Constants.cs b/src/Microsoft.Net.Http.Server/Constants.cs index 2d8ae594ab..e3336f6bea 100644 --- a/src/Microsoft.Net.Http.Server/Constants.cs +++ b/src/Microsoft.Net.Http.Server/Constants.cs @@ -27,49 +27,6 @@ namespace Microsoft.Net.Http.Server { internal static class Constants { - internal const string VersionKey = "owin.Version"; - internal const string OwinVersion = "1.0"; - internal const string CallCancelledKey = "owin.CallCancelled"; - - internal const string ServerCapabilitiesKey = "server.Capabilities"; - - internal const string RequestBodyKey = "owin.RequestBody"; - internal const string RequestHeadersKey = "owin.RequestHeaders"; - internal const string RequestSchemeKey = "owin.RequestScheme"; - internal const string RequestMethodKey = "owin.RequestMethod"; - internal const string RequestPathBaseKey = "owin.RequestPathBase"; - internal const string RequestPathKey = "owin.RequestPath"; - internal const string RequestQueryStringKey = "owin.RequestQueryString"; - internal const string HttpRequestProtocolKey = "owin.RequestProtocol"; - - internal const string HttpResponseProtocolKey = "owin.ResponseProtocol"; - internal const string ResponseStatusCodeKey = "owin.ResponseStatusCode"; - internal const string ResponseReasonPhraseKey = "owin.ResponseReasonPhrase"; - internal const string ResponseHeadersKey = "owin.ResponseHeaders"; - internal const string ResponseBodyKey = "owin.ResponseBody"; - - internal const string ClientCertifiateKey = "ssl.ClientCertificate"; - - internal const string RemoteIpAddressKey = "server.RemoteIpAddress"; - internal const string RemotePortKey = "server.RemotePort"; - internal const string LocalIpAddressKey = "server.LocalIpAddress"; - internal const string LocalPortKey = "server.LocalPort"; - internal const string IsLocalKey = "server.IsLocal"; - internal const string ServerOnSendingHeadersKey = "server.OnSendingHeaders"; - internal const string ServerLoggerFactoryKey = "server.LoggerFactory"; - - internal const string OpaqueVersionKey = "opaque.Version"; - internal const string OpaqueVersion = "1.0"; - internal const string OpaqueFuncKey = "opaque.Upgrade"; - internal const string OpaqueStreamKey = "opaque.Stream"; - internal const string OpaqueCallCancelledKey = "opaque.CallCancelled"; - - internal const string SendFileVersionKey = "sendfile.Version"; - internal const string SendFileVersion = "1.0"; - internal const string SendFileSupportKey = "sendfile.Support"; - internal const string SendFileConcurrencyKey = "sendfile.Concurrency"; - internal const string Overlapped = "Overlapped"; - internal const string HttpScheme = "http"; internal const string HttpsScheme = "https"; internal const string SchemeDelimiter = "://"; diff --git a/src/Microsoft.Net.Http.Server/Helpers.cs b/src/Microsoft.Net.Http.Server/Helpers.cs index a8e0a2e5a9..0d89af2dde 100644 --- a/src/Microsoft.Net.Http.Server/Helpers.cs +++ b/src/Microsoft.Net.Http.Server/Helpers.cs @@ -33,7 +33,7 @@ namespace Microsoft.Net.Http.Server return Task.FromResult(null); } - internal static Task CancelledTask() + internal static Task CanceledTask() { TaskCompletionSource tcs = new TaskCompletionSource(); tcs.TrySetCanceled(); diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs index 0c3ea2baf4..337959c064 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs @@ -37,7 +37,7 @@ namespace Microsoft.Net.Http.Server { public sealed class RequestContext : IDisposable { - internal static Action AbortDelegate = Abort; + internal static readonly Action AbortDelegate = Abort; private WebListener _server; private Request _request; diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs index aed48a5383..0be3ff8a78 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs @@ -321,7 +321,7 @@ namespace Microsoft.Net.Http.Server if (cancellationToken.IsCancellationRequested) { - return Helpers.CancelledTask(); + return Helpers.CanceledTask(); } // TODO: Verbose log parameters diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs index ce086c4ca0..7bdf20953c 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs @@ -137,7 +137,7 @@ namespace Microsoft.Net.Http.Server if (cancellationToken.IsCancellationRequested) { - return Helpers.CancelledTask(); + return Helpers.CanceledTask(); } CancellationTokenRegistration cancellationRegistration; @@ -531,7 +531,7 @@ namespace Microsoft.Net.Http.Server if (cancellationToken.IsCancellationRequested) { - return Helpers.CancelledTask(); + return Helpers.CanceledTask(); } CancellationTokenRegistration cancellationRegistration; @@ -639,7 +639,7 @@ namespace Microsoft.Net.Http.Server if (cancellationToken.IsCancellationRequested) { - return Helpers.CancelledTask(); + return Helpers.CanceledTask(); } CancellationTokenRegistration cancellationRegistration; @@ -853,8 +853,8 @@ namespace Microsoft.Net.Http.Server _leftToWrite = long.MaxValue; } - // The final Content-Length async write can only be cancelled by CancelIoEx. - // Sync can only be cancelled by CancelSynchronousIo, but we don't attempt this right now. + // The final Content-Length async write can only be Canceled by CancelIoEx. + // Sync can only be Canceled by CancelSynchronousIo, but we don't attempt this right now. [SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Justification = "It is safe to ignore the return value on a cancel operation because the connection is being closed")] internal unsafe void CancelLastWrite(SafeHandle requestQueueHandle) diff --git a/src/Microsoft.Net.WebSockets/Legacy/WebSocketHttpListenerDuplexStream.cs b/src/Microsoft.Net.WebSockets/Legacy/WebSocketHttpListenerDuplexStream.cs index f5c77b4eb4..1e23d2ec6e 100644 --- a/src/Microsoft.Net.WebSockets/Legacy/WebSocketHttpListenerDuplexStream.cs +++ b/src/Microsoft.Net.WebSockets/Legacy/WebSocketHttpListenerDuplexStream.cs @@ -667,7 +667,7 @@ namespace Microsoft.AspNet.WebSockets throw; } - // throw OperationCancelledException when canceled by the caller + // throw OperationCanceledException when canceled by the caller // otherwise swallow the exception cancellationToken.ThrowIfCancellationRequested(); } diff --git a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/RequestTests.cs b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/RequestTests.cs index 8a4efdc974..1dce566c7b 100644 --- a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/RequestTests.cs +++ b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/RequestTests.cs @@ -41,9 +41,6 @@ namespace Microsoft.AspNet.Server.WebListener var httpContext = new DefaultHttpContext((IFeatureCollection)env); try { - // General keys - // TODO: Assert.True(env.Get("owin.CallCancelled").CanBeCanceled); - var requestInfo = httpContext.GetFeature(); // Request Keys diff --git a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/ServerTests.cs b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/ServerTests.cs index 337b2359d4..7e39695da9 100644 --- a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/ServerTests.cs @@ -190,7 +190,7 @@ namespace Microsoft.AspNet.Server.WebListener } [Fact] - public async Task Server_ClientDisconnects_CallCancelled() + public async Task Server_ClientDisconnects_CallCanceled() { TimeSpan interval = TimeSpan.FromSeconds(1); ManualResetEvent received = new ManualResetEvent(false); @@ -225,7 +225,7 @@ namespace Microsoft.AspNet.Server.WebListener } [Fact] - public async Task Server_Abort_CallCancelled() + public async Task Server_Abort_CallCanceled() { TimeSpan interval = TimeSpan.FromSeconds(100); ManualResetEvent received = new ManualResetEvent(false); diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs index 47dfbcb117..de847e9331 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs @@ -169,7 +169,7 @@ namespace Microsoft.Net.Http.Server } [Fact] - public async Task RequestBody_ReadAsyncAlreadyCancelled_ReturnsCanceledTask() + public async Task RequestBody_ReadAsyncAlreadyCanceled_ReturnsCanceledTask() { string address; using (var server = Utilities.CreateHttpServer(out address)) diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs index 0a9a476ff7..b76bda6db0 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs @@ -229,7 +229,7 @@ namespace Microsoft.Net.Http.Server } [Fact] - public async Task ResponseBody_FirstWriteAsyncWithCancelledCancellationToken_CancelsButDoesNotAbort() + public async Task ResponseBody_FirstWriteAsyncWithCanceledCancellationToken_CancelsButDoesNotAbort() { string address; using (var server = Utilities.CreateHttpServer(out address)) @@ -251,7 +251,7 @@ namespace Microsoft.Net.Http.Server } [Fact] - public async Task ResponseBody_SecondWriteAsyncWithCancelledCancellationToken_CancelsButDoesNotAbort() + public async Task ResponseBody_SecondWriteAsyncWithCanceledCancellationToken_CancelsButDoesNotAbort() { string address; using (var server = Utilities.CreateHttpServer(out address)) diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs index 50b325c003..23c641dea3 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs @@ -73,7 +73,7 @@ namespace Microsoft.Net.Http.Server } [Fact] - public async Task Server_ClientDisconnects_CallCancelled() + public async Task Server_ClientDisconnects_CallCanceled() { TimeSpan interval = TimeSpan.FromSeconds(1); ManualResetEvent canceled = new ManualResetEvent(false); @@ -103,7 +103,7 @@ namespace Microsoft.Net.Http.Server } [Fact] - public async Task Server_Abort_CallCancelled() + public async Task Server_Abort_CallCanceled() { TimeSpan interval = TimeSpan.FromSeconds(1); ManualResetEvent canceled = new ManualResetEvent(false);