diff --git a/src/Microsoft.Net.Http.Server/AuthenticationManager.cs b/src/Microsoft.Net.Http.Server/AuthenticationManager.cs index ea67513993..76377dd63c 100644 --- a/src/Microsoft.Net.Http.Server/AuthenticationManager.cs +++ b/src/Microsoft.Net.Http.Server/AuthenticationManager.cs @@ -38,13 +38,8 @@ namespace Microsoft.Net.Http.Server /// public sealed class AuthenticationManager { -#if DNXCORE50 private static readonly int AuthInfoSize = Marshal.SizeOf(); -#else - private static readonly int AuthInfoSize = - Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_AUTHENTICATION_INFO)); -#endif private WebListener _server; private AuthenticationSchemes _authSchemes; diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs index 18e44a4cd2..17ad8688ed 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/Response.cs @@ -667,12 +667,7 @@ namespace Microsoft.Net.Http.Server } knownHeaderInfo[_nativeResponse.ResponseInfoCount].Type = HttpApi.HTTP_RESPONSE_INFO_TYPE.HttpResponseInfoTypeMultipleKnownHeaders; - knownHeaderInfo[_nativeResponse.ResponseInfoCount].Length = -#if DNXCORE50 - (uint)Marshal.SizeOf(); -#else - (uint)Marshal.SizeOf(typeof(HttpApi.HTTP_MULTIPLE_KNOWN_HEADERS)); -#endif + knownHeaderInfo[_nativeResponse.ResponseInfoCount].Length = (uint)Marshal.SizeOf(); HttpApi.HTTP_MULTIPLE_KNOWN_HEADERS header = new HttpApi.HTTP_MULTIPLE_KNOWN_HEADERS(); diff --git a/src/Microsoft.Net.Http.Server/TimeoutManager.cs b/src/Microsoft.Net.Http.Server/TimeoutManager.cs index 6ef2ca5b7a..9f1ba26423 100644 --- a/src/Microsoft.Net.Http.Server/TimeoutManager.cs +++ b/src/Microsoft.Net.Http.Server/TimeoutManager.cs @@ -35,13 +35,9 @@ namespace Microsoft.Net.Http.Server /// public sealed class TimeoutManager { -#if DNXCORE50 private static readonly int TimeoutLimitSize = Marshal.SizeOf(); -#else - private static readonly int TimeoutLimitSize = - Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO)); -#endif + private WebListener _server; private int[] _timeouts; private uint _minSendBytesPerSecond; diff --git a/src/Microsoft.Net.Http.Server/WebListener.cs b/src/Microsoft.Net.Http.Server/WebListener.cs index fa8099e275..c0e4d0676b 100644 --- a/src/Microsoft.Net.Http.Server/WebListener.cs +++ b/src/Microsoft.Net.Http.Server/WebListener.cs @@ -41,18 +41,10 @@ namespace Microsoft.Net.Http.Server public sealed class WebListener : IDisposable { private const long DefaultRequestQueueLength = 1000; // Http.sys default. -#if DNXCORE50 private static readonly int RequestChannelBindStatusSize = Marshal.SizeOf(); private static readonly int BindingInfoSize = Marshal.SizeOf(); -#else - private static readonly Type ChannelBindingStatusType = typeof(UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_CHANNEL_BIND_STATUS); - private static readonly int RequestChannelBindStatusSize = - Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_CHANNEL_BIND_STATUS)); - private static readonly int BindingInfoSize = - Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO)); -#endif // 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 @@ -244,7 +236,7 @@ namespace Microsoft.Net.Http.Server long length = _requestQueueLength.Value; uint result = UnsafeNclNativeMethods.HttpApi.HttpSetRequestQueueProperty(_requestQueueHandle, UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_PROPERTY.HttpServerQueueLengthProperty, - new IntPtr((void*)&length), (uint)Marshal.SizeOf(length), 0, IntPtr.Zero); + new IntPtr((void*)&length), (uint)Marshal.SizeOf(), 0, IntPtr.Zero); if (result != 0) { @@ -766,11 +758,7 @@ namespace Microsoft.Net.Http.Server knownHeaderInfo[httpResponse.ResponseInfoCount].Type = UnsafeNclNativeMethods.HttpApi.HTTP_RESPONSE_INFO_TYPE.HttpResponseInfoTypeMultipleKnownHeaders; knownHeaderInfo[httpResponse.ResponseInfoCount].Length = -#if DNXCORE50 - (uint)Marshal.SizeOf(); -#else - (uint)Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_MULTIPLE_KNOWN_HEADERS)); -#endif + (uint)Marshal.SizeOf(); UnsafeNclNativeMethods.HttpApi.HTTP_MULTIPLE_KNOWN_HEADERS header = new UnsafeNclNativeMethods.HttpApi.HTTP_MULTIPLE_KNOWN_HEADERS(); @@ -858,11 +846,7 @@ namespace Microsoft.Net.Http.Server private static int GetTokenOffsetFromBlob(IntPtr blob) { Debug.Assert(blob != IntPtr.Zero); -#if DNXCORE50 IntPtr tokenPointer = Marshal.ReadIntPtr(blob, (int)Marshal.OffsetOf("ChannelToken")); -#else - IntPtr tokenPointer = Marshal.ReadIntPtr(blob, (int)Marshal.OffsetOf(ChannelBindingStatusType, "ChannelToken")); -#endif Debug.Assert(tokenPointer != IntPtr.Zero); return (int)IntPtrHelper.Subtract(tokenPointer, blob); } @@ -870,11 +854,7 @@ namespace Microsoft.Net.Http.Server private static int GetTokenSizeFromBlob(IntPtr blob) { Debug.Assert(blob != IntPtr.Zero); -#if DNXCORE50 return Marshal.ReadInt32(blob, (int)Marshal.OffsetOf("ChannelTokenSize")); -#else - return Marshal.ReadInt32(blob, (int)Marshal.OffsetOf(ChannelBindingStatusType, "ChannelTokenSize")); -#endif } internal ChannelBinding GetChannelBinding(ulong connectionId, bool isSecureConnection) diff --git a/src/Microsoft.Net.Http.Server/project.json b/src/Microsoft.Net.Http.Server/project.json index 5e7160e13d..4859950613 100644 --- a/src/Microsoft.Net.Http.Server/project.json +++ b/src/Microsoft.Net.Http.Server/project.json @@ -9,7 +9,7 @@ "allowUnsafe": true }, "frameworks": { - "net45": { }, + "net451": { }, "dnx451": { }, "dnxcore50": { "dependencies": { diff --git a/src/Microsoft.Net.WebSockets/WebSocketBuffer.cs b/src/Microsoft.Net.WebSockets/WebSocketBuffer.cs index 8230117bc6..e71d463f7f 100644 --- a/src/Microsoft.Net.WebSockets/WebSocketBuffer.cs +++ b/src/Microsoft.Net.WebSockets/WebSocketBuffer.cs @@ -50,13 +50,8 @@ namespace Microsoft.Net.WebSockets public const int MinSendBufferSize = 16; internal const int MinReceiveBufferSize = 256; internal const int MaxBufferSize = 64 * 1024; -#if DNXCORE50 private static readonly int SizeOfUInt = Marshal.SizeOf(); private static readonly int SizeOfBool = Marshal.SizeOf(); -#else - private static readonly int SizeOfUInt = Marshal.SizeOf(typeof(uint)); - private static readonly int SizeOfBool = Marshal.SizeOf(typeof(bool)); -#endif private static readonly int PropertyBufferSize = (2 * SizeOfUInt) + SizeOfBool + IntPtr.Size; private readonly int _ReceiveBufferSize; diff --git a/src/Microsoft.Net.WebSockets/project.json b/src/Microsoft.Net.WebSockets/project.json index 9c05f0f4b9..50fa32a2e1 100644 --- a/src/Microsoft.Net.WebSockets/project.json +++ b/src/Microsoft.Net.WebSockets/project.json @@ -5,7 +5,8 @@ }, "compilationOptions": { "allowUnsafe": true }, "frameworks": { - "net45": { }, + "net451": { }, + "dnx451": { }, "dnxcore50": { "dependencies": { "System.Collections": "4.0.10-beta-*",