Seperate the server layers into two projects.

This commit is contained in:
Chris Ross 2014-04-16 15:53:51 -07:00
parent 93aa23b6ab
commit bfab162b4b
85 changed files with 374 additions and 239 deletions

View File

@ -11,7 +11,7 @@ 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.AspNet.Server.WebListener", "src\Microsoft.AspNet.Server.WebListener\Microsoft.AspNet.Server.WebListener.kproj", "{3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Server", "src\Microsoft.Net.Server\Microsoft.Net.Server.kproj", "{3F5212AA-E287-49DD-8CEC-44BF0A2AC9A1}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloWorld", "samples\HelloWorld\HelloWorld.kproj", "{6DAF3E6B-8E1B-4E6E-B9FE-7B1E5FDB7DB4}"
EndProject
@ -23,6 +23,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.WebSockets
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Server.WebListener.FunctionalTests", "test\Microsoft.AspNet.Server.WebListener.FunctionalTests\Microsoft.AspNet.Server.WebListener.FunctionalTests.kproj", "{4492FF4C-9032-411D-853F-46B01755E504}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Server.WebListener", "src\Microsoft.AspNet.Server.WebListener\Microsoft.AspNet.Server.WebListener.kproj", "{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -103,6 +105,16 @@ Global
{4492FF4C-9032-411D-853F-46B01755E504}.Release|Mixed Platforms.Build.0 = Release|x86
{4492FF4C-9032-411D-853F-46B01755E504}.Release|x86.ActiveCfg = Release|x86
{4492FF4C-9032-411D-853F-46B01755E504}.Release|x86.Build.0 = Release|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Debug|Any CPU.ActiveCfg = Debug|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Debug|Mixed Platforms.Build.0 = Debug|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Debug|x86.ActiveCfg = Debug|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Debug|x86.Build.0 = Debug|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|Any CPU.ActiveCfg = Release|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|Mixed Platforms.ActiveCfg = Release|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|Mixed Platforms.Build.0 = Release|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|x86.ActiveCfg = Release|x86
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -115,5 +127,6 @@ Global
{EFC7538F-7AEB-4A3E-A1E6-6BDCCBD272BF} = {99D5E5F3-88F5-4CCF-8D8C-717C8925DF09}
{E788AEAE-2CB4-4BFA-8746-D0BB7E93A1BB} = {99D5E5F3-88F5-4CCF-8D8C-717C8925DF09}
{4492FF4C-9032-411D-853F-46B01755E504} = {E183C826-1360-4DFF-9994-F33CED5C8525}
{B9F45F9D-D206-47F0-8E5F-54CE2F0BDF92} = {99D5E5F3-88F5-4CCF-8D8C-717C8925DF09}
EndGlobalSection
EndGlobal

View File

@ -1,7 +1,7 @@
using System;
using System.Text;
using Microsoft.AspNet.Server.WebListener;
using Microsoft.Net.Server;
namespace HelloWorld
{
@ -9,7 +9,7 @@ namespace HelloWorld
{
public static void Main(string[] args)
{
using (OwinWebListener listener = new OwinWebListener())
using (WebListener listener = new WebListener())
{
listener.UrlPrefixes.Add(UrlPrefix.Create("http://localhost:8080"));
listener.Start();

View File

@ -1,7 +1,7 @@
{
"version" : "0.1-alpha-*",
"dependencies": {
"Microsoft.AspNet.Server.WebListener" : ""
"Microsoft.Net.Server" : ""
},
"configurations": {
"net45": { },

View File

@ -1,5 +1,6 @@
using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.Server.WebListener;
using Microsoft.Net.Server;
namespace SelfHostServer
{

View File

@ -3,6 +3,7 @@
"dependencies": {
"Microsoft.AspNet.Abstractions": "0.1-alpha-*",
"Microsoft.AspNet.Hosting": "0.1-alpha-*",
"Microsoft.Net.Server": "",
"Microsoft.AspNet.Server.WebListener": ""
},
"commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" },

View File

@ -66,7 +66,6 @@
<Compile Include="NTAuthentication.cs" />
<Compile Include="PrefixCollection.cs" />
<Compile Include="PrefixEnumerator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceNameStore.cs" />
<Compile Include="WindowsAuthMiddleware.cs" />
</ItemGroup>

View File

@ -1,42 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.AspNet.Security.Windows")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.AspNet.Security.Windows")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1f471909-581f-4060-a147-430891e9c3c1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("0.5")]
[assembly: AssemblyVersion("0.5")]
[assembly: AssemblyFileVersion("0.5.40117.0")]

View File

@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.HttpFeature;
using Microsoft.Net.Server;
namespace Microsoft.AspNet.Server.WebListener
{

View File

@ -3,16 +3,17 @@ using System.Diagnostics.Contracts;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Logging;
using Microsoft.Net.Server;
namespace Microsoft.AspNet.Server.WebListener
{
using AppFunc = Func<object, Task>;
internal class WebListenerWrapper : IDisposable
internal class MessagePump : IDisposable
{
private static readonly int DefaultMaxAccepts = 5 * Environment.ProcessorCount;
private readonly OwinWebListener _listener;
private readonly Microsoft.Net.Server.WebListener _listener;
private readonly ILogger _logger;
private AppFunc _appFunc;
@ -23,17 +24,17 @@ namespace Microsoft.AspNet.Server.WebListener
// TODO: private IDictionary<string, object> _capabilities;
internal WebListenerWrapper(OwinWebListener listener, ILoggerFactory loggerFactory)
internal MessagePump(Microsoft.Net.Server.WebListener listener, ILoggerFactory loggerFactory)
{
Contract.Assert(listener != null);
_listener = listener;
_logger = LogHelper.CreateLogger(loggerFactory, typeof(WebListenerWrapper));
_logger = LogHelper.CreateLogger(loggerFactory, typeof(MessagePump));
_processRequest = new Action<object>(ProcessRequestAsync);
_maxAccepts = DefaultMaxAccepts;
}
internal OwinWebListener Listener
internal Microsoft.Net.Server.WebListener Listener
{
get { return _listener; }
}
@ -127,7 +128,7 @@ namespace Microsoft.AspNet.Server.WebListener
{
FeatureContext featureContext = new FeatureContext(requestContext);
await _appFunc(featureContext.Features).SupressContext();
await requestContext.ProcessResponseAsync().SupressContext();
// TODO: WebSocket/Opaque upgrade - await requestContext.ProcessResponseAsync().SupressContext();
}
catch (Exception ex)
{

View File

@ -6,9 +6,8 @@
</PropertyGroup>
<Import Project="$(VSToolsPath)\ProjectK\Microsoft.Web.ProjectK.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>3f5212aa-e287-49dd-8cec-44bf0a2ac9a1</ProjectGuid>
<ProjectGuid>b9f45f9d-d206-47f0-8e5f-54ce2f0bdf92</ProjectGuid>
<OutputType>Library</OutputType>
<ActiveTargetFramework>net45</ActiveTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
</PropertyGroup>
@ -18,78 +17,16 @@
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="AsyncAcceptContext.cs" />
<Compile Include="AuthenticationManager.cs" />
<Compile Include="AuthenticationTypes.cs" />
<Compile Include="Constants.cs" />
<Compile Include="DictionaryExtensions.cs" />
<Compile Include="fx\AssemblyNeutralAttribute.cs" />
<Compile Include="fx\IServerFactory.cs" />
<Compile Include="fx\Microsoft\Win32\SafeHandles\CriticalHandleZeroOrMinusOneIsInvalid.cs" />
<Compile Include="fx\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" />
<Compile Include="fx\System\Diagnostics\TraceEventType.cs" />
<Compile Include="fx\System\ExternDll.cs" />
<Compile Include="fx\System\Runtime\InteropServices\ExternalException.cs" />
<Compile Include="fx\System\SafeNativeMethods.cs" />
<Compile Include="fx\System\Security\Authentication\ExtendedProtection\ChannelBinding.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Helpers.cs" />
<Compile Include="LogHelper.cs" />
<Compile Include="NativeInterop\AddressFamily.cs" />
<Compile Include="NativeInterop\ComNetOS.cs" />
<Compile Include="NativeInterop\ContextAttribute.cs" />
<Compile Include="NativeInterop\HttpRequestQueueV2Handle.cs" />
<Compile Include="NativeInterop\HttpServerSessionHandle.cs" />
<Compile Include="NativeInterop\HttpSysRequestHeader.cs" />
<Compile Include="NativeInterop\HttpSysResponseHeader.cs" />
<Compile Include="NativeInterop\HttpSysSettings.cs" />
<Compile Include="NativeInterop\IntPtrHelper.cs" />
<Compile Include="NativeInterop\NclUtilities.cs" />
<Compile Include="NativeInterop\SafeLoadLibrary.cs" />
<Compile Include="NativeInterop\SafeLocalFree.cs" />
<Compile Include="NativeInterop\SafeLocalFreeChannelBinding.cs" />
<Compile Include="NativeInterop\SafeLocalMemHandle.cs" />
<Compile Include="NativeInterop\SafeNativeOverlapped.cs" />
<Compile Include="NativeInterop\SchProtocols.cs" />
<Compile Include="NativeInterop\SecurityStatus.cs" />
<Compile Include="NativeInterop\SocketAddress.cs" />
<Compile Include="NativeInterop\SSPIHandle.cs" />
<Compile Include="NativeInterop\UnsafeNativeMethods.cs" />
<Compile Include="OwinWebListener.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RequestProcessing\BoundaryType.cs" />
<Compile Include="RequestProcessing\ClientCertLoader.cs" />
<Compile Include="RequestProcessing\FeatureContext.cs" />
<Compile Include="RequestProcessing\HeaderEncoding.cs" />
<Compile Include="RequestProcessing\HttpKnownHeaderNames.cs" />
<Compile Include="RequestProcessing\HttpReasonPhrase.cs" />
<Compile Include="RequestProcessing\HttpStatusCode.cs" />
<Compile Include="RequestProcessing\NativeRequestContext.cs" />
<Compile Include="RequestProcessing\OpaqueStream.cs" />
<Compile Include="RequestProcessing\Request.cs" />
<Compile Include="RequestProcessing\RequestContext.cs" />
<Compile Include="RequestProcessing\RequestHeaders.cs" />
<Compile Include="RequestProcessing\RequestHeaders.Generated.cs" />
<Compile Include="RequestProcessing\RequestStream.cs" />
<Compile Include="RequestProcessing\RequestUriBuilder.cs" />
<Compile Include="RequestProcessing\Response.cs" />
<Compile Include="RequestProcessing\ResponseStream.cs" />
<Compile Include="RequestProcessing\ResponseStreamAsyncResult.cs" />
<Compile Include="RequestProcessing\SslStatus.cs" />
<Compile Include="Resources.Designer.cs" />
<Compile Include="ServerFactory.cs" />
<Compile Include="ServerInformation.cs" />
<Compile Include="TimeoutManager.cs" />
<Compile Include="UrlPrefix.cs" />
<Compile Include="ValidationHelper.cs" />
<Compile Include="WebListenerException.cs" />
<Compile Include="WebListenerWrapper.cs" />
<Content Include="Project.json" />
</ItemGroup>
<ItemGroup>
<Content Include="CustomDictionary.xml" />
<Content Include="Project.json" />
<Content Include="RequestProcessing\RequestHeaders.Generated.tt" />
<Content Include="Resources.resx" />
<Compile Include="AssemblyNeutralAttribute.cs" />
<Compile Include="FeatureContext.cs" />
<Compile Include="Helpers.cs" />
<Compile Include="LogHelper.cs" />
<Compile Include="ServerFactory.cs" />
<Compile Include="ServerInformation.cs" />
<Compile Include="MessagePump.cs" />
</ItemGroup>
<Import Project="$(VSToolsPath)\ProjectK\Microsoft.Web.ProjectK.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -25,6 +25,7 @@ using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.ConfigurationModel;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Logging;
using Microsoft.Net.Server;
namespace Microsoft.AspNet.Server.WebListener
{
@ -49,9 +50,9 @@ namespace Microsoft.AspNet.Server.WebListener
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Disposed by caller")]
public IServerInformation Initialize(IConfiguration configuration)
{
OwinWebListener listener = new OwinWebListener();
Microsoft.Net.Server.WebListener listener = new Microsoft.Net.Server.WebListener();
ParseAddresses(configuration, listener);
return new ServerInformation(new WebListenerWrapper(listener, _loggerFactory));
return new ServerInformation(new MessagePump(listener, _loggerFactory));
}
/// <summary>
@ -78,11 +79,11 @@ namespace Microsoft.AspNet.Server.WebListener
// TODO: var capabilities = new Dictionary<string, object>();
serverInfo.Wrapper.Start(app);
return serverInfo.Wrapper;
serverInfo.MessagePump.Start(app);
return serverInfo.MessagePump;
}
private void ParseAddresses(IConfiguration config, OwinWebListener listener)
private void ParseAddresses(IConfiguration config, Microsoft.Net.Server.WebListener listener)
{
// TODO: Key format?
string urls;

View File

@ -5,16 +5,16 @@ namespace Microsoft.AspNet.Server.WebListener
{
public class ServerInformation : IServerInformation
{
private WebListenerWrapper _webListenerWrapper;
private MessagePump _messagePump;
internal ServerInformation(WebListenerWrapper webListenerWrapper)
internal ServerInformation(MessagePump messagePump)
{
_webListenerWrapper = webListenerWrapper;
_messagePump = messagePump;
}
internal WebListenerWrapper Wrapper
internal MessagePump MessagePump
{
get { return _webListenerWrapper; }
get { return _messagePump; }
}
// Microsoft.AspNet.Server.WebListener
@ -23,15 +23,15 @@ namespace Microsoft.AspNet.Server.WebListener
get { return GetType().GetTypeInfo().Assembly.GetName().Name; }
}
public OwinWebListener Listener
public Microsoft.Net.Server.WebListener Listener
{
get { return _webListenerWrapper.Listener; }
get { return _messagePump.Listener; }
}
public int MaxAccepts
{
get { return _webListenerWrapper.MaxAccepts; }
set { _webListenerWrapper.MaxAccepts = value; }
get { return _messagePump.MaxAccepts; }
set { _messagePump.MaxAccepts = value; }
}
}
}

View File

@ -1,16 +0,0 @@
/* TODO: Take a temp dependency on Ms.Aspnet.Hosting until AssemblyNeutral gets fixed.
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.ConfigurationModel;
namespace Microsoft.AspNet.Hosting.Server
{
// TODO: [AssemblyNeutral]
public interface IServerFactory
{
IServerInformation Initialize(IConfiguration configuration);
IDisposable Start(IServerInformation serverInformation, Func<object, Task> application);
}
}
*/

View File

@ -1,6 +1,7 @@
{
{
"version": "0.1-alpha-*",
"dependencies": {
"Microsoft.Net.Server" : "",
"Microsoft.AspNet.Abstractions": "0.1-alpha-*",
"Microsoft.AspNet.ConfigurationModel": "0.1-alpha-*",
"Microsoft.AspNet.HttpFeature": "0.1-alpha-*",

View File

@ -10,17 +10,17 @@ using System.Diagnostics.Contracts;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal unsafe class AsyncAcceptContext : IAsyncResult, IDisposable
{
internal static readonly IOCompletionCallback IOCallback = new IOCompletionCallback(IOWaitCallback);
private TaskCompletionSource<RequestContext> _tcs;
private OwinWebListener _server;
private WebListener _server;
private NativeRequestContext _nativeRequestContext;
internal AsyncAcceptContext(OwinWebListener server)
internal AsyncAcceptContext(WebListener server)
{
_server = server;
_tcs = new TaskCompletionSource<RequestContext>();
@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
private OwinWebListener Server
private WebListener Server
{
get
{
@ -66,7 +66,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
else
{
OwinWebListener server = asyncResult.Server;
WebListener server = asyncResult.Server;
if (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS)
{
// at this point we have received an unmanaged HTTP_REQUEST and memoryBlob
@ -174,7 +174,7 @@ namespace Microsoft.AspNet.Server.WebListener
retry = true;
}
else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS
&& OwinWebListener.SkipIOCPCallbackOnSuccess)
&& WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
IOCompleted(this, statusCode, bytesTransferred);

View File

@ -9,7 +9,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// 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
@ -27,12 +27,12 @@ namespace Microsoft.AspNet.Server.WebListener
Marshal.SizeOf<UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_AUTHENTICATION_INFO>();
#endif
private OwinWebListener _server;
private WebListener _server;
AuthenticationType _authTypes;
internal AuthenticationManager(OwinWebListener context)
internal AuthenticationManager(WebListener listener)
{
_server = context;
_server = listener;
_authTypes = AuthenticationType.None;
}

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
[Flags]
public enum AuthenticationType

View File

@ -6,7 +6,7 @@
using System;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class Constants
{

View File

@ -0,0 +1,29 @@
// -----------------------------------------------------------------------
// <copyright file="Helpers.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Microsoft.Net.Server
{
internal static class Helpers
{
internal static Task CompletedTask()
{
return Task.FromResult<object>(null);
}
internal static ConfiguredTaskAwaitable SupressContext(this Task task)
{
return task.ConfigureAwait(continueOnCapturedContext: false);
}
internal static ConfiguredTaskAwaitable<T> SupressContext<T>(this Task<T> task)
{
return task.ConfigureAwait(continueOnCapturedContext: false);
}
}
}

View File

@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
// <copyright file="HttpListener.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Globalization;
using Microsoft.AspNet.Logging;
namespace Microsoft.Net.Server
{
internal static class LogHelper
{
internal static ILogger CreateLogger(ILoggerFactory factory, Type type)
{
if (factory == null)
{
return null;
}
return factory.Create(type.FullName);
}
internal static void LogInfo(ILogger logger, string data)
{
if (logger == null)
{
Debug.WriteLine(data);
}
else
{
logger.WriteInformation(data);
}
}
internal static void LogVerbose(ILogger logger, string data)
{
if (logger == null)
{
Debug.WriteLine(data);
}
else
{
logger.WriteVerbose(data);
}
}
internal static void LogException(ILogger logger, string location, Exception exception)
{
if (logger == null)
{
Debug.WriteLine(exception);
}
else
{
logger.WriteError(location, exception);
}
}
internal static void LogError(ILogger logger, string location, string message)
{
if (logger == null)
{
Debug.WriteLine(message);
}
else
{
logger.WriteError(location + "; " + message);
}
}
}
}

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\ProjectK\Microsoft.Web.ProjectK.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>3f5212aa-e287-49dd-8cec-44bf0a2ac9a1</ProjectGuid>
<OutputType>Library</OutputType>
<ActiveTargetFramework>net45</ActiveTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="AsyncAcceptContext.cs" />
<Compile Include="AuthenticationManager.cs" />
<Compile Include="AuthenticationTypes.cs" />
<Compile Include="Constants.cs" />
<Compile Include="DictionaryExtensions.cs" />
<Compile Include="fx\Microsoft\Win32\SafeHandles\CriticalHandleZeroOrMinusOneIsInvalid.cs" />
<Compile Include="fx\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" />
<Compile Include="fx\System\Diagnostics\TraceEventType.cs" />
<Compile Include="fx\System\ExternDll.cs" />
<Compile Include="fx\System\Runtime\InteropServices\ExternalException.cs" />
<Compile Include="fx\System\SafeNativeMethods.cs" />
<Compile Include="fx\System\Security\Authentication\ExtendedProtection\ChannelBinding.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Helpers.cs" />
<Compile Include="LogHelper.cs" />
<Compile Include="NativeInterop\AddressFamily.cs" />
<Compile Include="NativeInterop\ComNetOS.cs" />
<Compile Include="NativeInterop\ContextAttribute.cs" />
<Compile Include="NativeInterop\HttpRequestQueueV2Handle.cs" />
<Compile Include="NativeInterop\HttpServerSessionHandle.cs" />
<Compile Include="NativeInterop\HttpSysRequestHeader.cs" />
<Compile Include="NativeInterop\HttpSysResponseHeader.cs" />
<Compile Include="NativeInterop\HttpSysSettings.cs" />
<Compile Include="NativeInterop\IntPtrHelper.cs" />
<Compile Include="NativeInterop\NclUtilities.cs" />
<Compile Include="NativeInterop\SafeLoadLibrary.cs" />
<Compile Include="NativeInterop\SafeLocalFree.cs" />
<Compile Include="NativeInterop\SafeLocalFreeChannelBinding.cs" />
<Compile Include="NativeInterop\SafeLocalMemHandle.cs" />
<Compile Include="NativeInterop\SafeNativeOverlapped.cs" />
<Compile Include="NativeInterop\SchProtocols.cs" />
<Compile Include="NativeInterop\SecurityStatus.cs" />
<Compile Include="NativeInterop\SocketAddress.cs" />
<Compile Include="NativeInterop\SSPIHandle.cs" />
<Compile Include="NativeInterop\UnsafeNativeMethods.cs" />
<Compile Include="WebListener.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RequestProcessing\BoundaryType.cs" />
<Compile Include="RequestProcessing\ClientCertLoader.cs" />
<Compile Include="RequestProcessing\HeaderEncoding.cs" />
<Compile Include="RequestProcessing\HttpKnownHeaderNames.cs" />
<Compile Include="RequestProcessing\HttpReasonPhrase.cs" />
<Compile Include="RequestProcessing\HttpStatusCode.cs" />
<Compile Include="RequestProcessing\NativeRequestContext.cs" />
<Compile Include="RequestProcessing\OpaqueStream.cs" />
<Compile Include="RequestProcessing\Request.cs" />
<Compile Include="RequestProcessing\RequestContext.cs" />
<Compile Include="RequestProcessing\RequestHeaders.cs" />
<Compile Include="RequestProcessing\RequestHeaders.Generated.cs" />
<Compile Include="RequestProcessing\RequestStream.cs" />
<Compile Include="RequestProcessing\RequestUriBuilder.cs" />
<Compile Include="RequestProcessing\Response.cs" />
<Compile Include="RequestProcessing\ResponseStream.cs" />
<Compile Include="RequestProcessing\ResponseStreamAsyncResult.cs" />
<Compile Include="RequestProcessing\SslStatus.cs" />
<Compile Include="Resources.Designer.cs" />
<Compile Include="TimeoutManager.cs" />
<Compile Include="UrlPrefix.cs" />
<Compile Include="ValidationHelper.cs" />
<Compile Include="WebListenerException.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="CustomDictionary.xml" />
<Content Include="Project.json" />
<Content Include="RequestProcessing\RequestHeaders.Generated.tt" />
<Content Include="Resources.resx" />
</ItemGroup>
<Import Project="$(VSToolsPath)\ProjectK\Microsoft.Web.ProjectK.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -4,7 +4,7 @@
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
/// <devdoc>
/// <para>

View File

@ -6,7 +6,7 @@
using System;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class ComNetOS
{

View File

@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal enum ContextAttribute
{

View File

@ -6,7 +6,7 @@
using Microsoft.Win32.SafeHandles;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// This class is a wrapper for Http.sys V2 request queue handle.
internal sealed class HttpRequestQueueV2Handle : SafeHandleZeroOrMinusOneIsInvalid

View File

@ -8,7 +8,7 @@ using System;
using System.Threading;
using Microsoft.Win32.SafeHandles;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal sealed class HttpServerSessionHandle : CriticalHandleZeroOrMinusOneIsInvalid
{

View File

@ -4,7 +4,7 @@
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal enum HttpSysRequestHeader
{

View File

@ -4,7 +4,7 @@
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal enum HttpSysResponseHeader
{

View File

@ -13,7 +13,7 @@ using System.Security;
using Microsoft.Win32;
#endif
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class HttpSysSettings
{

View File

@ -6,7 +6,7 @@
using System;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class IntPtrHelper
{

View File

@ -6,7 +6,7 @@
using System;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class NclUtilities
{

View File

@ -7,7 +7,7 @@
using System;
using System.Runtime.InteropServices;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct SSPIHandle

View File

@ -6,7 +6,7 @@
using Microsoft.Win32.SafeHandles;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal sealed class SafeLoadLibrary : SafeHandleZeroOrMinusOneIsInvalid
{

View File

@ -7,7 +7,7 @@
using System;
using Microsoft.Win32.SafeHandles;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal sealed class SafeLocalFree : SafeHandleZeroOrMinusOneIsInvalid
{

View File

@ -7,7 +7,7 @@
using System;
using System.Security.Authentication.ExtendedProtection;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal class SafeLocalFreeChannelBinding : ChannelBinding
{

View File

@ -7,7 +7,7 @@
using System;
using Microsoft.Win32.SafeHandles;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal sealed class SafeLocalMemHandle : SafeHandleZeroOrMinusOneIsInvalid
{

View File

@ -8,7 +8,7 @@ using System;
using System.Runtime.InteropServices;
using System.Threading;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal class SafeNativeOverlapped : SafeHandle
{

View File

@ -4,7 +4,7 @@
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
using System;
using System.Globalization;

View File

@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal enum SecurityStatus
{

View File

@ -11,7 +11,7 @@ using System.Globalization;
using System.Net;
using System.Text;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// a little perf app measured these times when comparing the internal
// buffer implemented as a managed byte[] or unmanaged memory IntPtr

View File

@ -9,7 +9,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class UnsafeNclNativeMethods
{
@ -63,7 +63,7 @@ namespace Microsoft.AspNet.Server.WebListener
[DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern unsafe uint HttpCreateRequestQueue(HttpApi.HTTPAPI_VERSION version, string pName,
Microsoft.AspNet.Server.WebListener.UnsafeNclNativeMethods.SECURITY_ATTRIBUTES pSecurityAttributes, uint flags, out HttpRequestQueueV2Handle pReqQueueHandle);
Microsoft.Net.Server.UnsafeNclNativeMethods.SECURITY_ATTRIBUTES pSecurityAttributes, uint flags, out HttpRequestQueueV2Handle pReqQueueHandle);
[DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
internal static extern unsafe uint HttpCloseRequestQueue(IntPtr pReqQueueHandle);

View File

@ -0,0 +1,40 @@
{
"version": "0.1-alpha-*",
"dependencies": {
"Microsoft.AspNet.Logging": "0.1-alpha-*"
},
"compilationOptions": {
"allowUnsafe": true
},
"configurations": {
"net45": {},
"k10": {
"dependencies": {
"System.Collections": "4.0.0.0",
"System.Collections.Concurrent": "4.0.0.0",
"System.Diagnostics.Contracts": "4.0.0.0",
"System.Diagnostics.Debug": "4.0.10.0",
"System.Diagnostics.Tools": "4.0.0.0",
"System.Globalization": "4.0.10.0",
"System.IO": "4.0.0.0",
"System.IO.FileSystem": "4.0.0.0",
"System.IO.FileSystem.Primitives": "4.0.0.0",
"System.Linq": "4.0.0.0",
"System.Reflection": "4.0.10.0",
"System.Resources.ResourceManager": "4.0.0.0",
"System.Runtime": "4.0.20.0",
"System.Runtime.Extensions": "4.0.10.0",
"System.Runtime.InteropServices": "4.0.20.0",
"System.Runtime.Handles": "4.0.0.0",
"System.Security.Principal": "4.0.0.0",
"System.Text.Encoding": "4.0.20.0",
"System.Text.Encoding.Extensions": "4.0.10.0",
"System.Threading": "4.0.0.0",
"System.Threading.Overlapped": "4.0.0.0",
"System.Threading.Tasks": "4.0.10.0",
"System.Threading.ThreadPool": "4.0.10.0",
"Microsoft.Win32.Primitives": "4.0.0.0"
}
}
}
}

View File

@ -12,11 +12,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.AspNet.Server.WebListener")]
[assembly: AssemblyTitle("Microsoft.Net.Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.AspNet.Server.WebListener")]
[assembly: AssemblyProduct("Microsoft.Net.Server")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal enum BoundaryType
{

View File

@ -14,7 +14,7 @@ using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// 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.
@ -177,7 +177,7 @@ namespace Microsoft.AspNet.Server.WebListener
Complete(0, null);
}
else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
OwinWebListener.SkipIOCPCallbackOnSuccess)
WebListener.SkipIOCPCallbackOnSuccess)
{
IOCompleted(statusCode, bytesReceived);
}
@ -243,7 +243,7 @@ namespace Microsoft.AspNet.Server.WebListener
asyncResult._overlapped);
if (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING ||
(errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && !OwinWebListener.SkipIOCPCallbackOnSuccess))
(errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && !WebListener.SkipIOCPCallbackOnSuccess))
{
return;
}

View File

@ -9,7 +9,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// we use this static class as a helper class to encode/decode HTTP headers.
// what we need is a 1-1 correspondence between a char in the range U+0000-U+00FF

View File

@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class HttpKnownHeaderNames
{

View File

@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class HttpReasonPhrase
{

View File

@ -4,7 +4,7 @@
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// Redirect Status code numbers that need to be defined.

View File

@ -9,7 +9,7 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal unsafe class NativeRequestContext : IDisposable
{

View File

@ -9,7 +9,7 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// A duplex wrapper around RequestStream and ResponseStream.
// TODO: Consider merging RequestStream and ResponseStream instead.

View File

@ -15,7 +15,7 @@ using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
public sealed class Request
{

View File

@ -13,13 +13,13 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Logging;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
using OpaqueFunc = Func<IDictionary<string, object>, Task>;
public sealed class RequestContext : IDisposable
{
private OwinWebListener _server;
private WebListener _server;
private Request _request;
private Response _response;
private NativeRequestContext _memoryBlob;
@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Server.WebListener
private CancellationTokenRegistration? _disconnectRegistration;
private CancellationToken? _disconnectToken;
internal RequestContext(OwinWebListener httpListener, NativeRequestContext memoryBlob)
internal RequestContext(WebListener httpListener, NativeRequestContext memoryBlob)
{
// TODO: Verbose log
_server = httpListener;
@ -81,7 +81,7 @@ namespace Microsoft.AspNet.Server.WebListener
context.Abort();
}
internal OwinWebListener Server
internal WebListener Server
{
get
{
@ -194,7 +194,7 @@ namespace Microsoft.AspNet.Server.WebListener
// RequestQueueHandle may have been closed
}
}
/*
internal void OpaqueUpgrade(IDictionary<string, object> parameters, OpaqueFunc callback)
{
// Parameters are ignored for now
@ -245,5 +245,6 @@ namespace Microsoft.AspNet.Server.WebListener
return opaqueEnv;
}
*/
}
}

View File

@ -13,7 +13,7 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
[GeneratedCode("TextTemplatingFileGenerator", "")]
internal partial class RequestHeaders

View File

@ -69,7 +69,7 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Owin.Host.WebListener
namespace Microsoft.Net.Server
{
[GeneratedCode("TextTemplatingFileGenerator", "")]
internal partial class RequestHeaders

View File

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal partial class RequestHeaders : IDictionary<string, string[]>
{

View File

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal class RequestStream : Stream
{
@ -258,7 +258,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
OwinWebListener.SkipIOCPCallbackOnSuccess)
WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
asyncResult.IOCompleted(statusCode, bytesReturned);
@ -374,7 +374,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
OwinWebListener.SkipIOCPCallbackOnSuccess)
WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
asyncResult.Dispose();

View File

@ -10,7 +10,7 @@ using System.Diagnostics;
using System.Globalization;
using System.Text;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// 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

View File

@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
public sealed unsafe class Response
{
@ -288,7 +288,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
internal bool SentHeaders
public bool SentHeaders
{
get
{
@ -404,7 +404,7 @@ namespace Microsoft.AspNet.Server.WebListener
if (asyncResult != null &&
statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
OwinWebListener.SkipIOCPCallbackOnSuccess)
WebListener.SkipIOCPCallbackOnSuccess)
{
asyncResult.BytesSent = bytesSent;
// The caller will invoke IOCompleted
@ -431,7 +431,7 @@ namespace Microsoft.AspNet.Server.WebListener
if (asyncResult != null &&
statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
OwinWebListener.SkipIOCPCallbackOnSuccess)
WebListener.SkipIOCPCallbackOnSuccess)
{
asyncResult.BytesSent = bytesSent;
// The caller will invoke IOCompleted

View File

@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal class ResponseStream : Stream
{
@ -133,7 +133,7 @@ namespace Microsoft.AspNet.Server.WebListener
statusCode = _requestContext.Response.SendHeaders(null, asyncResult, flags, false);
}
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && OwinWebListener.SkipIOCPCallbackOnSuccess)
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
asyncResult.IOCompleted(statusCode);
@ -425,7 +425,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && OwinWebListener.SkipIOCPCallbackOnSuccess)
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
asyncResult.IOCompleted(statusCode, bytesSent);
@ -565,7 +565,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && OwinWebListener.SkipIOCPCallbackOnSuccess)
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
asyncResult.IOCompleted(statusCode, bytesSent);
@ -680,7 +680,7 @@ namespace Microsoft.AspNet.Server.WebListener
}
}
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && OwinWebListener.SkipIOCPCallbackOnSuccess)
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
asyncResult.IOCompleted(statusCode, bytesSent);

View File

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal unsafe class ResponseStreamAsyncResult : IAsyncResult, IDisposable
{

View File

@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal enum SslStatus : byte
{

View File

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Server.WebListener {
namespace Microsoft.Net.Server {
using System;

View File

@ -8,7 +8,7 @@ using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
// See the native HTTP_TIMEOUT_LIMIT_INFO structure documentation for additional information.
// http://msdn.microsoft.com/en-us/library/aa364661.aspx
@ -25,13 +25,13 @@ namespace Microsoft.AspNet.Server.WebListener
private static readonly int TimeoutLimitSize =
Marshal.SizeOf<UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO>();
#endif
private OwinWebListener _server;
private WebListener _server;
private int[] _timeouts;
private uint _minSendBytesPerSecond;
internal TimeoutManager(OwinWebListener context)
internal TimeoutManager(WebListener listener)
{
_server = context;
_server = listener;
// We have to maintain local state since we allow applications to set individual timeouts. Native Http
// API for setting timeouts expects all timeout values in every call so we have remember timeout values

View File

@ -7,7 +7,7 @@
using System;
using System.Globalization;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
public class UrlPrefix
{

View File

@ -7,7 +7,7 @@
using System;
using System.Globalization;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
internal static class ValidationHelper
{

View File

@ -17,14 +17,14 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Logging;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
using AppFunc = Func<object, Task>;
/// <summary>
/// An HTTP server wrapping the Http.Sys APIs that accepts requests and passes them on to the given OWIN application.
/// </summary>
public sealed class OwinWebListener : IDisposable
public sealed class WebListener : IDisposable
{
private const long DefaultRequestQueueLength = 1000; // Http.sys default.
#if NET45
@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Server.WebListener
// The native request queue
private long? _requestQueueLength;
public OwinWebListener()
public WebListener()
{
if (!UnsafeNclNativeMethods.HttpApi.Supported)
{
@ -754,7 +754,7 @@ namespace Microsoft.AspNet.Server.WebListener
return CancellationToken.None;
}
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && OwinWebListener.SkipIOCPCallbackOnSuccess)
if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && WebListener.SkipIOCPCallbackOnSuccess)
{
// IO operation completed synchronously - callback won't be called to signal completion.
// TODO: return a canceled token?
@ -920,11 +920,11 @@ namespace Microsoft.AspNet.Server.WebListener
private class ConnectionCancellation
{
private readonly OwinWebListener _parent;
private readonly WebListener _parent;
private volatile bool _initialized; // Must be volatile because initialization is synchronized
private CancellationToken _cancellationToken;
public ConnectionCancellation(OwinWebListener parent)
public ConnectionCancellation(WebListener parent)
{
_parent = parent;
}

View File

@ -9,7 +9,7 @@ using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Microsoft.AspNet.Server.WebListener
namespace Microsoft.Net.Server
{
[SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")]
public class WebListenerException : Win32Exception

View File

@ -6,6 +6,7 @@ using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.PipelineCore;
using Microsoft.Net.Server;
using Xunit;
namespace Microsoft.AspNet.Server.WebListener

View File

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.HttpFeature;
using Microsoft.AspNet.PipelineCore;
using Microsoft.Net.Server;
using Xunit;
namespace Microsoft.AspNet.Server.WebListener

View File

@ -11,6 +11,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.PipelineCore;
using Microsoft.Net.Server;
using Xunit;
namespace Microsoft.AspNet.Server.WebListener

View File

@ -2,6 +2,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.Net.Server;
namespace Microsoft.AspNet.Server.WebListener
{

View File

@ -10,6 +10,7 @@
"xunit.core": "2.0.0-aspnet-*",
"xunit.execution": "2.0.0-aspnet-*",
"Microsoft.AspNet.Server.WebListener" : "",
"Microsoft.Net.Server" : "",
"Microsoft.AspNet.Abstractions" : "0.1-alpha-*",
"Microsoft.AspNet.ConfigurationModel": "0.1-alpha-*",
"Microsoft.AspNet.HttpFeature" : "0.1-alpha-*",