diff --git a/WebListener.sln b/WebListener.sln index 5623786..21d618b 100644 --- a/WebListener.sln +++ b/WebListener.sln @@ -10,17 +10,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E183C826-1 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{3A1E31E3-2794-4CA3-B8E2-253E96BDE514}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Server", "src\Microsoft.Net.Http.Server\Microsoft.Net.Http.Server.xproj", "{3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloWorld", "samples\HelloWorld\HelloWorld.xproj", "{6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SelfHostServer", "samples\SelfHostServer\SelfHostServer.xproj", "{1236F93A-AC5C-4A77-9477-C88F040151CA}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.WebListener.FunctionalTests", "test\Microsoft.AspNetCore.Server.WebListener.FunctionalTests\Microsoft.AspNetCore.Server.WebListener.FunctionalTests.xproj", "{4492FF4C-9032-411D-853F-46B01755E504}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.WebListener", "src\Microsoft.AspNetCore.Server.WebListener\Microsoft.AspNetCore.Server.WebListener.xproj", "{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.HttpSys.FunctionalTests", "test\Microsoft.AspNetCore.Server.HttpSys.FunctionalTests\Microsoft.AspNetCore.Server.HttpSys.FunctionalTests.xproj", "{4492FF4C-9032-411D-853F-46B01755E504}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Server.FunctionalTests", "test\Microsoft.Net.Http.Server.FunctionalTests\Microsoft.Net.Http.Server.FunctionalTests.xproj", "{DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.HttpSys", "src\Microsoft.AspNetCore.Server.HttpSys\Microsoft.AspNetCore.Server.HttpSys.xproj", "{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5E9B546C-17AC-4BDF-BCB3-5955D4755ED8}" ProjectSection(SolutionItems) = preProject @@ -29,7 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HotAddSample", "samples\HotAddSample\HotAddSample.xproj", "{8BFA392A-8B67-4454-916B-67C545EDFAEF}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Server.Tests", "test\Microsoft.Net.Http.Server.Tests\Microsoft.Net.Http.Server.Tests.xproj", "{E837249E-E666-4DF2-AFC3-7A4D70234F9F}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.HttpSys.Tests", "test\Microsoft.AspNetCore.Server.HttpSys.Tests\Microsoft.AspNetCore.Server.HttpSys.Tests.xproj", "{E837249E-E666-4DF2-AFC3-7A4D70234F9F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -51,26 +45,6 @@ Global {8B828433-B333-4C19-96AE-00BFFF9D8841}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {8B828433-B333-4C19-96AE-00BFFF9D8841}.Release|Mixed Platforms.Build.0 = Release|Any CPU {8B828433-B333-4C19-96AE-00BFFF9D8841}.Release|x86.ActiveCfg = Release|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Debug|x86.ActiveCfg = Debug|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Release|Any CPU.Build.0 = Release|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}.Release|x86.ActiveCfg = Release|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Debug|x86.ActiveCfg = Debug|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Release|Any CPU.Build.0 = Release|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}.Release|x86.ActiveCfg = Release|Any CPU {1236F93A-AC5C-4A77-9477-C88F040151CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1236F93A-AC5C-4A77-9477-C88F040151CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {1236F93A-AC5C-4A77-9477-C88F040151CA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -101,16 +75,6 @@ Global {B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|Mixed Platforms.Build.0 = Release|Any CPU {B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|x86.ActiveCfg = Release|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Debug|x86.ActiveCfg = Debug|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Release|Any CPU.Build.0 = Release|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1}.Release|x86.ActiveCfg = Release|Any CPU {8BFA392A-8B67-4454-916B-67C545EDFAEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8BFA392A-8B67-4454-916B-67C545EDFAEF}.Debug|Any CPU.Build.0 = Debug|Any CPU {8BFA392A-8B67-4454-916B-67C545EDFAEF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -141,12 +105,9 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {8B828433-B333-4C19-96AE-00BFFF9D8841} = {3A1E31E3-2794-4CA3-B8E2-253E96BDE514} - {3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1} = {99D5E5F3-88F5-4CCF-8D8C-717C8925DF09} - {6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4} = {3A1E31E3-2794-4CA3-B8E2-253E96BDE514} {1236F93A-AC5C-4A77-9477-C88F040151CA} = {3A1E31E3-2794-4CA3-B8E2-253E96BDE514} {4492FF4C-9032-411D-853F-46B01755E504} = {E183C826-1360-4DFF-9994-F33CED5C8525} {B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92} = {99D5E5F3-88F5-4CCF-8D8C-717C8925DF09} - {DCB6E0B1-223D-44E6-8696-4767E5B6E6A1} = {E183C826-1360-4DFF-9994-F33CED5C8525} {8BFA392A-8B67-4454-916B-67C545EDFAEF} = {3A1E31E3-2794-4CA3-B8E2-253E96BDE514} {E837249E-E666-4DF2-AFC3-7A4D70234F9F} = {E183C826-1360-4DFF-9994-F33CED5C8525} EndGlobalSection diff --git a/samples/HelloWorld/HelloWorld.xproj b/samples/HelloWorld/HelloWorld.xproj deleted file mode 100644 index 4506551..0000000 --- a/samples/HelloWorld/HelloWorld.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 6daf3e6b-8e1b-4e6e-b9fe-7b1e5fdb7db4 - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/samples/HelloWorld/Program.cs b/samples/HelloWorld/Program.cs deleted file mode 100644 index dac0e30..0000000 --- a/samples/HelloWorld/Program.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Net.WebSockets; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Net.Http.Server; - -namespace HelloWorld -{ - public class Program - { - public static void Main(string[] args) - { - Run(args).Wait(); - } - - public static async Task Run(string[] args) - { - var settings = new WebListenerSettings(); - settings.UrlPrefixes.Add("http://localhost:8080"); - - using (WebListener listener = new WebListener(settings)) - { - listener.Start(); - - Console.WriteLine("Running..."); - while (true) - { - RequestContext context = await listener.AcceptAsync(); - Console.WriteLine("Accepted"); - - // Context: - // context.User; - // context.DisconnectToken - // context.Dispose() - // context.Abort(); - - // Request - // context.Request.ProtocolVersion - // context.Request.Headers - // context.Request.Method - // context.Request.Body - // Content-Length - long? - // Content-Type - string - // IsSecureConnection - // HasEntityBody - - // TODO: Request fields - // Content-Encoding - Encoding - // Host - // Client certs - GetCertAsync, CertErrors - // Cookies - // KeepAlive - // QueryString (parsed) - // RequestTraceIdentifier - // RawUrl - // URI - // IsWebSocketRequest - // LocalEndpoint vs LocalIP & LocalPort - // RemoteEndpoint vs RemoteIP & RemotePort - // AcceptTypes string[] - // ServiceName - // TransportContext - - // Response - byte[] bytes = Encoding.ASCII.GetBytes("Hello World: " + DateTime.Now); - - if (context.IsWebSocketRequest) - { - Console.WriteLine("WebSocket"); - WebSocket webSocket = await context.AcceptWebSocketAsync(); - await webSocket.SendAsync(new ArraySegment(bytes, 0, bytes.Length), WebSocketMessageType.Text, true, CancellationToken.None); - await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Goodbye", CancellationToken.None); - webSocket.Dispose(); - } - else - { - Console.WriteLine("Hello World"); - context.Response.ContentLength = bytes.Length; - context.Response.ContentType = "text/plain"; - - context.Response.Body.Write(bytes, 0, bytes.Length); - context.Dispose(); - } - } - } - } - } -} \ No newline at end of file diff --git a/samples/HelloWorld/Properties/launchSettings.json b/samples/HelloWorld/Properties/launchSettings.json deleted file mode 100644 index f96a6f4..0000000 --- a/samples/HelloWorld/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "HelloWorld": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "http://localhost:8080" - } - } -} \ No newline at end of file diff --git a/samples/HelloWorld/project.json b/samples/HelloWorld/project.json deleted file mode 100644 index 2d1231f..0000000 --- a/samples/HelloWorld/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "Microsoft.Net.Http.Server": "1.2.0-*" - }, - "commands": { - "sample": "HelloWorld" - }, - "frameworks": { - "net451": {}, - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.2.0-*", - "type": "platform" - } - } - } - } -} \ No newline at end of file diff --git a/samples/HotAddSample/Startup.cs b/samples/HotAddSample/Startup.cs index a6cf016..f0ede45 100644 --- a/samples/HotAddSample/Startup.cs +++ b/samples/HotAddSample/Startup.cs @@ -2,10 +2,9 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Server.WebListener; +using Microsoft.AspNetCore.Server.HttpSys; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Net.Http.Server; namespace HotAddSample { @@ -16,19 +15,19 @@ public class Startup { public void ConfigureServices(IServiceCollection services) { - services.Configure(options => + services.Configure(options => { - ListenerSettings = options.ListenerSettings; + ServerOptions = options; }); } - public WebListenerSettings ListenerSettings { get; set; } + public HttpSysOptions ServerOptions { get; set; } public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory) { loggerfactory.AddConsole(LogLevel.Information); - var addresses = ListenerSettings.UrlPrefixes; + var addresses = ServerOptions.UrlPrefixes; addresses.Add("http://localhost:12346/pathBase/"); app.Use(async (context, next) => @@ -103,7 +102,7 @@ public static void Main(string[] args) { var host = new WebHostBuilder() .UseStartup() - .UseWebListener() + .UseHttpSys() .Build(); host.Run(); diff --git a/samples/HotAddSample/project.json b/samples/HotAddSample/project.json index f67b728..e351732 100644 --- a/samples/HotAddSample/project.json +++ b/samples/HotAddSample/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.AspNetCore.Server.WebListener": "1.2.0-*", + "Microsoft.AspNetCore.Server.HttpSys": "1.2.0-*", "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "buildOptions": { diff --git a/samples/SelfHostServer/Startup.cs b/samples/SelfHostServer/Startup.cs index c6a9fec..f327d5b 100644 --- a/samples/SelfHostServer/Startup.cs +++ b/samples/SelfHostServer/Startup.cs @@ -5,10 +5,9 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Server.WebListener; +using Microsoft.AspNetCore.Server.HttpSys; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Net.Http.Server; namespace SelfHostServer { @@ -17,10 +16,10 @@ public class Startup public void ConfigureServices(IServiceCollection services) { // Server options can be configured here instead of in Main. - services.Configure(options => + services.Configure(options => { - options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.None; - options.ListenerSettings.Authentication.AllowAnonymous = true; + options.Authentication.Schemes = AuthenticationSchemes.None; + options.Authentication.AllowAnonymous = true; }); } @@ -50,10 +49,10 @@ public static void Main(string[] args) { var host = new WebHostBuilder() .UseStartup() - .UseWebListener(options => + .UseHttpSys(options => { - options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.None; - options.ListenerSettings.Authentication.AllowAnonymous = true; + options.Authentication.Schemes = AuthenticationSchemes.None; + options.Authentication.AllowAnonymous = true; }) .Build(); diff --git a/samples/SelfHostServer/project.json b/samples/SelfHostServer/project.json index 4714c23..756b800 100644 --- a/samples/SelfHostServer/project.json +++ b/samples/SelfHostServer/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.AspNetCore.Server.WebListener": "1.2.0-*", + "Microsoft.AspNetCore.Server.HttpSys": "1.2.0-*", "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "buildOptions": { diff --git a/src/Microsoft.Net.Http.Server/AsyncAcceptContext.cs b/src/Microsoft.AspNetCore.Server.HttpSys/AsyncAcceptContext.cs similarity index 94% rename from src/Microsoft.Net.Http.Server/AsyncAcceptContext.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/AsyncAcceptContext.cs index 608e46d..3057e13 100644 --- a/src/Microsoft.Net.Http.Server/AsyncAcceptContext.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/AsyncAcceptContext.cs @@ -7,17 +7,17 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal unsafe class AsyncAcceptContext : IAsyncResult, IDisposable { internal static readonly IOCompletionCallback IOCallback = new IOCompletionCallback(IOWaitCallback); private TaskCompletionSource _tcs; - private WebListener _server; + private HttpSysListener _server; private NativeRequestContext _nativeRequestContext; - internal AsyncAcceptContext(WebListener server) + internal AsyncAcceptContext(HttpSysListener server) { _server = server; _tcs = new TaskCompletionSource(); @@ -40,7 +40,7 @@ private TaskCompletionSource Tcs } } - internal WebListener Server + internal HttpSysListener Server { get { @@ -58,12 +58,12 @@ private static void IOCompleted(AsyncAcceptContext asyncResult, uint errorCode, if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_MORE_DATA) { - asyncResult.Tcs.TrySetException(new WebListenerException((int)errorCode)); + asyncResult.Tcs.TrySetException(new HttpSysException((int)errorCode)); complete = true; } else { - WebListener server = asyncResult.Server; + HttpSysListener server = asyncResult.Server; if (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { // at this point we have received an unmanaged HTTP_REQUEST and memoryBlob @@ -106,7 +106,7 @@ private static void IOCompleted(AsyncAcceptContext asyncResult, uint errorCode, { // someother bad error, possible(?) return values are: // ERROR_INVALID_HANDLE, ERROR_INSUFFICIENT_BUFFER, ERROR_OPERATION_ABORTED - asyncResult.Tcs.TrySetException(new WebListenerException((int)statusCode)); + asyncResult.Tcs.TrySetException(new HttpSysException((int)statusCode)); complete = true; } } @@ -169,7 +169,7 @@ internal uint QueueBeginGetContext() retry = true; } else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS - && WebListener.SkipIOCPCallbackOnSuccess) + && HttpSysListener.SkipIOCPCallbackOnSuccess) { // IO operation completed synchronously - callback won't be called to signal completion. IOCompleted(this, statusCode, bytesTransferred); diff --git a/src/Microsoft.AspNetCore.Server.WebListener/AuthenticationHandler.cs b/src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationHandler.cs similarity index 98% rename from src/Microsoft.AspNetCore.Server.WebListener/AuthenticationHandler.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationHandler.cs index d556fca..81c030e 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/AuthenticationHandler.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationHandler.cs @@ -7,9 +7,8 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.Extensions.Internal; -using Microsoft.Net.Http.Server; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { internal class AuthenticationHandler : IAuthenticationHandler { diff --git a/src/Microsoft.Net.Http.Server/AuthenticationManager.cs b/src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationManager.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/AuthenticationManager.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationManager.cs index 31b1b9b..e4b728d 100644 --- a/src/Microsoft.Net.Http.Server/AuthenticationManager.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationManager.cs @@ -10,7 +10,7 @@ using System.Security.Principal; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // See the native HTTP_SERVER_AUTHENTICATION_INFO structure documentation for additional information. // http://msdn.microsoft.com/en-us/library/windows/desktop/aa364638(v=vs.85).aspx diff --git a/src/Microsoft.Net.Http.Server/AuthenticationSchemes.cs b/src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationSchemes.cs similarity index 91% rename from src/Microsoft.Net.Http.Server/AuthenticationSchemes.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationSchemes.cs index a531724..3d82bda 100644 --- a/src/Microsoft.Net.Http.Server/AuthenticationSchemes.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/AuthenticationSchemes.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // REVIEW: this appears to be very similar to System.Net.AuthenticationSchemes [Flags] diff --git a/src/Microsoft.Net.Http.Server/Constants.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Constants.cs similarity index 93% rename from src/Microsoft.Net.Http.Server/Constants.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Constants.cs index 866b87d..83a8067 100644 --- a/src/Microsoft.Net.Http.Server/Constants.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/Constants.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class Constants { diff --git a/src/Microsoft.AspNetCore.Server.WebListener/FeatureContext.cs b/src/Microsoft.AspNetCore.Server.HttpSys/FeatureContext.cs similarity index 99% rename from src/Microsoft.AspNetCore.Server.WebListener/FeatureContext.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/FeatureContext.cs index d2a0bd5..867e1e5 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/FeatureContext.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/FeatureContext.cs @@ -16,9 +16,8 @@ using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.Extensions.Internal; using Microsoft.Net.Http.Headers; -using Microsoft.Net.Http.Server; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { internal class FeatureContext : IHttpRequestFeature, diff --git a/src/Microsoft.AspNetCore.Server.WebListener/HeaderDictionary.cs b/src/Microsoft.AspNetCore.Server.HttpSys/HeaderDictionary.cs similarity index 99% rename from src/Microsoft.AspNetCore.Server.WebListener/HeaderDictionary.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/HeaderDictionary.cs index 6676fd8..fdc00ee 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/HeaderDictionary.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/HeaderDictionary.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { /// /// Represents a wrapper for RequestHeaders and ResponseHeaders. diff --git a/src/Microsoft.Net.Http.Server/Helpers.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Helpers.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/Helpers.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Helpers.cs index fb79443..9fee1c1 100644 --- a/src/Microsoft.Net.Http.Server/Helpers.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/Helpers.cs @@ -7,7 +7,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class Helpers { diff --git a/src/Microsoft.Net.Http.Server/WebListenerException.cs b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysException.cs similarity index 78% rename from src/Microsoft.Net.Http.Server/WebListenerException.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/HttpSysException.cs index 3b3b91d..7d9b6aa 100644 --- a/src/Microsoft.Net.Http.Server/WebListenerException.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysException.cs @@ -6,22 +6,22 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { [SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")] - public class WebListenerException : Win32Exception + public class HttpSysException : Win32Exception { - internal WebListenerException() + internal HttpSysException() : base(Marshal.GetLastWin32Error()) { } - internal WebListenerException(int errorCode) + internal HttpSysException(int errorCode) : base(errorCode) { } - internal WebListenerException(int errorCode, string message) + internal HttpSysException(int errorCode, string message) : base(errorCode, message) { } diff --git a/src/Microsoft.Net.Http.Server/WebListener.cs b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs similarity index 90% rename from src/Microsoft.Net.Http.Server/WebListener.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs index 903103d..a42c1f9 100644 --- a/src/Microsoft.Net.Http.Server/WebListener.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs @@ -6,14 +6,15 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { /// /// An HTTP server wrapping the Http.Sys APIs that accepts requests. /// - public sealed class WebListener : IDisposable + internal class HttpSysListener : IDisposable { // Win8# 559317 fixed a bug in Http.sys's HttpReceiveClientCertificate method. // Without this fix IOCP callbacks were not being called although ERROR_IO_PENDING was @@ -39,16 +40,15 @@ public sealed class WebListener : IDisposable private object _internalLock; - public WebListener() - : this(new WebListenerSettings()) + public HttpSysListener(HttpSysOptions options, ILoggerFactory loggerFactory) { - } - - public WebListener(WebListenerSettings settings) - { - if (settings == null) + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + if (loggerFactory == null) { - throw new ArgumentNullException(nameof(settings)); + throw new ArgumentNullException(nameof(loggerFactory)); } if (!HttpApi.Supported) @@ -58,7 +58,9 @@ public WebListener(WebListenerSettings settings) Debug.Assert(HttpApi.ApiVersion == HttpApi.HTTP_API_VERSION.Version20, "Invalid Http api version"); - Settings = settings; + Options = options; + + Logger = LogHelper.CreateLogger(loggerFactory, typeof(HttpSysListener)); _state = State.Stopped; _internalLock = new object(); @@ -98,10 +100,7 @@ internal enum State Disposed, } - internal ILogger Logger - { - get { return Settings.Logger; } - } + internal ILogger Logger { get; private set; } internal UrlGroup UrlGroup { @@ -118,7 +117,7 @@ internal DisconnectListener DisconnectListener get { return _disconnectListener; } } - public WebListenerSettings Settings { get; } + public HttpSysOptions Options { get; } public bool IsListening { @@ -147,18 +146,18 @@ public void Start() return; } - Settings.Authentication.SetUrlGroupSecurity(UrlGroup); - Settings.Timeouts.SetUrlGroupTimeouts(UrlGroup); - Settings.SetRequestQueueLimit(RequestQueue); + Options.Authentication.SetUrlGroupSecurity(UrlGroup); + Options.Timeouts.SetUrlGroupTimeouts(UrlGroup); + Options.SetRequestQueueLimit(RequestQueue); _requestQueue.AttachToUrlGroup(); // All resources are set up correctly. Now add all prefixes. try { - Settings.UrlPrefixes.RegisterAllPrefixes(UrlGroup); + Options.UrlPrefixes.RegisterAllPrefixes(UrlGroup); } - catch (WebListenerException) + catch (HttpSysException) { // If an error occurred while adding prefixes, free all resources allocated by previous steps. _requestQueue.DetachFromUrlGroup(); @@ -190,7 +189,7 @@ private void Stop() return; } - Settings.UrlPrefixes.UnregisterAllPrefixes(); + Options.UrlPrefixes.UnregisterAllPrefixes(); _state = State.Stopped; @@ -284,7 +283,7 @@ public Task AcceptAsync() // some other bad error, possible(?) return values are: // ERROR_INVALID_HANDLE, ERROR_INSUFFICIENT_BUFFER, ERROR_OPERATION_ABORTED asyncResult.Dispose(); - throw new WebListenerException((int)statusCode); + throw new HttpSysException((int)statusCode); } } catch (Exception exception) @@ -301,7 +300,7 @@ internal unsafe bool ValidateRequest(NativeRequestContext requestMemory) // Block potential DOS attacks if (requestMemory.UnknownHeaderCount > UnknownHeaderLimit) { - SendError(requestMemory.RequestId, HttpStatusCode.BadRequest, authChallenges: null); + SendError(requestMemory.RequestId, StatusCodes.Status400BadRequest, authChallenges: null); return false; } return true; @@ -309,16 +308,16 @@ internal unsafe bool ValidateRequest(NativeRequestContext requestMemory) internal unsafe bool ValidateAuth(NativeRequestContext requestMemory) { - if (!Settings.Authentication.AllowAnonymous && !requestMemory.CheckAuthenticated()) + if (!Options.Authentication.AllowAnonymous && !requestMemory.CheckAuthenticated()) { - SendError(requestMemory.RequestId, HttpStatusCode.Unauthorized, - AuthenticationManager.GenerateChallenges(Settings.Authentication.Schemes)); + SendError(requestMemory.RequestId, StatusCodes.Status401Unauthorized, + AuthenticationManager.GenerateChallenges(Options.Authentication.Schemes)); return false; } return true; } - private unsafe void SendError(ulong requestId, HttpStatusCode httpStatusCode, IList authChallenges) + private unsafe void SendError(ulong requestId, int httpStatusCode, IList authChallenges) { HttpApi.HTTP_RESPONSE_V2 httpResponse = new HttpApi.HTTP_RESPONSE_V2(); httpResponse.Response_V1.Version = new HttpApi.HTTP_VERSION(); diff --git a/src/Microsoft.Net.Http.Server/WebListenerSettings.cs b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs similarity index 79% rename from src/Microsoft.Net.Http.Server/WebListenerSettings.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs index cb54783..4d8e4cc 100644 --- a/src/Microsoft.Net.Http.Server/WebListenerSettings.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs @@ -5,37 +5,33 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { - public class WebListenerSettings + public class HttpSysOptions { private const long DefaultRequestQueueLength = 1000; // Http.sys default. + internal static readonly int DefaultMaxAccepts = 5 * Environment.ProcessorCount; // The native request queue private long _requestQueueLength = DefaultRequestQueueLength; private RequestQueue _requestQueue; private ILogger _logger = NullLogger.Instance; - public WebListenerSettings() + public HttpSysOptions() { } /// - /// The logger that will be used to create the WebListener instance. This should not be changed - /// after creating the listener. + /// The maximum number of concurrent accepts. /// - public ILogger Logger - { - get { return _logger; } - set - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - _logger = value; - } - } + public int MaxAccepts { get; set; } = DefaultMaxAccepts; + + /// + /// Attempts kernel mode caching for responses with eligible headers. The response may not include + /// Set-Cookie, Vary, or Pragma headers. It must include a Cache-Control header with Public and + /// either a Shared-Max-Age or Max-Age value, or an Expires header. + /// + public bool EnableResponseCaching { get; set; } = true; /// /// The url prefixes to register with Http.Sys. These may be modified at any time prior to disposing diff --git a/src/Microsoft.AspNetCore.Server.WebListener/LogHelper.cs b/src/Microsoft.AspNetCore.Server.HttpSys/LogHelper.cs similarity index 84% rename from src/Microsoft.AspNetCore.Server.WebListener/LogHelper.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/LogHelper.cs index 70a8193..6442e08 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/LogHelper.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/LogHelper.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class LogHelper { @@ -31,6 +31,18 @@ internal static void LogInfo(ILogger logger, string data) } } + internal static void LogDebug(ILogger logger, string location, string data) + { + if (logger == null) + { + Debug.WriteLine(data); + } + else + { + logger.LogDebug(location + "; " + data); + } + } + internal static void LogDebug(ILogger logger, string location, Exception exception) { if (logger == null) diff --git a/src/Microsoft.AspNetCore.Server.WebListener/MessagePump.cs b/src/Microsoft.AspNetCore.Server.HttpSys/MessagePump.cs similarity index 93% rename from src/Microsoft.AspNetCore.Server.WebListener/MessagePump.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/MessagePump.cs index f88b4f1..bd6dbec 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/MessagePump.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/MessagePump.cs @@ -11,13 +11,12 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Microsoft.Net.Http.Server; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { internal class MessagePump : IServer { - private readonly Microsoft.Net.Http.Server.WebListener _listener; + private readonly HttpSysListener _listener; private readonly ILogger _logger; private IHttpApplication _application; @@ -32,7 +31,7 @@ internal class MessagePump : IServer private readonly ServerAddressesFeature _serverAddresses; - public MessagePump(IOptions options, ILoggerFactory loggerFactory) + public MessagePump(IOptions options, ILoggerFactory loggerFactory) { if (options == null) { @@ -44,7 +43,7 @@ public MessagePump(IOptions options, ILoggerFactory loggerFa } var optionsInstance = options.Value; - _listener = new Microsoft.Net.Http.Server.WebListener(optionsInstance.ListenerSettings); + _listener = new HttpSysListener(optionsInstance, loggerFactory); _logger = LogHelper.CreateLogger(loggerFactory, typeof(MessagePump)); Features = new FeatureCollection(); _serverAddresses = new ServerAddressesFeature(); @@ -56,7 +55,7 @@ public MessagePump(IOptions options, ILoggerFactory loggerFa _shutdownSignal = new ManualResetEvent(false); } - internal Microsoft.Net.Http.Server.WebListener Listener + internal HttpSysListener Listener { get { return _listener; } } @@ -81,7 +80,7 @@ public void Start(IHttpApplication application) _application = new ApplicationWrapper(application); - if (_listener.Settings.UrlPrefixes.Count == 0) + if (_listener.Options.UrlPrefixes.Count == 0) { throw new InvalidOperationException("No address prefixes were defined."); } @@ -207,11 +206,11 @@ private static void SetFatalResponse(RequestContext context, int status) context.Dispose(); } - private void ParseAddresses(ICollection addresses, Microsoft.Net.Http.Server.WebListener listener) + private void ParseAddresses(ICollection addresses, HttpSysListener listener) { foreach (var value in addresses) { - listener.Settings.UrlPrefixes.Add(UrlPrefix.Create(value)); + listener.Options.UrlPrefixes.Add(UrlPrefix.Create(value)); } } diff --git a/src/Microsoft.AspNetCore.Server.WebListener/Microsoft.AspNetCore.Server.WebListener.xproj b/src/Microsoft.AspNetCore.Server.HttpSys/Microsoft.AspNetCore.Server.HttpSys.xproj similarity index 91% rename from src/Microsoft.AspNetCore.Server.WebListener/Microsoft.AspNetCore.Server.WebListener.xproj rename to src/Microsoft.AspNetCore.Server.HttpSys/Microsoft.AspNetCore.Server.HttpSys.xproj index aaf4cfb..603e49e 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/Microsoft.AspNetCore.Server.WebListener.xproj +++ b/src/Microsoft.AspNetCore.Server.HttpSys/Microsoft.AspNetCore.Server.HttpSys.xproj @@ -13,5 +13,8 @@ 2.0 + + + \ No newline at end of file diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/AddressFamily.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/AddressFamily.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/NativeInterop/AddressFamily.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/AddressFamily.cs index d2ebe14..a9938a3 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/AddressFamily.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/AddressFamily.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { #if NET451 /// diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ComNetOS.cs similarity index 93% rename from src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ComNetOS.cs index 61e02d9..8168e2c 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ComNetOS.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Internal; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class ComNetOS { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/ContextAttribute.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/NativeInterop/ContextAttribute.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs index 5c1dfed..6b24490 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/ContextAttribute.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal enum ContextAttribute { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/CookedUrl.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/CookedUrl.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/NativeInterop/CookedUrl.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/CookedUrl.cs index f726828..a444c48 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/CookedUrl.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/CookedUrl.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.InteropServices; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // Note this type should only be used while the request buffer remains pinned internal class CookedUrl diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/DisconnectListener.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/DisconnectListener.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/NativeInterop/DisconnectListener.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/DisconnectListener.cs index 56bbb02..f9a3a7c 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/DisconnectListener.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/DisconnectListener.cs @@ -8,7 +8,7 @@ using System.Threading; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class DisconnectListener { @@ -111,7 +111,7 @@ private unsafe CancellationToken CreateDisconnectToken(ulong connectionId) cts.Cancel(); } - if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess) + if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && HttpSysListener.SkipIOCPCallbackOnSuccess) { // IO operation completed synchronously - callback won't be called to signal completion nativeOverlapped.Dispose(); diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HeapAllocHandle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HeapAllocHandle.cs similarity index 94% rename from src/Microsoft.Net.Http.Server/NativeInterop/HeapAllocHandle.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HeapAllocHandle.cs index 100ee43..289252e 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HeapAllocHandle.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HeapAllocHandle.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Win32.SafeHandles; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal sealed class HeapAllocHandle : SafeHandleZeroOrMinusOneIsInvalid { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HttpApi.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/NativeInterop/HttpApi.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs index 6ba4851..71b8bfe 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HttpApi.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static unsafe class HttpApi { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HttpRequestQueueV2Handle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpRequestQueueV2Handle.cs similarity index 93% rename from src/Microsoft.Net.Http.Server/NativeInterop/HttpRequestQueueV2Handle.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpRequestQueueV2Handle.cs index 41c21ec..46c725b 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HttpRequestQueueV2Handle.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpRequestQueueV2Handle.cs @@ -3,7 +3,7 @@ using Microsoft.Win32.SafeHandles; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // This class is a wrapper for Http.sys V2 request queue handle. internal sealed class HttpRequestQueueV2Handle : SafeHandleZeroOrMinusOneIsInvalid diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HttpServerSessionHandle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpServerSessionHandle.cs similarity index 96% rename from src/Microsoft.Net.Http.Server/NativeInterop/HttpServerSessionHandle.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpServerSessionHandle.cs index 346351e..4ed550c 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HttpServerSessionHandle.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpServerSessionHandle.cs @@ -5,7 +5,7 @@ using System.Threading; using Microsoft.Win32.SafeHandles; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal sealed class HttpServerSessionHandle : CriticalHandleZeroOrMinusOneIsInvalid { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HttpSysRequestHeader.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysRequestHeader.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/NativeInterop/HttpSysRequestHeader.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysRequestHeader.cs index 58fadd7..bf8cda9 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HttpSysRequestHeader.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysRequestHeader.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal enum HttpSysRequestHeader { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HttpSysResponseHeader.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysResponseHeader.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/NativeInterop/HttpSysResponseHeader.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysResponseHeader.cs index 4e2fd9f..2d6ee2a 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HttpSysResponseHeader.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysResponseHeader.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal enum HttpSysResponseHeader { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/HttpSysSettings.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysSettings.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/NativeInterop/HttpSysSettings.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysSettings.cs index dc2138a..704803b 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/HttpSysSettings.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpSysSettings.cs @@ -10,7 +10,7 @@ using Microsoft.Win32; #endif -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class HttpSysSettings { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/IntPtrHelper.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/IntPtrHelper.cs similarity index 91% rename from src/Microsoft.Net.Http.Server/NativeInterop/IntPtrHelper.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/IntPtrHelper.cs index f4bbeb7..f2cce9f 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/IntPtrHelper.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/IntPtrHelper.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class IntPtrHelper { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/NclUtilities.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/NclUtilities.cs similarity index 91% rename from src/Microsoft.Net.Http.Server/NativeInterop/NclUtilities.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/NclUtilities.cs index 16fc5ec..3230b11 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/NclUtilities.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/NclUtilities.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class NclUtilities { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/RequestQueue.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/RequestQueue.cs similarity index 93% rename from src/Microsoft.Net.Http.Server/NativeInterop/RequestQueue.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/RequestQueue.cs index e8cfff4..4468f70 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/RequestQueue.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/RequestQueue.cs @@ -6,7 +6,7 @@ using System.Threading; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class RequestQueue { @@ -28,17 +28,17 @@ internal RequestQueue(UrlGroup urlGroup, ILogger logger) if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { - throw new WebListenerException((int)statusCode); + throw new HttpSysException((int)statusCode); } // Disabling callbacks when IO operation completes synchronously (returns ErrorCodes.ERROR_SUCCESS) - if (WebListener.SkipIOCPCallbackOnSuccess && + if (HttpSysListener.SkipIOCPCallbackOnSuccess && !UnsafeNclNativeMethods.SetFileCompletionNotificationModes( requestQueueHandle, UnsafeNclNativeMethods.FileCompletionNotificationModes.SkipCompletionPortOnSuccess | UnsafeNclNativeMethods.FileCompletionNotificationModes.SkipSetEventOnHandle)) { - throw new WebListenerException(Marshal.GetLastWin32Error()); + throw new HttpSysException(Marshal.GetLastWin32Error()); } Handle = requestQueueHandle; @@ -94,7 +94,7 @@ internal unsafe void SetLengthLimit(long length) if (result != 0) { - throw new WebListenerException((int)result); + throw new HttpSysException((int)result); } } diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SSPIHandle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs similarity index 94% rename from src/Microsoft.Net.Http.Server/NativeInterop/SSPIHandle.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs index 33885c2..8a6801a 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SSPIHandle.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.InteropServices; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { [StructLayout(LayoutKind.Sequential, Pack = 1)] internal struct SSPIHandle diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLoadLibrary.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs similarity index 96% rename from src/Microsoft.Net.Http.Server/NativeInterop/SafeLoadLibrary.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs index be7547d..c880a7f 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLoadLibrary.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs @@ -3,7 +3,7 @@ using Microsoft.Win32.SafeHandles; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal sealed class SafeLoadLibrary : SafeHandleZeroOrMinusOneIsInvalid { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalFree.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs similarity index 96% rename from src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalFree.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs index eed7b84..06824eb 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalFree.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Win32.SafeHandles; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal sealed class SafeLocalFree : SafeHandleZeroOrMinusOneIsInvalid { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalFreeChannelBinding.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFreeChannelBinding.cs similarity index 96% rename from src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalFreeChannelBinding.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFreeChannelBinding.cs index f2e685f..eb3ecf7 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalFreeChannelBinding.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFreeChannelBinding.cs @@ -4,7 +4,7 @@ using System; using System.Security.Authentication.ExtendedProtection; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class SafeLocalFreeChannelBinding : ChannelBinding { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalMemHandle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalMemHandle.cs similarity index 94% rename from src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalMemHandle.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalMemHandle.cs index e367283..5e60f6e 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SafeLocalMemHandle.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalMemHandle.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Win32.SafeHandles; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal sealed class SafeLocalMemHandle : SafeHandleZeroOrMinusOneIsInvalid { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SafeNativeOverlapped.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeNativeOverlapped.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/NativeInterop/SafeNativeOverlapped.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeNativeOverlapped.cs index 70f83b0..8073499 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SafeNativeOverlapped.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeNativeOverlapped.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Threading; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class SafeNativeOverlapped : SafeHandle { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SchProtocols.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/NativeInterop/SchProtocols.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs index 845078c..591d585 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SchProtocols.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { using System; using System.Globalization; diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SecurityStatus.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/NativeInterop/SecurityStatus.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs index 66302a5..c46b114 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SecurityStatus.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal enum SecurityStatus { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/ServerSession.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ServerSession.cs similarity index 89% rename from src/Microsoft.Net.Http.Server/NativeInterop/ServerSession.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ServerSession.cs index 4dbbeda..9bebb1e 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/ServerSession.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ServerSession.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class ServerSession : IDisposable { @@ -16,7 +16,7 @@ internal unsafe ServerSession() if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { - throw new WebListenerException((int)statusCode); + throw new HttpSysException((int)statusCode); } Debug.Assert(serverSessionId != 0, "Invalid id returned by HttpCreateServerSession"); diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/SocketAddress.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SocketAddress.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/NativeInterop/SocketAddress.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SocketAddress.cs index 9e49128..a06adf2 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/SocketAddress.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SocketAddress.cs @@ -8,7 +8,7 @@ using System.Net; using System.Text; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // a little perf app measured these times when comparing the internal // buffer implemented as a managed byte[] or unmanaged memory IntPtr diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/TokenBindingUtil.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/TokenBindingUtil.cs similarity index 94% rename from src/Microsoft.Net.Http.Server/NativeInterop/TokenBindingUtil.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/TokenBindingUtil.cs index fc916d7..4c40acb 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/TokenBindingUtil.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/TokenBindingUtil.cs @@ -3,10 +3,10 @@ using System; using System.Runtime.InteropServices; -using static Microsoft.Net.Http.Server.HttpApi; -using static Microsoft.Net.Http.Server.UnsafeNclNativeMethods.TokenBinding; +using static Microsoft.AspNetCore.Server.HttpSys.HttpApi; +using static Microsoft.AspNetCore.Server.HttpSys.UnsafeNclNativeMethods.TokenBinding; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { /// /// Contains helpers for dealing with TLS token binding. diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/UnsafeNativeMethods.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/NativeInterop/UnsafeNativeMethods.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs index 38dc533..e8a8daa 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/UnsafeNativeMethods.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs @@ -5,7 +5,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static unsafe class UnsafeNclNativeMethods { diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/UrlGroup.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UrlGroup.cs similarity index 90% rename from src/Microsoft.Net.Http.Server/NativeInterop/UrlGroup.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UrlGroup.cs index 5316efd..2e69c0b 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/UrlGroup.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UrlGroup.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class UrlGroup : IDisposable { @@ -24,7 +24,7 @@ internal unsafe UrlGroup(ServerSession serverSession, ILogger logger) if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { - throw new WebListenerException((int)statusCode); + throw new HttpSysException((int)statusCode); } Debug.Assert(urlGroupId != 0, "Invalid id returned by HttpCreateUrlGroup"); @@ -42,7 +42,7 @@ internal void SetProperty(HttpApi.HTTP_SERVER_PROPERTY property, IntPtr info, ui if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { - var exception = new WebListenerException((int)statusCode); + var exception = new HttpSysException((int)statusCode); LogHelper.LogException(_logger, "SetUrlGroupProperty", exception); if (throwOnError) { @@ -62,11 +62,11 @@ internal void RegisterPrefix(string uriPrefix, int contextId) { if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_ALREADY_EXISTS) { - throw new WebListenerException((int)statusCode, string.Format(Resources.Exception_PrefixAlreadyRegistered, uriPrefix)); + throw new HttpSysException((int)statusCode, string.Format(Resources.Exception_PrefixAlreadyRegistered, uriPrefix)); } else { - throw new WebListenerException((int)statusCode); + throw new HttpSysException((int)statusCode); } } } diff --git a/src/Microsoft.Net.Http.Server/Overlapped/DeferredDisposableLifetime.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/DeferredDisposableLifetime.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/Overlapped/DeferredDisposableLifetime.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/DeferredDisposableLifetime.cs diff --git a/src/Microsoft.Net.Http.Server/Overlapped/IDeferredDisposable.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/IDeferredDisposable.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/Overlapped/IDeferredDisposable.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/IDeferredDisposable.cs diff --git a/src/Microsoft.Net.Http.Server/Overlapped/PreAllocatedOverlapped.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/PreAllocatedOverlapped.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/Overlapped/PreAllocatedOverlapped.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/PreAllocatedOverlapped.cs diff --git a/src/Microsoft.Net.Http.Server/Overlapped/ThreadPoolBoundHandle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/ThreadPoolBoundHandle.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/Overlapped/ThreadPoolBoundHandle.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/ThreadPoolBoundHandle.cs diff --git a/src/Microsoft.Net.Http.Server/Overlapped/ThreadPoolBoundHandleOverlapped.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/ThreadPoolBoundHandleOverlapped.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/Overlapped/ThreadPoolBoundHandleOverlapped.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Overlapped/ThreadPoolBoundHandleOverlapped.cs diff --git a/src/Microsoft.AspNetCore.Server.WebListener/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Properties/AssemblyInfo.cs similarity index 56% rename from src/Microsoft.AspNetCore.Server.WebListener/Properties/AssemblyInfo.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/Properties/AssemblyInfo.cs index aff6124..4fc9a75 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/Properties/AssemblyInfo.cs @@ -10,4 +10,4 @@ [assembly: AssemblyCompany("Microsoft Corporation.")] [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft ASP.NET Core")] -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.WebListener.FunctionalTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] \ No newline at end of file +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.HttpSys.FunctionalTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/Properties/Resources.Designer.cs b/src/Microsoft.AspNetCore.Server.HttpSys/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3360ccd --- /dev/null +++ b/src/Microsoft.AspNetCore.Server.HttpSys/Properties/Resources.Designer.cs @@ -0,0 +1,206 @@ +// +namespace Microsoft.AspNetCore.Server.HttpSys +{ + using System.Globalization; + using System.Reflection; + using System.Resources; + + internal static class Resources + { + private static readonly ResourceManager _resourceManager + = new ResourceManager("Microsoft.AspNetCore.Server.HttpSys.Resources", typeof(Resources).GetTypeInfo().Assembly); + + /// + /// The destination array is too small. + /// + internal static string Exception_ArrayTooSmall + { + get { return GetString("Exception_ArrayTooSmall"); } + } + + /// + /// The destination array is too small. + /// + internal static string FormatException_ArrayTooSmall() + { + return GetString("Exception_ArrayTooSmall"); + } + + /// + /// End has already been called. + /// + internal static string Exception_EndCalledMultipleTimes + { + get { return GetString("Exception_EndCalledMultipleTimes"); } + } + + /// + /// End has already been called. + /// + internal static string FormatException_EndCalledMultipleTimes() + { + return GetString("Exception_EndCalledMultipleTimes"); + } + + /// + /// The status code '{0}' is not supported. + /// + internal static string Exception_InvalidStatusCode + { + get { return GetString("Exception_InvalidStatusCode"); } + } + + /// + /// The status code '{0}' is not supported. + /// + internal static string FormatException_InvalidStatusCode(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Exception_InvalidStatusCode"), p0); + } + + /// + /// The stream is not seekable. + /// + internal static string Exception_NoSeek + { + get { return GetString("Exception_NoSeek"); } + } + + /// + /// The stream is not seekable. + /// + internal static string FormatException_NoSeek() + { + return GetString("Exception_NoSeek"); + } + + /// + /// The prefix '{0}' is already registered. + /// + internal static string Exception_PrefixAlreadyRegistered + { + get { return GetString("Exception_PrefixAlreadyRegistered"); } + } + + /// + /// The prefix '{0}' is already registered. + /// + internal static string FormatException_PrefixAlreadyRegistered(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Exception_PrefixAlreadyRegistered"), p0); + } + + /// + /// This stream only supports read operations. + /// + internal static string Exception_ReadOnlyStream + { + get { return GetString("Exception_ReadOnlyStream"); } + } + + /// + /// This stream only supports read operations. + /// + internal static string FormatException_ReadOnlyStream() + { + return GetString("Exception_ReadOnlyStream"); + } + + /// + /// More data written than specified in the Content-Length header. + /// + internal static string Exception_TooMuchWritten + { + get { return GetString("Exception_TooMuchWritten"); } + } + + /// + /// More data written than specified in the Content-Length header. + /// + internal static string FormatException_TooMuchWritten() + { + return GetString("Exception_TooMuchWritten"); + } + + /// + /// Only the http and https schemes are supported. + /// + internal static string Exception_UnsupportedScheme + { + get { return GetString("Exception_UnsupportedScheme"); } + } + + /// + /// Only the http and https schemes are supported. + /// + internal static string FormatException_UnsupportedScheme() + { + return GetString("Exception_UnsupportedScheme"); + } + + /// + /// This stream only supports write operations. + /// + internal static string Exception_WriteOnlyStream + { + get { return GetString("Exception_WriteOnlyStream"); } + } + + /// + /// This stream only supports write operations. + /// + internal static string FormatException_WriteOnlyStream() + { + return GetString("Exception_WriteOnlyStream"); + } + + /// + /// The given IAsyncResult does not match this opperation. + /// + internal static string Exception_WrongIAsyncResult + { + get { return GetString("Exception_WrongIAsyncResult"); } + } + + /// + /// The given IAsyncResult does not match this opperation. + /// + internal static string FormatException_WrongIAsyncResult() + { + return GetString("Exception_WrongIAsyncResult"); + } + + /// + /// An exception occured while running an action registered with {0}. + /// + internal static string Warning_ExceptionInOnResponseCompletedAction + { + get { return GetString("Warning_ExceptionInOnResponseCompletedAction"); } + } + + /// + /// An exception occured while running an action registered with {0}. + /// + internal static string FormatWarning_ExceptionInOnResponseCompletedAction(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Warning_ExceptionInOnResponseCompletedAction"), p0); + } + + private static string GetString(string name, params string[] formatterNames) + { + var value = _resourceManager.GetString(name); + + System.Diagnostics.Debug.Assert(value != null); + + if (formatterNames != null) + { + for (var i = 0; i < formatterNames.Length; i++) + { + value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); + } + } + + return value; + } + } +} diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/BoundaryType.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/BoundaryType.cs similarity index 91% rename from src/Microsoft.Net.Http.Server/RequestProcessing/BoundaryType.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/BoundaryType.cs index 9c7a60e..6e2565b 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/BoundaryType.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/BoundaryType.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal enum BoundaryType { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/ClientCertLoader.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ClientCertLoader.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/RequestProcessing/ClientCertLoader.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ClientCertLoader.cs index f80701a..b453bed 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/ClientCertLoader.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ClientCertLoader.cs @@ -14,7 +14,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // This class is used to load the client certificate on-demand. Because client certs are optional, all // failures are handled internally and reported via ClientCertException or ClientCertError. @@ -187,7 +187,7 @@ internal Task LoadClientCertificateAsync() Complete(0, null); } else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && - WebListener.SkipIOCPCallbackOnSuccess) + HttpSysListener.SkipIOCPCallbackOnSuccess) { IOCompleted(statusCode, bytesReceived); } @@ -197,7 +197,7 @@ internal Task LoadClientCertificateAsync() // Some other bad error, possible(?) return values are: // ERROR_INVALID_HANDLE, ERROR_INSUFFICIENT_BUFFER, ERROR_OPERATION_ABORTED // Also ERROR_BAD_DATA if we got it twice or it reported smaller size buffer required. - Fail(new WebListenerException((int)statusCode)); + Fail(new HttpSysException((int)statusCode)); } } while (retry); @@ -254,7 +254,7 @@ private static unsafe void IOCompleted(ClientCertLoader asyncResult, uint errorC asyncResult._overlapped); if (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING || - (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && !WebListener.SkipIOCPCallbackOnSuccess)) + (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && !HttpSysListener.SkipIOCPCallbackOnSuccess)) { return; } @@ -267,7 +267,7 @@ private static unsafe void IOCompleted(ClientCertLoader asyncResult, uint errorC } else if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { - asyncResult.Fail(new WebListenerException((int)errorCode)); + asyncResult.Fail(new HttpSysException((int)errorCode)); } else { @@ -405,7 +405,7 @@ internal static unsafe ChannelBinding GetChannelBindingFromTls(RequestQueue requ else { // It's up to the consumer to fail if the missing ChannelBinding matters to them. - LogHelper.LogException(logger, "GetChannelBindingFromTls", new WebListenerException((int)statusCode)); + LogHelper.LogException(logger, "GetChannelBindingFromTls", new HttpSysException((int)statusCode)); break; } } diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/HeaderCollection.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderCollection.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/RequestProcessing/HeaderCollection.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderCollection.cs index efac9db..4f6cd22 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/HeaderCollection.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderCollection.cs @@ -6,9 +6,9 @@ using System.Collections.Generic; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { - public class HeaderCollection : IDictionary + internal class HeaderCollection : IDictionary { public HeaderCollection() : this(new Dictionary(4, StringComparer.OrdinalIgnoreCase)) diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/HeaderEncoding.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderEncoding.cs similarity index 96% rename from src/Microsoft.Net.Http.Server/RequestProcessing/HeaderEncoding.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderEncoding.cs index 0fffaf4..9c22ce1 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/HeaderEncoding.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderEncoding.cs @@ -3,7 +3,7 @@ using System.Text; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class HeaderEncoding { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/HeaderParser.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderParser.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/RequestProcessing/HeaderParser.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderParser.cs index ace6b41..8b57bb3 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/HeaderParser.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HeaderParser.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class HeaderParser { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/HttpKnownHeaderNames.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HttpKnownHeaderNames.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/RequestProcessing/HttpKnownHeaderNames.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HttpKnownHeaderNames.cs index cbb15b9..45ed640 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/HttpKnownHeaderNames.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HttpKnownHeaderNames.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class HttpKnownHeaderNames { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/HttpReasonPhrase.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HttpReasonPhrase.cs similarity index 95% rename from src/Microsoft.Net.Http.Server/RequestProcessing/HttpReasonPhrase.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HttpReasonPhrase.cs index f80d12c..e8781b6 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/HttpReasonPhrase.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/HttpReasonPhrase.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class HttpReasonPhrase { @@ -84,11 +84,6 @@ internal static class HttpReasonPhrase } }; - internal static string Get(HttpStatusCode code) - { - return Get((int)code); - } - internal static string Get(int code) { if (code >= 100 && code < 600) diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/NativeRequestContext.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/NativeRequestContext.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/RequestProcessing/NativeRequestContext.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/NativeRequestContext.cs index 90274e0..9a26984 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/NativeRequestContext.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/NativeRequestContext.cs @@ -9,7 +9,7 @@ using System.Security.Principal; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal unsafe class NativeRequestContext : IDisposable { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/OpaqueStream.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/OpaqueStream.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/RequestProcessing/OpaqueStream.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/OpaqueStream.cs index cbcf912..40967ef 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/OpaqueStream.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/OpaqueStream.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // A duplex wrapper around RequestStream and ResponseStream. // TODO: Consider merging RequestStream and ResponseStream instead. diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RawUrlHelper.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RawUrlHelper.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RawUrlHelper.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RawUrlHelper.cs index 13e62eb..7538ba9 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RawUrlHelper.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RawUrlHelper.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class RawUrlHelper { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs index f0a8a26..7741232 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs @@ -10,9 +10,9 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { - public sealed class Request + internal sealed class Request { private NativeRequestContext _nativeRequestContext; @@ -49,7 +49,7 @@ internal Request(RequestContext requestContext, NativeRequestContext nativeReque var cookedUrl = nativeRequestContext.GetCookedUrl(); QueryString = cookedUrl.GetQueryString() ?? string.Empty; - var prefix = requestContext.Server.Settings.UrlPrefixes.GetPrefix((int)nativeRequestContext.UrlContext); + var prefix = requestContext.Server.Options.UrlPrefixes.GetPrefix((int)nativeRequestContext.UrlContext); var rawUrlInBytes = _nativeRequestContext.GetRawUrlInBytes(); var originalPath = RequestUriBuilder.DecodeAndUnescapePath(rawUrlInBytes); diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestContext.cs similarity index 96% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestContext.cs index 7753f79..78f1310 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestContext.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestContext.cs @@ -9,11 +9,12 @@ using System.Security.Claims; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { - public sealed class RequestContext : IDisposable + internal sealed class RequestContext : IDisposable { private static readonly Action AbortDelegate = Abort; @@ -22,7 +23,7 @@ public sealed class RequestContext : IDisposable private CancellationToken? _disconnectToken; private bool _disposed; - internal RequestContext(WebListener server, NativeRequestContext memoryBlob) + internal RequestContext(HttpSysListener server, NativeRequestContext memoryBlob) { // TODO: Verbose log Server = server; @@ -31,7 +32,7 @@ internal RequestContext(WebListener server, NativeRequestContext memoryBlob) Response = new Response(this); } - internal WebListener Server { get; } + internal HttpSysListener Server { get; } internal ILogger Logger => Server.Logger; @@ -99,8 +100,8 @@ public Task UpgradeAsync() } // Set the status code and reason phrase - Response.StatusCode = (int)HttpStatusCode.SwitchingProtocols; - Response.ReasonPhrase = HttpReasonPhrase.Get(HttpStatusCode.SwitchingProtocols); + Response.StatusCode = StatusCodes.Status101SwitchingProtocols; + Response.ReasonPhrase = HttpReasonPhrase.Get(StatusCodes.Status101SwitchingProtocols); Response.SendOpaqueUpgrade(); // TODO: Async Request.SwitchToOpaqueMode(); diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.Generated.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.Generated.cs similarity index 93% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.Generated.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.Generated.cs index 2989607..431f235 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.Generated.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.Generated.cs @@ -1,25 +1,5 @@ -// Copyright (c) Microsoft Open Technologies, Inc. -// All Rights Reserved -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR -// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING -// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF -// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR -// NON-INFRINGEMENT. -// See the Apache 2 License for the specific language governing -// permissions and limitations under the License. - -//----------------------------------------------------------------------- -// -// Copyright (c) Katana Contributors. All rights reserved. -// -//----------------------------------------------------------------------- +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // using System; @@ -31,7 +11,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { [GeneratedCode("TextTemplatingFileGenerator", "")] internal partial class RequestHeaders @@ -82,7 +62,7 @@ internal partial class RequestHeaders private StringValues _Via; private StringValues _Warning; - internal StringValues Accept + internal StringValues Accept { get { @@ -104,7 +84,7 @@ internal StringValues Accept } } - internal StringValues AcceptCharset + internal StringValues AcceptCharset { get { @@ -126,7 +106,7 @@ internal StringValues AcceptCharset } } - internal StringValues AcceptEncoding + internal StringValues AcceptEncoding { get { @@ -148,7 +128,7 @@ internal StringValues AcceptEncoding } } - internal StringValues AcceptLanguage + internal StringValues AcceptLanguage { get { @@ -170,7 +150,7 @@ internal StringValues AcceptLanguage } } - internal StringValues Allow + internal StringValues Allow { get { @@ -192,7 +172,7 @@ internal StringValues Allow } } - internal StringValues Authorization + internal StringValues Authorization { get { @@ -214,7 +194,7 @@ internal StringValues Authorization } } - internal StringValues CacheControl + internal StringValues CacheControl { get { @@ -236,7 +216,7 @@ internal StringValues CacheControl } } - internal StringValues Connection + internal StringValues Connection { get { @@ -258,7 +238,7 @@ internal StringValues Connection } } - internal StringValues ContentEncoding + internal StringValues ContentEncoding { get { @@ -280,7 +260,7 @@ internal StringValues ContentEncoding } } - internal StringValues ContentLanguage + internal StringValues ContentLanguage { get { @@ -302,7 +282,7 @@ internal StringValues ContentLanguage } } - internal StringValues ContentLength + internal StringValues ContentLength { get { @@ -324,7 +304,7 @@ internal StringValues ContentLength } } - internal StringValues ContentLocation + internal StringValues ContentLocation { get { @@ -346,7 +326,7 @@ internal StringValues ContentLocation } } - internal StringValues ContentMd5 + internal StringValues ContentMd5 { get { @@ -368,7 +348,7 @@ internal StringValues ContentMd5 } } - internal StringValues ContentRange + internal StringValues ContentRange { get { @@ -390,7 +370,7 @@ internal StringValues ContentRange } } - internal StringValues ContentType + internal StringValues ContentType { get { @@ -412,7 +392,7 @@ internal StringValues ContentType } } - internal StringValues Cookie + internal StringValues Cookie { get { @@ -434,7 +414,7 @@ internal StringValues Cookie } } - internal StringValues Date + internal StringValues Date { get { @@ -456,7 +436,7 @@ internal StringValues Date } } - internal StringValues Expect + internal StringValues Expect { get { @@ -478,7 +458,7 @@ internal StringValues Expect } } - internal StringValues Expires + internal StringValues Expires { get { @@ -500,7 +480,7 @@ internal StringValues Expires } } - internal StringValues From + internal StringValues From { get { @@ -522,7 +502,7 @@ internal StringValues From } } - internal StringValues Host + internal StringValues Host { get { @@ -544,7 +524,7 @@ internal StringValues Host } } - internal StringValues IfMatch + internal StringValues IfMatch { get { @@ -566,7 +546,7 @@ internal StringValues IfMatch } } - internal StringValues IfModifiedSince + internal StringValues IfModifiedSince { get { @@ -588,7 +568,7 @@ internal StringValues IfModifiedSince } } - internal StringValues IfNoneMatch + internal StringValues IfNoneMatch { get { @@ -610,7 +590,7 @@ internal StringValues IfNoneMatch } } - internal StringValues IfRange + internal StringValues IfRange { get { @@ -632,7 +612,7 @@ internal StringValues IfRange } } - internal StringValues IfUnmodifiedSince + internal StringValues IfUnmodifiedSince { get { @@ -654,7 +634,7 @@ internal StringValues IfUnmodifiedSince } } - internal StringValues KeepAlive + internal StringValues KeepAlive { get { @@ -676,7 +656,7 @@ internal StringValues KeepAlive } } - internal StringValues LastModified + internal StringValues LastModified { get { @@ -698,7 +678,7 @@ internal StringValues LastModified } } - internal StringValues MaxForwards + internal StringValues MaxForwards { get { @@ -720,7 +700,7 @@ internal StringValues MaxForwards } } - internal StringValues Pragma + internal StringValues Pragma { get { @@ -742,7 +722,7 @@ internal StringValues Pragma } } - internal StringValues ProxyAuthorization + internal StringValues ProxyAuthorization { get { @@ -764,7 +744,7 @@ internal StringValues ProxyAuthorization } } - internal StringValues Range + internal StringValues Range { get { @@ -786,7 +766,7 @@ internal StringValues Range } } - internal StringValues Referer + internal StringValues Referer { get { @@ -808,7 +788,7 @@ internal StringValues Referer } } - internal StringValues Te + internal StringValues Te { get { @@ -830,7 +810,7 @@ internal StringValues Te } } - internal StringValues Trailer + internal StringValues Trailer { get { @@ -852,7 +832,7 @@ internal StringValues Trailer } } - internal StringValues TransferEncoding + internal StringValues TransferEncoding { get { @@ -874,7 +854,7 @@ internal StringValues TransferEncoding } } - internal StringValues Translate + internal StringValues Translate { get { @@ -896,7 +876,7 @@ internal StringValues Translate } } - internal StringValues Upgrade + internal StringValues Upgrade { get { @@ -918,7 +898,7 @@ internal StringValues Upgrade } } - internal StringValues UserAgent + internal StringValues UserAgent { get { @@ -940,7 +920,7 @@ internal StringValues UserAgent } } - internal StringValues Via + internal StringValues Via { get { @@ -962,7 +942,7 @@ internal StringValues Via } } - internal StringValues Warning + internal StringValues Warning { get { @@ -1732,7 +1712,7 @@ private bool PropertiesTryRemove(string key) { case 2: if (_Te.Count > 0 - && string.Equals(key, "Te", StringComparison.Ordinal)) + && string.Equals(key, "Te", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x2u) != 0); Te = StringValues.Empty; @@ -1740,8 +1720,8 @@ private bool PropertiesTryRemove(string key) } break; case 3: - if (_Via.Count > 0 - && string.Equals(key, "Via", StringComparison.Ordinal)) + if (_Via.Count > 0 + && string.Equals(key, "Via", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x80u) != 0); Via = StringValues.Empty; @@ -1749,22 +1729,22 @@ private bool PropertiesTryRemove(string key) } break; case 4: - if (_Date.Count > 0 - && string.Equals(key, "Date", StringComparison.Ordinal)) + if (_Date.Count > 0 + && string.Equals(key, "Date", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x10000u) != 0); Date = StringValues.Empty; return wasSet; } if (_From.Count > 0 - && string.Equals(key, "From", StringComparison.Ordinal)) + && string.Equals(key, "From", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x80000u) != 0); From = StringValues.Empty; return wasSet; } if (_Host.Count > 0 - && string.Equals(key, "Host", StringComparison.Ordinal)) + && string.Equals(key, "Host", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x100000u) != 0); Host = StringValues.Empty; @@ -1773,14 +1753,14 @@ private bool PropertiesTryRemove(string key) break; case 5: if (_Allow.Count > 0 - && string.Equals(key, "Allow", StringComparison.Ordinal)) + && string.Equals(key, "Allow", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x10u) != 0); Allow = StringValues.Empty; return wasSet; } if (_Range.Count > 0 - && string.Equals(key, "Range", StringComparison.Ordinal)) + && string.Equals(key, "Range", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x80000000u) != 0); Range = StringValues.Empty; @@ -1789,28 +1769,28 @@ private bool PropertiesTryRemove(string key) break; case 6: if (_Accept.Count > 0 - && string.Equals(key, "Accept", StringComparison.Ordinal)) + && string.Equals(key, "Accept", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x1u) != 0); Accept = StringValues.Empty; return wasSet; } if (_Cookie.Count > 0 - && string.Equals(key, "Cookie", StringComparison.Ordinal)) + && string.Equals(key, "Cookie", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x8000u) != 0); Cookie = StringValues.Empty; return wasSet; } if (_Expect.Count > 0 - && string.Equals(key, "Expect", StringComparison.Ordinal)) + && string.Equals(key, "Expect", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x20000u) != 0); Expect = StringValues.Empty; return wasSet; } if (_Pragma.Count > 0 - && string.Equals(key, "Pragma", StringComparison.Ordinal)) + && string.Equals(key, "Pragma", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x20000000u) != 0); Pragma = StringValues.Empty; @@ -1819,35 +1799,35 @@ private bool PropertiesTryRemove(string key) break; case 7: if (_Expires.Count > 0 - && string.Equals(key, "Expires", StringComparison.Ordinal)) + && string.Equals(key, "Expires", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x40000u) != 0); Expires = StringValues.Empty; return wasSet; } if (_Referer.Count > 0 - && string.Equals(key, "Referer", StringComparison.Ordinal)) + && string.Equals(key, "Referer", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x1u) != 0); Referer = StringValues.Empty; return wasSet; } if (_Trailer.Count > 0 - && string.Equals(key, "Trailer", StringComparison.Ordinal)) + && string.Equals(key, "Trailer", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x4u) != 0); Trailer = StringValues.Empty; return wasSet; } if (_Upgrade.Count > 0 - && string.Equals(key, "Upgrade", StringComparison.Ordinal)) + && string.Equals(key, "Upgrade", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x20u) != 0); Upgrade = StringValues.Empty; return wasSet; } if (_Warning.Count > 0 - && string.Equals(key, "Warning", StringComparison.Ordinal)) + && string.Equals(key, "Warning", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x100u) != 0); Warning = StringValues.Empty; @@ -1856,14 +1836,14 @@ private bool PropertiesTryRemove(string key) break; case 8: if (_IfMatch.Count > 0 - && string.Equals(key, "If-Match", StringComparison.Ordinal)) + && string.Equals(key, "If-Match", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x200000u) != 0); IfMatch = StringValues.Empty; return wasSet; } if (_IfRange.Count > 0 - && string.Equals(key, "If-Range", StringComparison.Ordinal)) + && string.Equals(key, "If-Range", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x1000000u) != 0); IfRange = StringValues.Empty; @@ -1872,7 +1852,7 @@ private bool PropertiesTryRemove(string key) break; case 9: if (_Translate.Count > 0 - && string.Equals(key, "Translate", StringComparison.Ordinal)) + && string.Equals(key, "Translate", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x10u) != 0); Translate = StringValues.Empty; @@ -1881,21 +1861,21 @@ private bool PropertiesTryRemove(string key) break; case 10: if (_Connection.Count > 0 - && string.Equals(key, "Connection", StringComparison.Ordinal)) + && string.Equals(key, "Connection", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x80u) != 0); Connection = StringValues.Empty; return wasSet; } if (_KeepAlive.Count > 0 - && string.Equals(key, "Keep-Alive", StringComparison.Ordinal)) + && string.Equals(key, "Keep-Alive", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x4000000u) != 0); KeepAlive = StringValues.Empty; return wasSet; } if (_UserAgent.Count > 0 - && string.Equals(key, "User-Agent", StringComparison.Ordinal)) + && string.Equals(key, "User-Agent", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x40u) != 0); UserAgent = StringValues.Empty; @@ -1904,7 +1884,7 @@ private bool PropertiesTryRemove(string key) break; case 11: if (_ContentMd5.Count > 0 - && string.Equals(key, "Content-Md5", StringComparison.Ordinal)) + && string.Equals(key, "Content-Md5", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x1000u) != 0); ContentMd5 = StringValues.Empty; @@ -1913,14 +1893,14 @@ private bool PropertiesTryRemove(string key) break; case 12: if (_ContentType.Count > 0 - && string.Equals(key, "Content-Type", StringComparison.Ordinal)) + && string.Equals(key, "Content-Type", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x4000u) != 0); ContentType = StringValues.Empty; return wasSet; } if (_MaxForwards.Count > 0 - && string.Equals(key, "Max-Forwards", StringComparison.Ordinal)) + && string.Equals(key, "Max-Forwards", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x10000000u) != 0); MaxForwards = StringValues.Empty; @@ -1929,35 +1909,35 @@ private bool PropertiesTryRemove(string key) break; case 13: if (_Authorization.Count > 0 - && string.Equals(key, "Authorization", StringComparison.Ordinal)) + && string.Equals(key, "Authorization", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x20u) != 0); Authorization = StringValues.Empty; return wasSet; } if (_CacheControl.Count > 0 - && string.Equals(key, "Cache-Control", StringComparison.Ordinal)) + && string.Equals(key, "Cache-Control", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x40u) != 0); CacheControl = StringValues.Empty; return wasSet; } if (_ContentRange.Count > 0 - && string.Equals(key, "Content-Range", StringComparison.Ordinal)) + && string.Equals(key, "Content-Range", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x2000u) != 0); ContentRange = StringValues.Empty; return wasSet; } if (_IfNoneMatch.Count > 0 - && string.Equals(key, "If-None-Match", StringComparison.Ordinal)) + && string.Equals(key, "If-None-Match", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x800000u) != 0); IfNoneMatch = StringValues.Empty; return wasSet; } if (_LastModified.Count > 0 - && string.Equals(key, "Last-Modified", StringComparison.Ordinal)) + && string.Equals(key, "Last-Modified", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x8000000u) != 0); LastModified = StringValues.Empty; @@ -1966,14 +1946,14 @@ private bool PropertiesTryRemove(string key) break; case 14: if (_AcceptCharset.Count > 0 - && string.Equals(key, "Accept-Charset", StringComparison.Ordinal)) + && string.Equals(key, "Accept-Charset", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x2u) != 0); AcceptCharset = StringValues.Empty; return wasSet; } if (_ContentLength.Count > 0 - && string.Equals(key, "Content-Length", StringComparison.Ordinal)) + && string.Equals(key, "Content-Length", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x400u) != 0); ContentLength = StringValues.Empty; @@ -1982,14 +1962,14 @@ private bool PropertiesTryRemove(string key) break; case 15: if (_AcceptEncoding.Count > 0 - && string.Equals(key, "Accept-Encoding", StringComparison.Ordinal)) + && string.Equals(key, "Accept-Encoding", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x4u) != 0); AcceptEncoding = StringValues.Empty; return wasSet; } if (_AcceptLanguage.Count > 0 - && string.Equals(key, "Accept-Language", StringComparison.Ordinal)) + && string.Equals(key, "Accept-Language", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x8u) != 0); AcceptLanguage = StringValues.Empty; @@ -1998,21 +1978,21 @@ private bool PropertiesTryRemove(string key) break; case 16: if (_ContentEncoding.Count > 0 - && string.Equals(key, "Content-Encoding", StringComparison.Ordinal)) + && string.Equals(key, "Content-Encoding", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x100u) != 0); ContentEncoding = StringValues.Empty; return wasSet; } if (_ContentLanguage.Count > 0 - && string.Equals(key, "Content-Language", StringComparison.Ordinal)) + && string.Equals(key, "Content-Language", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x200u) != 0); ContentLanguage = StringValues.Empty; return wasSet; } if (_ContentLocation.Count > 0 - && string.Equals(key, "Content-Location", StringComparison.Ordinal)) + && string.Equals(key, "Content-Location", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x800u) != 0); ContentLocation = StringValues.Empty; @@ -2021,14 +2001,14 @@ private bool PropertiesTryRemove(string key) break; case 17: if (_IfModifiedSince.Count > 0 - && string.Equals(key, "If-Modified-Since", StringComparison.Ordinal)) + && string.Equals(key, "If-Modified-Since", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x400000u) != 0); IfModifiedSince = StringValues.Empty; return wasSet; } if (_TransferEncoding.Count > 0 - && string.Equals(key, "Transfer-Encoding", StringComparison.Ordinal)) + && string.Equals(key, "Transfer-Encoding", StringComparison.Ordinal)) { bool wasSet = ((_flag1 & 0x8u) != 0); TransferEncoding = StringValues.Empty; @@ -2037,14 +2017,14 @@ private bool PropertiesTryRemove(string key) break; case 19: if (_IfUnmodifiedSince.Count > 0 - && string.Equals(key, "If-Unmodified-Since", StringComparison.Ordinal)) + && string.Equals(key, "If-Unmodified-Since", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x2000000u) != 0); IfUnmodifiedSince = StringValues.Empty; return wasSet; } if (_ProxyAuthorization.Count > 0 - && string.Equals(key, "Proxy-Authorization", StringComparison.Ordinal)) + && string.Equals(key, "Proxy-Authorization", StringComparison.Ordinal)) { bool wasSet = ((_flag0 & 0x40000000u) != 0); ProxyAuthorization = StringValues.Empty; diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.Generated.tt b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.Generated.tt similarity index 95% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.Generated.tt rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.Generated.tt index e898258..1b4b3a1 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.Generated.tt +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.Generated.tt @@ -54,11 +54,8 @@ Func IsRead = Index => "((_flag" + (Index / 32) + " & 0x" + (1<<(Ind Func MarkRead = Index => "_flag" + (Index / 32) + " |= 0x" + (1<<(Index % 32)).ToString("x") + "u"; Func Clear = Index => "_flag" + (Index / 32) + " &= ~0x" + (1<<(Index % 32)).ToString("x") + "u"; #> -//----------------------------------------------------------------------- -// -// Copyright (c) Katana Contributors. All rights reserved. -// -//----------------------------------------------------------------------- +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // using System; @@ -70,7 +67,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { [GeneratedCode("TextTemplatingFileGenerator", "")] internal partial class RequestHeaders @@ -141,7 +138,7 @@ namespace Microsoft.Net.Http.Server break; <# } #> } - value = null; + value = StringValues.Empty; return false; } @@ -173,10 +170,10 @@ namespace Microsoft.Net.Http.Server case <#=length.Key#>: <# foreach(var prop in length) { #> if (_<#=prop.Name#>.Count > 0 - && string.Equals(key, "<#=prop.Key#>", StringComparison.Ordinal)) + && string.Equals(key, "<#=prop.Key#>", StringComparison.Ordinal)) { bool wasSet = <#=IsRead(prop.Index)#>; - <#=prop.Name#> = null; + <#=prop.Name#> = StringValues.Empty; return wasSet; } <# } #> diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.cs index ece5ef4..3d6f701 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestHeaders.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestHeaders.cs @@ -8,7 +8,7 @@ using System.Threading; using Microsoft.Extensions.Primitives; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal partial class RequestHeaders : IDictionary { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs index 4f3ab87..94e7fa7 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStream.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal class RequestStream : Stream { @@ -170,7 +170,7 @@ public override unsafe int Read([In, Out] byte[] buffer, int offset, int size) } if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF) { - Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode)); + Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); LogHelper.LogException(Logger, "Read", exception); Abort(); throw exception; @@ -265,14 +265,14 @@ public override unsafe IAsyncResult BeginRead(byte[] buffer, int offset, int siz } else { - Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode)); + Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); LogHelper.LogException(Logger, "BeginRead", exception); Abort(); throw exception; } } else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && - WebListener.SkipIOCPCallbackOnSuccess) + HttpSysListener.SkipIOCPCallbackOnSuccess) { // IO operation completed synchronously - callback won't be called to signal completion. asyncResult.IOCompleted(statusCode, bytesReturned); @@ -391,14 +391,14 @@ public override unsafe Task ReadAsync(byte[] buffer, int offset, int size, } else { - Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode)); + Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); LogHelper.LogException(Logger, "ReadAsync", exception); Abort(); throw exception; } } else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && - WebListener.SkipIOCPCallbackOnSuccess) + HttpSysListener.SkipIOCPCallbackOnSuccess) { // IO operation completed synchronously - callback won't be called to signal completion. asyncResult.Dispose(); diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStreamAsyncResult.cs similarity index 98% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStreamAsyncResult.cs index c04376d..99f04d3 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestStreamAsyncResult.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStreamAsyncResult.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal unsafe class RequestStreamAsyncResult : IAsyncResult, IDisposable { @@ -90,7 +90,7 @@ private static void IOCompleted(RequestStreamAsyncResult asyncResult, uint error { if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF) { - asyncResult.Fail(new IOException(string.Empty, new WebListenerException((int)errorCode))); + asyncResult.Fail(new IOException(string.Empty, new HttpSysException((int)errorCode))); } else { diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestUriBuilder.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestUriBuilder.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/RequestProcessing/RequestUriBuilder.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestUriBuilder.cs index 5129e4e..8139700 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/RequestUriBuilder.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestUriBuilder.cs @@ -4,7 +4,7 @@ using System; using System.Text; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { // We don't use the cooked URL because http.sys unescapes all percent-encoded values. However, // we also can't just use the raw Uri, since http.sys supports not only UTF-8, but also ANSI/DBCS and diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs index 7185d03..9936d81 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs @@ -9,16 +9,17 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; -using static Microsoft.Net.Http.Server.UnsafeNclNativeMethods; +using static Microsoft.AspNetCore.Server.HttpSys.UnsafeNclNativeMethods; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { - public sealed class Response + internal sealed class Response { private ResponseState _responseState; private string _reasonPhrase; - private ResponseStream _nativeStream; + private ResponseBody _nativeStream; private AuthenticationSchemes _authChallenges; private TimeSpan? _cacheTtl; private long _expectedBodyLength; @@ -37,14 +38,14 @@ internal Response(RequestContext requestContext) Headers.Clear(); _reasonPhrase = null; _boundaryType = BoundaryType.None; - _nativeResponse.Response_V1.StatusCode = (ushort)HttpStatusCode.OK; + _nativeResponse.Response_V1.StatusCode = (ushort)StatusCodes.Status200OK; _nativeResponse.Response_V1.Version.MajorVersion = 1; _nativeResponse.Response_V1.Version.MinorVersion = 1; _responseState = ResponseState.Created; _expectedBodyLength = 0; _nativeStream = null; _cacheTtl = null; - _authChallenges = RequestContext.Server.Settings.Authentication.Schemes; + _authChallenges = RequestContext.Server.Options.Authentication.Schemes; } private enum ResponseState @@ -274,7 +275,7 @@ private void EnsureResponseStream() { if (_nativeStream == null) { - _nativeStream = new ResponseStream(RequestContext); + _nativeStream = new ResponseBody(RequestContext); } } @@ -374,7 +375,7 @@ internal unsafe uint SendHeaders(HttpApi.HTTP_DATA_CHUNK[] dataChunks, if (asyncResult != null && statusCode == ErrorCodes.ERROR_SUCCESS && - WebListener.SkipIOCPCallbackOnSuccess) + HttpSysListener.SkipIOCPCallbackOnSuccess) { asyncResult.BytesSent = bytesSent; // The caller will invoke IOCompleted @@ -391,10 +392,9 @@ internal unsafe uint SendHeaders(HttpApi.HTTP_DATA_CHUNK[] dataChunks, internal HttpApi.HTTP_FLAGS ComputeHeaders(long writeCount, bool endOfRequest = false) { - // 401 - if (StatusCode == (ushort)HttpStatusCode.Unauthorized) + if (StatusCode == (ushort)StatusCodes.Status401Unauthorized) { - RequestContext.Server.Settings.Authentication.SetAuthenticationChallenge(RequestContext); + RequestContext.Server.Options.Authentication.SetAuthenticationChallenge(RequestContext); } var flags = HttpApi.HTTP_FLAGS.NONE; @@ -662,7 +662,7 @@ internal void SendOpaqueUpgrade() if (errorCode != ErrorCodes.ERROR_SUCCESS) { - throw new WebListenerException((int)errorCode); + throw new HttpSysException((int)errorCode); } } diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs index 7a3625e..56a104a 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStream.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs @@ -10,11 +10,11 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using static Microsoft.Net.Http.Server.UnsafeNclNativeMethods; +using static Microsoft.AspNetCore.Server.HttpSys.UnsafeNclNativeMethods; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { - internal class ResponseStream : Stream + internal class ResponseBody : Stream { private RequestContext _requestContext; private long _leftToWrite = long.MinValue; @@ -24,7 +24,7 @@ internal class ResponseStream : Stream // The last write needs special handling to cancel. private ResponseStreamAsyncResult _lastWrite; - internal ResponseStream(RequestContext requestContext) + internal ResponseBody(RequestContext requestContext) { _requestContext = requestContext; } @@ -40,7 +40,7 @@ internal RequestContext RequestContext private ILogger Logger => RequestContext.Server.Logger; - internal bool ThrowWriteExceptions => RequestContext.Server.Settings.ThrowWriteExceptions; + internal bool ThrowWriteExceptions => RequestContext.Server.Options.ThrowWriteExceptions; internal bool IsDisposed => _disposed; @@ -163,7 +163,7 @@ public override void Flush() { if (ThrowWriteExceptions) { - var exception = new IOException(string.Empty, new WebListenerException((int)statusCode)); + var exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); LogHelper.LogException(Logger, "Flush", exception); Abort(); throw exception; @@ -329,7 +329,7 @@ private unsafe Task FlushInternalAsync(ArraySegment data, CancellationToke else if (ThrowWriteExceptions) { asyncResult.Dispose(); - Exception exception = new IOException(string.Empty, new WebListenerException((int)statusCode)); + Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); LogHelper.LogException(Logger, "FlushAsync", exception); Abort(); throw exception; @@ -342,7 +342,7 @@ private unsafe Task FlushInternalAsync(ArraySegment data, CancellationToke } } - if (statusCode == ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess) + if (statusCode == ErrorCodes.ERROR_SUCCESS && HttpSysListener.SkipIOCPCallbackOnSuccess) { // IO operation completed synchronously - callback won't be called to signal completion. asyncResult.IOCompleted(statusCode, bytesSent); @@ -624,7 +624,7 @@ internal unsafe Task SendFileAsyncCore(string fileName, long offset, long? count else if (ThrowWriteExceptions) { asyncResult.Dispose(); - var exception = new IOException(string.Empty, new WebListenerException((int)statusCode)); + var exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); LogHelper.LogException(Logger, "SendFileAsync", exception); Abort(); throw exception; @@ -637,7 +637,7 @@ internal unsafe Task SendFileAsyncCore(string fileName, long offset, long? count } } - if (statusCode == ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess) + if (statusCode == ErrorCodes.ERROR_SUCCESS && HttpSysListener.SkipIOCPCallbackOnSuccess) { // IO operation completed synchronously - callback won't be called to signal completion. asyncResult.IOCompleted(statusCode, bytesSent); diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseStreamAsyncResult.cs similarity index 95% rename from src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseStreamAsyncResult.cs index e710e05..28a890e 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/ResponseStreamAsyncResult.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseStreamAsyncResult.cs @@ -7,9 +7,9 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using static Microsoft.Net.Http.Server.UnsafeNclNativeMethods; +using static Microsoft.AspNetCore.Server.HttpSys.UnsafeNclNativeMethods; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal unsafe class ResponseStreamAsyncResult : IAsyncResult, IDisposable { @@ -18,13 +18,13 @@ internal unsafe class ResponseStreamAsyncResult : IAsyncResult, IDisposable private SafeNativeOverlapped _overlapped; private HttpApi.HTTP_DATA_CHUNK[] _dataChunks; private FileStream _fileStream; - private ResponseStream _responseStream; + private ResponseBody _responseStream; private TaskCompletionSource _tcs; private uint _bytesSent; private CancellationToken _cancellationToken; private CancellationTokenRegistration _cancellationRegistration; - internal ResponseStreamAsyncResult(ResponseStream responseStream, CancellationToken cancellationToken) + internal ResponseStreamAsyncResult(ResponseBody responseStream, CancellationToken cancellationToken) { _responseStream = responseStream; _tcs = new TaskCompletionSource(); @@ -38,7 +38,7 @@ internal ResponseStreamAsyncResult(ResponseStream responseStream, CancellationTo _cancellationRegistration = cancellationRegistration; } - internal ResponseStreamAsyncResult(ResponseStream responseStream, ArraySegment data, bool chunked, + internal ResponseStreamAsyncResult(ResponseBody responseStream, ArraySegment data, bool chunked, CancellationToken cancellationToken) : this(responseStream, cancellationToken) { @@ -94,7 +94,7 @@ internal ResponseStreamAsyncResult(ResponseStream responseStream, ArraySegment /// A collection or URL prefixes diff --git a/src/Microsoft.Net.Http.Server/ValidationHelper.cs b/src/Microsoft.AspNetCore.Server.HttpSys/ValidationHelper.cs similarity index 97% rename from src/Microsoft.Net.Http.Server/ValidationHelper.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/ValidationHelper.cs index 0174663..7d4c10d 100644 --- a/src/Microsoft.Net.Http.Server/ValidationHelper.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/ValidationHelper.cs @@ -4,7 +4,7 @@ using System; using System.Globalization; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class ValidationHelper { diff --git a/src/Microsoft.AspNetCore.Server.WebListener/WebHostBuilderWebListenerExtensions.cs b/src/Microsoft.AspNetCore.Server.HttpSys/WebHostBuilderWebListenerExtensions.cs similarity index 60% rename from src/Microsoft.AspNetCore.Server.WebListener/WebHostBuilderWebListenerExtensions.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/WebHostBuilderWebListenerExtensions.cs index 62f1a8d..ff0d4b5 100644 --- a/src/Microsoft.AspNetCore.Server.WebListener/WebHostBuilderWebListenerExtensions.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/WebHostBuilderWebListenerExtensions.cs @@ -3,17 +3,15 @@ using System; using Microsoft.AspNetCore.Hosting.Server; -using Microsoft.AspNetCore.Server.WebListener; -using Microsoft.AspNetCore.Server.WebListener.Internal; +using Microsoft.AspNetCore.Server.HttpSys; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Hosting { - public static class WebHostBuilderWebListenerExtensions + public static class WebHostBuilderHttpSysExtensions { /// - /// Specify WebListener as the server to be used by the web host. + /// Specify HttpSys as the server to be used by the web host. /// /// /// The Microsoft.AspNetCore.Hosting.IWebHostBuilder to configure. @@ -21,29 +19,28 @@ public static class WebHostBuilderWebListenerExtensions /// /// The Microsoft.AspNetCore.Hosting.IWebHostBuilder. /// - public static IWebHostBuilder UseWebListener(this IWebHostBuilder hostBuilder) + public static IWebHostBuilder UseHttpSys(this IWebHostBuilder hostBuilder) { return hostBuilder.ConfigureServices(services => { - services.AddTransient, WebListenerOptionsSetup>(); services.AddSingleton(); }); } /// - /// Specify WebListener as the server to be used by the web host. + /// Specify HttpSys as the server to be used by the web host. /// /// /// The Microsoft.AspNetCore.Hosting.IWebHostBuilder to configure. /// /// - /// A callback to configure WebListener options. + /// A callback to configure HttpSys options. /// /// /// The Microsoft.AspNetCore.Hosting.IWebHostBuilder. /// - public static IWebHostBuilder UseWebListener(this IWebHostBuilder hostBuilder, Action options) + public static IWebHostBuilder UseHttpSys(this IWebHostBuilder hostBuilder, Action options) { - return hostBuilder.UseWebListener().ConfigureServices(services => + return hostBuilder.UseHttpSys().ConfigureServices(services => { services.Configure(options); }); diff --git a/src/Microsoft.Net.Http.Server/WebSocketHelpers.cs b/src/Microsoft.AspNetCore.Server.HttpSys/WebSocketHelpers.cs similarity index 99% rename from src/Microsoft.Net.Http.Server/WebSocketHelpers.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/WebSocketHelpers.cs index 4338d88..48189ed 100644 --- a/src/Microsoft.Net.Http.Server/WebSocketHelpers.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/WebSocketHelpers.cs @@ -11,7 +11,7 @@ using System.Text; using System.Threading; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class WebSocketHelpers { diff --git a/src/Microsoft.Net.Http.Server/fx/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.AspNetCore.Server.HttpSys/fx/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs diff --git a/src/Microsoft.Net.Http.Server/fx/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.AspNetCore.Server.HttpSys/fx/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs diff --git a/src/Microsoft.Net.Http.Server/fx/System/Net/WebSockets/CompatHelpers.cs b/src/Microsoft.AspNetCore.Server.HttpSys/fx/System/Net/WebSockets/CompatHelpers.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/System/Net/WebSockets/CompatHelpers.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/System/Net/WebSockets/CompatHelpers.cs diff --git a/src/Microsoft.Net.Http.Server/fx/System/Net/WebSockets/README.md b/src/Microsoft.AspNetCore.Server.HttpSys/fx/System/Net/WebSockets/README.md similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/System/Net/WebSockets/README.md rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/System/Net/WebSockets/README.md diff --git a/src/Microsoft.Net.Http.Server/fx/System/Net/WebSockets/SR.cs b/src/Microsoft.AspNetCore.Server.HttpSys/fx/System/Net/WebSockets/SR.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/System/Net/WebSockets/SR.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/System/Net/WebSockets/SR.cs diff --git a/src/Microsoft.Net.Http.Server/fx/src/Common/src/System/Net/WebSockets/WebSocketValidate.cs b/src/Microsoft.AspNetCore.Server.HttpSys/fx/src/Common/src/System/Net/WebSockets/WebSocketValidate.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/src/Common/src/System/Net/WebSockets/WebSocketValidate.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/src/Common/src/System/Net/WebSockets/WebSocketValidate.cs diff --git a/src/Microsoft.Net.Http.Server/fx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ManagedWebSocket.cs b/src/Microsoft.AspNetCore.Server.HttpSys/fx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ManagedWebSocket.cs similarity index 100% rename from src/Microsoft.Net.Http.Server/fx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ManagedWebSocket.cs rename to src/Microsoft.AspNetCore.Server.HttpSys/fx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ManagedWebSocket.cs diff --git a/src/Microsoft.Net.Http.Server/project.json b/src/Microsoft.AspNetCore.Server.HttpSys/project.json similarity index 68% rename from src/Microsoft.Net.Http.Server/project.json rename to src/Microsoft.AspNetCore.Server.HttpSys/project.json index 29f16b7..e5fc45a 100644 --- a/src/Microsoft.Net.Http.Server/project.json +++ b/src/Microsoft.AspNetCore.Server.HttpSys/project.json @@ -1,15 +1,20 @@ { "version": "1.2.0-*", - "description": ".NET HTTP server that uses the Windows HTTP Server API.", + "description": "ASP.NET Core HTTP server that uses the Windows HTTP Server API.", "packOptions": { "tags": [ - "netcore", - "weblistener" + "aspnetcore", + "weblistener", + "httpsys" ] }, "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "1.2.0-*", - "Microsoft.Extensions.Primitives": "1.2.0-*", + "Microsoft.AspNetCore.Hosting": "1.2.0-*", + "Microsoft.Extensions.TaskCache.Sources": { + "version": "1.2.0-*", + "type": "build" + }, + "Microsoft.Net.Http.Headers": "1.2.0-*", "NETStandard.Library": "1.6.2-*" }, "buildOptions": { @@ -22,13 +27,7 @@ "xmlDoc": true }, "frameworks": { - "net451": { - "frameworkAssemblies": { - "System.Runtime": { - "type": "build" - } - } - }, + "net451": {}, "netstandard1.3": { "dependencies": { "Microsoft.Extensions.RuntimeEnvironment.Sources": { diff --git a/src/Microsoft.AspNetCore.Server.WebListener/Helpers.cs b/src/Microsoft.AspNetCore.Server.WebListener/Helpers.cs deleted file mode 100644 index fd8008c..0000000 --- a/src/Microsoft.AspNetCore.Server.WebListener/Helpers.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Microsoft.AspNetCore.Server.WebListener -{ - internal static class Helpers - { - internal static ConfiguredTaskAwaitable SupressContext(this Task task) - { - return task.ConfigureAwait(continueOnCapturedContext: false); - } - - internal static ConfiguredTaskAwaitable SupressContext(this Task task) - { - return task.ConfigureAwait(continueOnCapturedContext: false); - } - } -} diff --git a/src/Microsoft.AspNetCore.Server.WebListener/Internal/WebListenerOptionsSetup.cs b/src/Microsoft.AspNetCore.Server.WebListener/Internal/WebListenerOptionsSetup.cs deleted file mode 100644 index b1664c9..0000000 --- a/src/Microsoft.AspNetCore.Server.WebListener/Internal/WebListenerOptionsSetup.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; - -namespace Microsoft.AspNetCore.Server.WebListener.Internal -{ - public class WebListenerOptionsSetup : IConfigureOptions - { - private ILoggerFactory _loggerFactory; - - public WebListenerOptionsSetup(ILoggerFactory loggerFactory) - { - _loggerFactory = loggerFactory; - } - - public void Configure(WebListenerOptions options) - { - options.ListenerSettings.Logger = _loggerFactory.CreateLogger(); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Server.WebListener/WebListenerOptions.cs b/src/Microsoft.AspNetCore.Server.WebListener/WebListenerOptions.cs deleted file mode 100644 index ec3b14f..0000000 --- a/src/Microsoft.AspNetCore.Server.WebListener/WebListenerOptions.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Net.Http.Server; - -namespace Microsoft.AspNetCore.Server.WebListener -{ - public class WebListenerOptions - { - internal static readonly int DefaultMaxAccepts = 5 * Environment.ProcessorCount; - - /// - /// Settings for the underlying WebListener instance. - /// - public WebListenerSettings ListenerSettings { get; } = new WebListenerSettings(); - - /// - /// The maximum number of concurrent calls to WebListener.AcceptAsync(). - /// - public int MaxAccepts { get; set; } = DefaultMaxAccepts; - - /// - /// Attempts kernel mode caching for responses with eligible headers. The response may not include - /// Set-Cookie, Vary, or Pragma headers. It must include a Cache-Control header with Public and - /// either a Shared-Max-Age or Max-Age value, or an Expires header. - /// - public bool EnableResponseCaching { get; set; } = true; - } -} diff --git a/src/Microsoft.AspNetCore.Server.WebListener/project.json b/src/Microsoft.AspNetCore.Server.WebListener/project.json deleted file mode 100644 index fbf6de3..0000000 --- a/src/Microsoft.AspNetCore.Server.WebListener/project.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "1.2.0-*", - "description": "ASP.NET Core HTTP server for Windows.", - "packOptions": { - "tags": [ - "aspnetcore", - "weblistener" - ] - }, - "dependencies": { - "Microsoft.AspNetCore.Hosting": "1.2.0-*", - "Microsoft.Extensions.TaskCache.Sources": { - "version": "1.2.0-*", - "type": "build" - }, - "Microsoft.Net.Http.Headers": "1.2.0-*", - "Microsoft.Net.Http.Server": { - "target": "project" - }, - "NETStandard.Library": "1.6.2-*" - }, - "buildOptions": { - "allowUnsafe": true, - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk", - "nowarn": [ - "CS1591" - ], - "xmlDoc": true - }, - "frameworks": { - "net451": {}, - "netstandard1.3": { - "dependencies": { - "System.Security.Claims": "4.4.0-*" - } - } - } -} \ No newline at end of file diff --git a/src/Microsoft.Net.Http.Server/CustomDictionary.xml b/src/Microsoft.Net.Http.Server/CustomDictionary.xml deleted file mode 100644 index 78a7614..0000000 --- a/src/Microsoft.Net.Http.Server/CustomDictionary.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Owin - - - - - diff --git a/src/Microsoft.Net.Http.Server/LogHelper.cs b/src/Microsoft.Net.Http.Server/LogHelper.cs deleted file mode 100644 index bb8ce05..0000000 --- a/src/Microsoft.Net.Http.Server/LogHelper.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using Microsoft.Extensions.Logging; - -namespace Microsoft.Net.Http.Server -{ - internal static class LogHelper - { - internal static void LogInfo(ILogger logger, string data) - { - if (logger == null) - { - Debug.WriteLine(data); - } - else - { - logger.LogInformation(data); - } - } - - internal static void LogDebug(ILogger logger, string location, string data) - { - if (logger == null) - { - Debug.WriteLine(data); - } - else - { - logger.LogDebug(location + "; " + data); - } - } - - internal static void LogDebug(ILogger logger, string location, Exception exception) - { - if (logger == null) - { - Debug.WriteLine(exception); - } - else - { - logger.LogDebug(0, exception, location); - } - } - - internal static void LogException(ILogger logger, string location, Exception exception) - { - if (logger == null) - { - Debug.WriteLine(exception); - } - else - { - logger.LogError(0, exception, location); - } - } - - internal static void LogError(ILogger logger, string location, string message) - { - if (logger == null) - { - Debug.WriteLine(message); - } - else - { - logger.LogError(location + "; " + message); - } - } - } -} diff --git a/src/Microsoft.Net.Http.Server/Microsoft.Net.Http.Server.xproj b/src/Microsoft.Net.Http.Server/Microsoft.Net.Http.Server.xproj deleted file mode 100644 index 57bd4ca..0000000 --- a/src/Microsoft.Net.Http.Server/Microsoft.Net.Http.Server.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 3f5212aa-e287-49dd-8cec-44bf0a2ac9a1 - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/Microsoft.Net.Http.Server/Properties/AssemblyInfo.cs b/src/Microsoft.Net.Http.Server/Properties/AssemblyInfo.cs deleted file mode 100644 index 78c1309..0000000 --- a/src/Microsoft.Net.Http.Server/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; -using System.Resources; - -[assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] -[assembly: AssemblyCompany("Microsoft Corporation.")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyProduct("Microsoft ASP.NET Core")] \ No newline at end of file diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/HttpStatusCode.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/HttpStatusCode.cs deleted file mode 100644 index ae545ee..0000000 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/HttpStatusCode.cs +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.Net.Http.Server -{ - // Redirect Status code numbers that need to be defined. - - /// - /// Contains the values of status - /// codes defined for the HTTP protocol. - /// - // UEUE : Any int can be cast to a HttpStatusCode to allow checking for non http1.1 codes. - internal enum HttpStatusCode - { - // Informational 1xx - - /// - /// [To be supplied.] - /// - Continue = 100, - - /// - /// [To be supplied.] - /// - SwitchingProtocols = 101, - - // Successful 2xx - - /// - /// [To be supplied.] - /// - OK = 200, - - /// - /// [To be supplied.] - /// - Created = 201, - - /// - /// [To be supplied.] - /// - Accepted = 202, - - /// - /// [To be supplied.] - /// - NonAuthoritativeInformation = 203, - - /// - /// [To be supplied.] - /// - NoContent = 204, - - /// - /// [To be supplied.] - /// - ResetContent = 205, - - /// - /// [To be supplied.] - /// - PartialContent = 206, - - // Redirection 3xx - - /// - /// [To be supplied.] - /// - MultipleChoices = 300, - - /// - /// [To be supplied.] - /// - Ambiguous = 300, - - /// - /// [To be supplied.] - /// - MovedPermanently = 301, - - /// - /// [To be supplied.] - /// - Moved = 301, - - /// - /// [To be supplied.] - /// - Found = 302, - - /// - /// [To be supplied.] - /// - Redirect = 302, - - /// - /// [To be supplied.] - /// - SeeOther = 303, - - /// - /// [To be supplied.] - /// - RedirectMethod = 303, - - /// - /// [To be supplied.] - /// - NotModified = 304, - - /// - /// [To be supplied.] - /// - UseProxy = 305, - - /// - /// [To be supplied.] - /// - Unused = 306, - - /// - /// [To be supplied.] - /// - TemporaryRedirect = 307, - - /// - /// [To be supplied.] - /// - RedirectKeepVerb = 307, - - // Client Error 4xx - - /// - /// [To be supplied.] - /// - BadRequest = 400, - - /// - /// [To be supplied.] - /// - Unauthorized = 401, - - /// - /// [To be supplied.] - /// - PaymentRequired = 402, - - /// - /// [To be supplied.] - /// - Forbidden = 403, - - /// - /// [To be supplied.] - /// - NotFound = 404, - - /// - /// [To be supplied.] - /// - MethodNotAllowed = 405, - - /// - /// [To be supplied.] - /// - NotAcceptable = 406, - - /// - /// [To be supplied.] - /// - ProxyAuthenticationRequired = 407, - - /// - /// [To be supplied.] - /// - RequestTimeout = 408, - - /// - /// [To be supplied.] - /// - Conflict = 409, - - /// - /// [To be supplied.] - /// - Gone = 410, - - /// - /// [To be supplied.] - /// - LengthRequired = 411, - - /// - /// [To be supplied.] - /// - PreconditionFailed = 412, - - /// - /// [To be supplied.] - /// - RequestEntityTooLarge = 413, - - /// - /// [To be supplied.] - /// - RequestUriTooLong = 414, - - /// - /// [To be supplied.] - /// - UnsupportedMediaType = 415, - - /// - /// [To be supplied.] - /// - RequestedRangeNotSatisfiable = 416, - - /// - /// [To be supplied.] - /// - ExpectationFailed = 417, - - UpgradeRequired = 426, - - // Server Error 5xx - - /// - /// [To be supplied.] - /// - InternalServerError = 500, - - /// - /// [To be supplied.] - /// - NotImplemented = 501, - - /// - /// [To be supplied.] - /// - BadGateway = 502, - - /// - /// [To be supplied.] - /// - ServiceUnavailable = 503, - - /// - /// [To be supplied.] - /// - GatewayTimeout = 504, - - /// - /// [To be supplied.] - /// - HttpVersionNotSupported = 505, - } // enum HttpStatusCode - - /* - Fielding, et al. Standards Track [Page 3] - - RFC 2616 HTTP/1.1 June 1999 - - - 10.1 Informational 1xx ...........................................57 - 10.1.1 100 Continue .............................................58 - 10.1.2 101 Switching Protocols ..................................58 - 10.2 Successful 2xx ..............................................58 - 10.2.1 200 OK ...................................................58 - 10.2.2 201 Created ..............................................59 - 10.2.3 202 Accepted .............................................59 - 10.2.4 203 Non-Authoritative Information ........................59 - 10.2.5 204 No Content ...........................................60 - 10.2.6 205 Reset Content ........................................60 - 10.2.7 206 Partial Content ......................................60 - 10.3 Redirection 3xx .............................................61 - 10.3.1 300 Multiple Choices .....................................61 - 10.3.2 301 Moved Permanently ....................................62 - 10.3.3 302 Found ................................................62 - 10.3.4 303 See Other ............................................63 - 10.3.5 304 Not Modified .........................................63 - 10.3.6 305 Use Proxy ............................................64 - 10.3.7 306 (Unused) .............................................64 - 10.3.8 307 Temporary Redirect ...................................65 - 10.4 Client Error 4xx ............................................65 - 10.4.1 400 Bad Request .........................................65 - 10.4.2 401 Unauthorized ........................................66 - 10.4.3 402 Payment Required ....................................66 - 10.4.4 403 Forbidden ...........................................66 - 10.4.5 404 Not Found ...........................................66 - 10.4.6 405 Method Not Allowed ..................................66 - 10.4.7 406 Not Acceptable ......................................67 - 10.4.8 407 Proxy Authentication Required .......................67 - 10.4.9 408 Request Timeout .....................................67 - 10.4.10 409 Conflict ............................................67 - 10.4.11 410 Gone ................................................68 - 10.4.12 411 Length Required .....................................68 - 10.4.13 412 Precondition Failed .................................68 - 10.4.14 413 Request Entity Too Large ............................69 - 10.4.15 414 Request-URI Too Long ................................69 - 10.4.16 415 Unsupported Media Type ..............................69 - 10.4.17 416 Requested Range Not Satisfiable .....................69 - 10.4.18 417 Expectation Failed ..................................70 - 10.5 Server Error 5xx ............................................70 - 10.5.1 500 Internal Server Error ................................70 - 10.5.2 501 Not Implemented ......................................70 - 10.5.3 502 Bad Gateway ..........................................70 - 10.5.4 503 Service Unavailable ..................................70 - 10.5.5 504 Gateway Timeout ......................................71 - 10.5.6 505 HTTP Version Not Supported ...........................71 - */ -} // namespace System.Net diff --git a/src/Microsoft.Net.Http.Server/Resources.Designer.cs b/src/Microsoft.Net.Http.Server/Resources.Designer.cs deleted file mode 100644 index 8a3ccb7..0000000 --- a/src/Microsoft.Net.Http.Server/Resources.Designer.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34006 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Net.Http.Server { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Net.Http.Server.Resources", System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(Resources)).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to The destination array is too small.. - /// - internal static string Exception_ArrayTooSmall { - get { - return ResourceManager.GetString("Exception_ArrayTooSmall", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to End has already been called.. - /// - internal static string Exception_EndCalledMultipleTimes { - get { - return ResourceManager.GetString("Exception_EndCalledMultipleTimes", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The status code '{0}' is not supported.. - /// - internal static string Exception_InvalidStatusCode { - get { - return ResourceManager.GetString("Exception_InvalidStatusCode", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The stream is not seekable.. - /// - internal static string Exception_NoSeek { - get { - return ResourceManager.GetString("Exception_NoSeek", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The prefix '{0}' is already registered.. - /// - internal static string Exception_PrefixAlreadyRegistered { - get { - return ResourceManager.GetString("Exception_PrefixAlreadyRegistered", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This stream only supports read operations.. - /// - internal static string Exception_ReadOnlyStream { - get { - return ResourceManager.GetString("Exception_ReadOnlyStream", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to More data written than specified in the Content-Length header.. - /// - internal static string Exception_TooMuchWritten { - get { - return ResourceManager.GetString("Exception_TooMuchWritten", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Only the http and https schemes are supported.. - /// - internal static string Exception_UnsupportedScheme { - get { - return ResourceManager.GetString("Exception_UnsupportedScheme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This stream only supports write operations.. - /// - internal static string Exception_WriteOnlyStream { - get { - return ResourceManager.GetString("Exception_WriteOnlyStream", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The given IAsyncResult does not match this opperation.. - /// - internal static string Exception_WrongIAsyncResult { - get { - return ResourceManager.GetString("Exception_WrongIAsyncResult", resourceCulture); - } - } - - /// - /// An exception occured while running an action registered with {0}. - /// - internal static string Warning_ExceptionInOnResponseCompletedAction - { - get { return ResourceManager.GetString("Warning_ExceptionInOnResponseCompletedAction"); } - } - } -} diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/AuthenticationTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/AuthenticationTests.cs index b9dedca..a5ee320 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/AuthenticationTests.cs @@ -9,9 +9,9 @@ using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.AspNetCore.Testing.xunit; using Xunit; -using AuthenticationSchemes = Microsoft.Net.Http.Server.AuthenticationSchemes; +using AuthenticationSchemes = Microsoft.AspNetCore.Server.HttpSys.AuthenticationSchemes; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class AuthenticationTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/DummyApplication.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/DummyApplication.cs similarity index 95% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/DummyApplication.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/DummyApplication.cs index d676652..de88885 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/DummyApplication.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/DummyApplication.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { internal class DummyApplication : IHttpApplication { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/HttpsTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/HttpsTests.cs index 2309b9c..6273a8f 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/HttpsTests.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class HttpsTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/AuthenticationTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/AuthenticationTests.cs index dc7fb92..e3b7c9e 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/AuthenticationTests.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class AuthenticationTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/HttpsTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/HttpsTests.cs index da34f91..c65ada8 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/HttpsTests.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class HttpsTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/OpaqueUpgradeTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/OpaqueUpgradeTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/OpaqueUpgradeTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/OpaqueUpgradeTests.cs index 6027313..26cc299 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/OpaqueUpgradeTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/OpaqueUpgradeTests.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class OpaqueUpgradeTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs index 6c801f8..3fca608 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class RequestBodyTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestHeaderTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestHeaderTests.cs index 8945705..a333179 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestHeaderTests.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Primitives; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class RequestHeaderTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestTests.cs similarity index 97% rename from test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestTests.cs index d907e92..72ba944 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestTests.cs @@ -8,9 +8,10 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class RequestTests { @@ -147,13 +148,13 @@ public async Task Request_MultiplePrefixes(string requestUri, string expectedPat string root; var server = Utilities.CreateHttpServerReturnRoot("/", out root); server.Dispose(); - server = new WebListener(); + server = new HttpSysListener(new HttpSysOptions(), new LoggerFactory()); using (server) { var uriBuilder = new UriBuilder(root); foreach (string path in new[] { "/", "/11", "/2/3", "/2", "/11/2" }) { - server.Settings.UrlPrefixes.Add(UrlPrefix.Create(uriBuilder.Scheme, uriBuilder.Host, uriBuilder.Port, path)); + server.Options.UrlPrefixes.Add(UrlPrefix.Create(uriBuilder.Scheme, uriBuilder.Host, uriBuilder.Port, path)); } server.Start(); diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs similarity index 98% rename from test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs index 1368836..fc281ee 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class ResponseBodyTests { @@ -272,7 +272,7 @@ public async Task ResponseBodyWriteExceptions_FirstWriteAsyncWithCanceledCancell string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var responseTask = SendRequestAsync(address); var context = await server.AcceptAsync(Utilities.DefaultTimeout); @@ -331,7 +331,7 @@ public async Task ResponseBodyWriteExceptions_SecondWriteAsyncWithCanceledCancel string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var responseTask = SendRequestAsync(address); var context = await server.AcceptAsync(Utilities.DefaultTimeout); @@ -374,7 +374,7 @@ public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeFirstWrite_ string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var cts = new CancellationTokenSource(); var responseTask = SendRequestAsync(address, cts.Token); @@ -404,7 +404,7 @@ public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeFirstWriteA string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var cts = new CancellationTokenSource(); var responseTask = SendRequestAsync(address, cts.Token); @@ -482,7 +482,7 @@ public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeSecondWrite string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; RequestContext context; using (var client = new HttpClient()) { @@ -516,7 +516,7 @@ public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeSecondWrite string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; RequestContext context; using (var client = new HttpClient()) { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseCachingTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseCachingTests.cs index 5494b6a..f731bbd 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseCachingTests.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class ResponseCachingTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseHeaderTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseHeaderTests.cs index 69c918b..83e9b12 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseHeaderTests.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Primitives; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class ResponseHeaderTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs similarity index 98% rename from test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs index f5e7128..df3f6ff 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class ResponseSendFileTests { @@ -352,7 +352,7 @@ public async Task ResponseSendFileWriteExceptions_FirstCallWithCanceledCancellat string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var responseTask = SendRequestAsync(address); var context = await server.AcceptAsync(Utilities.DefaultTimeout); @@ -411,7 +411,7 @@ public async Task ResponseSendFileExceptions_SecondSendWithCanceledCancellationT string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var responseTask = SendRequestAsync(address); var context = await server.AcceptAsync(Utilities.DefaultTimeout); @@ -454,7 +454,7 @@ public async Task ResponseSendFileExceptions_ClientDisconnectsBeforeFirstSend_Se string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; var cts = new CancellationTokenSource(); var responseTask = SendRequestAsync(address, cts.Token); @@ -510,7 +510,7 @@ public async Task ResponseSendFileExceptions_ClientDisconnectsBeforeSecondSend_S string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.ThrowWriteExceptions = true; + server.Options.ThrowWriteExceptions = true; RequestContext context; using (var client = new HttpClient()) { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseTests.cs similarity index 99% rename from test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseTests.cs index cc43f1f..eacd671 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseTests.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class ResponseTests { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs similarity index 97% rename from test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs index 3dab88a..6400b7f 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { public class ServerTests { @@ -234,7 +234,7 @@ public async Task Server_SetQueueLimit_Success() string address; using (var server = Utilities.CreateHttpServer(out address)) { - server.Settings.RequestQueueLimit = 1001; + server.Options.RequestQueueLimit = 1001; var responseTask = SendRequestAsync(address); var context = await server.AcceptAsync(Utilities.DefaultTimeout); @@ -262,7 +262,7 @@ public async Task Server_HotAddPrefix_Success() Assert.Equal(string.Empty, response); address += "pathbase/"; - server.Settings.UrlPrefixes.Add(address); + server.Options.UrlPrefixes.Add(address); responseTask = SendRequestAsync(address); @@ -283,7 +283,7 @@ public async Task Server_HotRemovePrefix_Success() using (var server = Utilities.CreateHttpServer(out address)) { address += "pathbase/"; - server.Settings.UrlPrefixes.Add(address); + server.Options.UrlPrefixes.Add(address); var responseTask = SendRequestAsync(address); var context = await server.AcceptAsync(Utilities.DefaultTimeout); @@ -294,7 +294,7 @@ public async Task Server_HotRemovePrefix_Success() var response = await responseTask; Assert.Equal(string.Empty, response); - Assert.True(server.Settings.UrlPrefixes.Remove(address)); + Assert.True(server.Options.UrlPrefixes.Remove(address)); responseTask = SendRequestAsync(address); diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/SkipOffDomainAttribute.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/SkipOffDomainAttribute.cs similarity index 94% rename from test/Microsoft.Net.Http.Server.FunctionalTests/SkipOffDomainAttribute.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/SkipOffDomainAttribute.cs index bbe6c7f..7dc43fa 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/SkipOffDomainAttribute.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/SkipOffDomainAttribute.cs @@ -4,7 +4,7 @@ using System; using Microsoft.AspNetCore.Testing.xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { /// /// Skips an auth test if the machine is not joined to a Windows domain. diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/Utilities.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/Utilities.cs similarity index 70% rename from test/Microsoft.Net.Http.Server.FunctionalTests/Utilities.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/Utilities.cs index 65e4ffe..a34cd20 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/Utilities.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/Utilities.cs @@ -5,14 +5,14 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Internal; +using Microsoft.Extensions.Logging; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { internal static class Utilities { // When tests projects are run in parallel, overlapping port ranges can cause a race condition when looking for free - // ports during dynamic port allocation. To avoid this, make sure the port range here is different from the range in - // Microsoft.AspNetCore.Server.WebListener. + // ports during dynamic port allocation. private const int BasePort = 8001; private const int MaxPort = 11000; private static int NextPort = BasePort; @@ -33,27 +33,27 @@ static Utilities() #endif } - internal static WebListener CreateHttpAuthServer(AuthenticationSchemes authScheme, bool allowAnonymos, out string baseAddress) + internal static HttpSysListener CreateHttpAuthServer(AuthenticationSchemes authScheme, bool allowAnonymos, out string baseAddress) { var listener = CreateHttpServer(out baseAddress); - listener.Settings.Authentication.Schemes = authScheme; - listener.Settings.Authentication.AllowAnonymous = allowAnonymos; + listener.Options.Authentication.Schemes = authScheme; + listener.Options.Authentication.AllowAnonymous = allowAnonymos; return listener; } - internal static WebListener CreateHttpServer(out string baseAddress) + internal static HttpSysListener CreateHttpServer(out string baseAddress) { string root; return CreateDynamicHttpServer(string.Empty, out root, out baseAddress); } - internal static WebListener CreateHttpServerReturnRoot(string path, out string root) + internal static HttpSysListener CreateHttpServerReturnRoot(string path, out string root) { string baseAddress; return CreateDynamicHttpServer(path, out root, out baseAddress); } - internal static WebListener CreateDynamicHttpServer(string basePath, out string root, out string baseAddress) + internal static HttpSysListener CreateDynamicHttpServer(string basePath, out string root, out string baseAddress) { lock (PortLock) { @@ -63,14 +63,14 @@ internal static WebListener CreateDynamicHttpServer(string basePath, out string var prefix = UrlPrefix.Create("http", "localhost", port, basePath); root = prefix.Scheme + "://" + prefix.Host + ":" + prefix.Port; baseAddress = prefix.ToString(); - var listener = new WebListener(); - listener.Settings.UrlPrefixes.Add(prefix); + var listener = new HttpSysListener(new HttpSysOptions(), new LoggerFactory()); + listener.Options.UrlPrefixes.Add(prefix); try { listener.Start(); return listener; } - catch (WebListenerException) + catch (HttpSysException) { listener.Dispose(); } @@ -80,15 +80,15 @@ internal static WebListener CreateDynamicHttpServer(string basePath, out string throw new Exception("Failed to locate a free port."); } - internal static WebListener CreateHttpsServer() + internal static HttpSysListener CreateHttpsServer() { return CreateServer("https", "localhost", 9090, string.Empty); } - internal static WebListener CreateServer(string scheme, string host, int port, string path) + internal static HttpSysListener CreateServer(string scheme, string host, int port, string path) { - WebListener listener = new WebListener(); - listener.Settings.UrlPrefixes.Add(UrlPrefix.Create(scheme, host, port, path)); + var listener = new HttpSysListener(new HttpSysOptions(), new LoggerFactory()); + listener.Options.UrlPrefixes.Add(UrlPrefix.Create(scheme, host, port, path)); listener.Start(); return listener; } @@ -97,7 +97,7 @@ internal static WebListener CreateServer(string scheme, string host, int port, s /// AcceptAsync extension with timeout. This extension should be used in all tests to prevent /// unexpected hangs when a request does not arrive. /// - internal static async Task AcceptAsync(this WebListener server, TimeSpan timeout) + internal static async Task AcceptAsync(this HttpSysListener server, TimeSpan timeout) { var acceptTask = server.AcceptAsync(); var completedTask = await Task.WhenAny(acceptTask, Task.Delay(timeout)); diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/WebSocketTests.cs similarity index 98% rename from test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/WebSocketTests.cs index 5aa8990..cf919cb 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/WebSocketTests.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys.Listener { [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public class WebSocketTests diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Microsoft.AspNetCore.Server.WebListener.FunctionalTests.xproj b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests.xproj similarity index 100% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Microsoft.AspNetCore.Server.WebListener.FunctionalTests.xproj rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests.xproj diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/OpaqueUpgradeTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/OpaqueUpgradeTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs index c3db238..ef2c72e 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/OpaqueUpgradeTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs @@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class OpaqueUpgradeTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Properties/AssemblyInfo.cs similarity index 100% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Properties/AssemblyInfo.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Properties/AssemblyInfo.cs diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs index ebd6b26..f2da4d3 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class RequestBodyTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestHeaderTests.cs similarity index 98% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestHeaderTests.cs index 196de8d..7491df9 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestHeaderTests.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Primitives; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class RequestHeaderTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestTests.cs similarity index 98% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestTests.cs index 4e75ac0..bb4688e 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestTests.cs @@ -14,10 +14,9 @@ using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Microsoft.Net.Http.Server; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class RequestTests { @@ -306,11 +305,11 @@ private IServer CreateServer(out string root, RequestDelegate app) var dynamicServer = Utilities.CreateHttpServerReturnRoot("/", out root, app); dynamicServer.Dispose(); var rootUri = new Uri(root); - var server = new MessagePump(Options.Create(new WebListenerOptions()), new LoggerFactory()); + var server = new MessagePump(Options.Create(new HttpSysOptions()), new LoggerFactory()); foreach (string path in new[] { "/", "/11", "/2/3", "/2", "/11/2" }) { - server.Listener.Settings.UrlPrefixes.Add(UrlPrefix.Create(rootUri.Scheme, rootUri.Host, rootUri.Port, path)); + server.Listener.Options.UrlPrefixes.Add(UrlPrefix.Create(rootUri.Scheme, rootUri.Host, rootUri.Port, path)); } server.Start(new DummyApplication(app)); diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs index 6842146..a1bac1a 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class ResponseBodyTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseCachingTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseCachingTests.cs index 0f0c702..6a2fe8c 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseCachingTests.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests +namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests { public class ResponseCachingTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseHeaderTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseHeaderTests.cs index 9b060f2..3631fc7 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseHeaderTests.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.Primitives; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class ResponseHeaderTests { @@ -255,7 +255,7 @@ public async Task Headers_FlushAsyncSendsHeaders_Success() } } - [Theory, MemberData(nameof(NullHeaderData))] + [ConditionalTheory, MemberData(nameof(NullHeaderData))] public async Task Headers_IgnoreNullHeaders(string headerName, StringValues headerValue, StringValues expectedValue) { string address; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs index 4ee3342..09fd9c3 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs @@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class ResponseSendFileTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseTests.cs index 950e80a..f2d244e 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseTests.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class ResponseTests { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs similarity index 97% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs index d84295a..2794e46 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs @@ -15,10 +15,9 @@ using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Microsoft.Net.Http.Server; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { public class ServerTests { @@ -242,9 +241,9 @@ public async Task Server_SetQueueLimit_Success() string address; using (Utilities.CreateHttpServer(out address, httpContext => Task.FromResult(0))) { } - var server = new MessagePump(Options.Create(new WebListenerOptions()), new LoggerFactory()); - server.Listener.Settings.UrlPrefixes.Add(UrlPrefix.Create(address)); - server.Listener.Settings.RequestQueueLimit = 1001; + var server = new MessagePump(Options.Create(new HttpSysOptions()), new LoggerFactory()); + server.Listener.Options.UrlPrefixes.Add(UrlPrefix.Create(address)); + server.Listener.Options.RequestQueueLimit = 1001; using (server) { diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Utilities.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Utilities.cs similarity index 83% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Utilities.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Utilities.cs index fb6ccbe..3682e1d 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Utilities.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Utilities.cs @@ -7,15 +7,13 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Microsoft.Net.Http.Server; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { internal static class Utilities { // When tests projects are run in parallel, overlapping port ranges can cause a race condition when looking for free - // ports during dynamic port allocation. To avoid this, make sure the port range here is different from the range in - // Microsoft.Net.Http.Server. + // ports during dynamic port allocation. private const int BasePort = 5001; private const int MaxPort = 8000; private static int NextPort = BasePort; @@ -51,16 +49,16 @@ internal static IServer CreateDynamicHttpServer(string basePath, AuthenticationS root = prefix.Scheme + "://" + prefix.Host + ":" + prefix.Port; baseAddress = prefix.ToString(); - var server = new MessagePump(Options.Create(new WebListenerOptions()), new LoggerFactory()); + var server = new MessagePump(Options.Create(new HttpSysOptions()), new LoggerFactory()); server.Features.Get().Addresses.Add(baseAddress); - server.Listener.Settings.Authentication.Schemes = authType; - server.Listener.Settings.Authentication.AllowAnonymous = allowAnonymous; + server.Listener.Options.Authentication.Schemes = authType; + server.Listener.Options.Authentication.AllowAnonymous = allowAnonymous; try { server.Start(new DummyApplication(app)); return server; } - catch (WebListenerException) + catch (HttpSysException) { } } @@ -76,7 +74,7 @@ internal static IServer CreateHttpsServer(RequestDelegate app) internal static IServer CreateServer(string scheme, string host, int port, string path, RequestDelegate app) { - var server = new MessagePump(Options.Create(new WebListenerOptions()), new LoggerFactory()); + var server = new MessagePump(Options.Create(new HttpSysOptions()), new LoggerFactory()); server.Features.Get().Addresses.Add(UrlPrefix.Create(scheme, host, port, path).ToString()); server.Start(new DummyApplication(app)); return server; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/WebSocketTests.cs similarity index 99% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/WebSocketTests.cs index 5d3c28c..92baa96 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/WebSocketTests.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Testing.xunit; using Xunit; -namespace Microsoft.AspNetCore.Server.WebListener +namespace Microsoft.AspNetCore.Server.HttpSys { [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public class WebSocketTests diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/project.json similarity index 87% rename from test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/project.json rename to test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/project.json index c2443aa..5ff0bc8 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/project.json @@ -6,7 +6,7 @@ "testRunner": "xunit", "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Server.WebListener": "1.2.0-*", + "Microsoft.AspNetCore.Server.HttpSys": "1.2.0-*", "Microsoft.AspNetCore.Testing": "1.2.0-*", "xunit": "2.2.0-*" }, @@ -23,6 +23,7 @@ }, "net451": { "frameworkAssemblies": { + "System.DirectoryServices": "", "System.Net.Http": "", "System.Net.Http.WebRequest": "" } diff --git a/test/Microsoft.Net.Http.Server.Tests/Microsoft.Net.Http.Server.Tests.xproj b/test/Microsoft.AspNetCore.Server.HttpSys.Tests/Microsoft.AspNetCore.Server.HttpSys.Tests.xproj similarity index 100% rename from test/Microsoft.Net.Http.Server.Tests/Microsoft.Net.Http.Server.Tests.xproj rename to test/Microsoft.AspNetCore.Server.HttpSys.Tests/Microsoft.AspNetCore.Server.HttpSys.Tests.xproj diff --git a/test/Microsoft.Net.Http.Server.Tests/UrlPrefixTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.Tests/UrlPrefixTests.cs similarity index 96% rename from test/Microsoft.Net.Http.Server.Tests/UrlPrefixTests.cs rename to test/Microsoft.AspNetCore.Server.HttpSys.Tests/UrlPrefixTests.cs index fece76e..8614ac3 100644 --- a/test/Microsoft.Net.Http.Server.Tests/UrlPrefixTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.Tests/UrlPrefixTests.cs @@ -5,7 +5,7 @@ using System.Text; using Xunit; -namespace Microsoft.Net.Http.Server +namespace Microsoft.AspNetCore.Server.HttpSys { public class UrlPrefixTests { @@ -43,7 +43,7 @@ public void CreateThrowsForUrlsWithoutHost(string url) [InlineData("http://www.example.com:NOTAPORT")] [InlineData("https://www.example.com:NOTAPORT")] [InlineData("http://www.example.com:NOTAPORT/")] - [InlineData("http://foo:/tmp/weblistener-test.sock:5000/doesn't/matter")] + [InlineData("http://foo:/tmp/httpsys-test.sock:5000/doesn't/matter")] public void CreateThrowsForUrlsWithInvalidPorts(string url) { Assert.Throws(() => UrlPrefix.Create(url)); diff --git a/test/Microsoft.Net.Http.Server.Tests/project.json b/test/Microsoft.AspNetCore.Server.HttpSys.Tests/project.json similarity index 85% rename from test/Microsoft.Net.Http.Server.Tests/project.json rename to test/Microsoft.AspNetCore.Server.HttpSys.Tests/project.json index 1786eef..fd02049 100644 --- a/test/Microsoft.Net.Http.Server.Tests/project.json +++ b/test/Microsoft.AspNetCore.Server.HttpSys.Tests/project.json @@ -2,7 +2,7 @@ "testRunner": "xunit", "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.Net.Http.Server": "1.2.0-*", + "Microsoft.AspNetCore.Server.HttpSys": "1.2.0-*", "xunit": "2.2.0-*" }, "frameworks": { diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/Microsoft.Net.Http.Server.FunctionalTests.xproj b/test/Microsoft.Net.Http.Server.FunctionalTests/Microsoft.Net.Http.Server.FunctionalTests.xproj deleted file mode 100644 index 3de44fa..0000000 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/Microsoft.Net.Http.Server.FunctionalTests.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - dcb6e0b1-223d-44e6-8696-4767e5b6e6a1 - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 6d9ec40..0000000 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Testing.xunit; - -[assembly: OSSkipCondition(OperatingSystems.MacOSX)] -[assembly: OSSkipCondition(OperatingSystems.Linux)] \ No newline at end of file diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/project.json b/test/Microsoft.Net.Http.Server.FunctionalTests/project.json deleted file mode 100644 index f245f63..0000000 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/project.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "testRunner": "xunit", - "buildOptions": { - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk" - }, - "dependencies": { - "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Testing": "1.2.0-*", - "Microsoft.Net.Http.Server": "1.2.0-*", - "xunit": "2.2.0-*" - }, - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.Extensions.RuntimeEnvironment.Sources": { - "type": "build", - "version": "1.2.0-*" - }, - "Microsoft.NETCore.App": { - "version": "1.2.0-*", - "type": "platform" - }, - "System.Net.Http.WinHttpHandler": "4.4.0-*", - "System.Net.WebSockets.Client": "4.4.0-*" - } - }, - "net451": { - "frameworkAssemblies": { - "System.DirectoryServices": "", - "System.Net.Http": "", - "System.Net.Http.WebRequest": "" - } - } - } -} \ No newline at end of file