From e19dea255b8818e5efe06f7631f8cfac84b31eb1 Mon Sep 17 00:00:00 2001 From: Chris R Date: Wed, 11 Jan 2017 12:00:19 -0800 Subject: [PATCH] Remove obsolete code --- samples/SelfHostServer/Startup.cs | 18 +---- .../HttpSysListener.cs | 2 +- .../HttpSysOptions.cs | 1 - .../NativeInterop/ContextAttribute.cs | 53 --------------- .../NativeInterop/HttpApi.cs | 68 +------------------ .../NativeInterop/SSPIHandle.cs | 31 --------- .../NativeInterop/SafeLoadLibrary.cs | 39 ----------- .../NativeInterop/SafeLocalFree.cs | 43 ------------ .../NativeInterop/SchProtocols.cs | 48 ------------- .../NativeInterop/SecurityStatus.cs | 51 -------------- .../NativeInterop/UnsafeNativeMethods.cs | 31 --------- .../RequestProcessing/Request.cs | 2 - .../RequestProcessing/Response.cs | 22 +----- .../RequestProcessing/ResponseBody.cs | 6 +- 14 files changed, 9 insertions(+), 406 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs delete mode 100644 src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs delete mode 100644 src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs delete mode 100644 src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs delete mode 100644 src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs delete mode 100644 src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs diff --git a/samples/SelfHostServer/Startup.cs b/samples/SelfHostServer/Startup.cs index f327d5bb71..4d2726587c 100644 --- a/samples/SelfHostServer/Startup.cs +++ b/samples/SelfHostServer/Startup.cs @@ -1,7 +1,4 @@ using System; -using System.Net.WebSockets; -using System.Text; -using System.Threading; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -29,19 +26,8 @@ namespace SelfHostServer app.Run(async context => { - if (context.WebSockets.IsWebSocketRequest) - { - byte[] bytes = Encoding.ASCII.GetBytes("Hello World: " + DateTime.Now); - WebSocket webSocket = await context.WebSockets.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 - { - context.Response.ContentType = "text/plain"; - await context.Response.WriteAsync("Hello world from " + context.Request.Host + " at " + DateTime.Now); - } + context.Response.ContentType = "text/plain"; + await context.Response.WriteAsync("Hello world from " + context.Request.Host + " at " + DateTime.Now); }); } diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs index a42c1f9af4..c2bea54052 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs @@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys &httpResponse, null, &dataWritten, - SafeLocalFree.Zero, + IntPtr.Zero, 0, SafeNativeOverlapped.Zero, IntPtr.Zero); diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs index 4d8e4ccfaf..2c97b4ef39 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs @@ -15,7 +15,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys // The native request queue private long _requestQueueLength = DefaultRequestQueueLength; private RequestQueue _requestQueue; - private ILogger _logger = NullLogger.Instance; public HttpSysOptions() { diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs deleted file mode 100644 index 6b2449091b..0000000000 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/ContextAttribute.cs +++ /dev/null @@ -1,53 +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.AspNetCore.Server.HttpSys -{ - internal enum ContextAttribute - { - // look into and - Sizes = 0x00, - Names = 0x01, - Lifespan = 0x02, - DceInfo = 0x03, - StreamSizes = 0x04, - // KeyInfo = 0x05, must not be used, see ConnectionInfo instead - Authority = 0x06, - // SECPKG_ATTR_PROTO_INFO = 7, - // SECPKG_ATTR_PASSWORD_EXPIRY = 8, - // SECPKG_ATTR_SESSION_KEY = 9, - PackageInfo = 0x0A, - // SECPKG_ATTR_USER_FLAGS = 11, - NegotiationInfo = 0x0C, - // SECPKG_ATTR_NATIVE_NAMES = 13, - // SECPKG_ATTR_FLAGS = 14, - // SECPKG_ATTR_USE_VALIDATED = 15, - // SECPKG_ATTR_CREDENTIAL_NAME = 16, - // SECPKG_ATTR_TARGET_INFORMATION = 17, - // SECPKG_ATTR_ACCESS_TOKEN = 18, - // SECPKG_ATTR_TARGET = 19, - // SECPKG_ATTR_AUTHENTICATION_ID = 20, - UniqueBindings = 0x19, - EndpointBindings = 0x1A, - ClientSpecifiedSpn = 0x1B, // SECPKG_ATTR_CLIENT_SPECIFIED_TARGET = 27 - RemoteCertificate = 0x53, - LocalCertificate = 0x54, - RootStore = 0x55, - IssuerListInfoEx = 0x59, - ConnectionInfo = 0x5A, - // SECPKG_ATTR_EAP_KEY_BLOCK 0x5b // returns SecPkgContext_EapKeyBlock - // SECPKG_ATTR_MAPPED_CRED_ATTR 0x5c // returns SecPkgContext_MappedCredAttr - // SECPKG_ATTR_SESSION_INFO 0x5d // returns SecPkgContext_SessionInfo - // SECPKG_ATTR_APP_DATA 0x5e // sets/returns SecPkgContext_SessionAppData - // SECPKG_ATTR_REMOTE_CERTIFICATES 0x5F // returns SecPkgContext_Certificates - // SECPKG_ATTR_CLIENT_CERT_POLICY 0x60 // sets SecPkgCred_ClientCertCtlPolicy - // SECPKG_ATTR_CC_POLICY_RESULT 0x61 // returns SecPkgContext_ClientCertPolicyResult - // SECPKG_ATTR_USE_NCRYPT 0x62 // Sets the CRED_FLAG_USE_NCRYPT_PROVIDER FLAG on cred group - // SECPKG_ATTR_LOCAL_CERT_INFO 0x63 // returns SecPkgContext_CertInfo - // SECPKG_ATTR_CIPHER_INFO 0x64 // returns new CNG SecPkgContext_CipherInfo - // SECPKG_ATTR_EAP_PRF_INFO 0x65 // sets SecPkgContext_EapPrfInfo - // SECPKG_ATTR_SUPPORTED_SIGNATURES 0x66 // returns SecPkgContext_SupportedSignatures - // SECPKG_ATTR_REMOTE_CERT_CHAIN 0x67 // returns PCCERT_CONTEXT - UiInfo = 0x68, // sets SEcPkgContext_UiInfo - } -} diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs index 71b8bfe746..fbea3b2fbc 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/HttpApi.cs @@ -28,10 +28,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys internal static extern uint HttpReceiveHttpRequest(SafeHandle requestQueueHandle, ulong requestId, uint flags, HTTP_REQUEST* pRequestBuffer, uint requestBufferLength, uint* pBytesReturned, SafeNativeOverlapped pOverlapped); [DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] - internal static extern uint HttpSendHttpResponse(SafeHandle requestQueueHandle, ulong requestId, uint flags, HTTP_RESPONSE_V2* pHttpResponse, HTTP_CACHE_POLICY* pCachePolicy, uint* pBytesSent, SafeLocalFree pRequestBuffer, uint requestBufferLength, SafeNativeOverlapped pOverlapped, IntPtr pLogData); + internal static extern uint HttpSendHttpResponse(SafeHandle requestQueueHandle, ulong requestId, uint flags, HTTP_RESPONSE_V2* pHttpResponse, HTTP_CACHE_POLICY* pCachePolicy, uint* pBytesSent, IntPtr pReserved1, uint Reserved2, SafeNativeOverlapped pOverlapped, IntPtr pLogData); [DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] - internal static extern uint HttpSendResponseEntityBody(SafeHandle requestQueueHandle, ulong requestId, uint flags, ushort entityChunkCount, HTTP_DATA_CHUNK* pEntityChunks, uint* pBytesSent, SafeLocalFree pRequestBuffer, uint requestBufferLength, SafeNativeOverlapped pOverlapped, IntPtr pLogData); + internal static extern uint HttpSendResponseEntityBody(SafeHandle requestQueueHandle, ulong requestId, uint flags, ushort entityChunkCount, HTTP_DATA_CHUNK* pEntityChunks, uint* pBytesSent, IntPtr pReserved1, uint Reserved2, SafeNativeOverlapped pOverlapped, IntPtr pLogData); [DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] internal static extern uint HttpCancelHttpRequest(SafeHandle requestQueueHandle, ulong requestId, IntPtr pOverlapped); @@ -633,65 +633,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys HTTP_AUTH_ENABLE_KERBEROS = 0x00000010, } - private const int HttpHeaderRequestMaximum = (int)HttpSysRequestHeader.UserAgent + 1; - private const int HttpHeaderResponseMaximum = (int)HttpSysResponseHeader.WwwAuthenticate + 1; - - internal static class HTTP_REQUEST_HEADER_ID - { - internal static string ToString(int position) - { - return _strings[position]; - } - - private static string[] _strings = - { - "Cache-Control", - "Connection", - "Date", - "Keep-Alive", - "Pragma", - "Trailer", - "Transfer-Encoding", - "Upgrade", - "Via", - "Warning", - - "Allow", - "Content-Length", - "Content-Type", - "Content-Encoding", - "Content-Language", - "Content-Location", - "Content-MD5", - "Content-Range", - "Expires", - "Last-Modified", - - "Accept", - "Accept-Charset", - "Accept-Encoding", - "Accept-Language", - "Authorization", - "Cookie", - "Expect", - "From", - "Host", - "If-Match", - - "If-Modified-Since", - "If-None-Match", - "If-Range", - "If-Unmodified-Since", - "Max-Forwards", - "Proxy-Authorization", - "Referer", - "Range", - "Te", - "Translate", - "User-Agent", - }; - } - internal static class HTTP_RESPONSE_HEADER_ID { private static string[] _strings = @@ -748,11 +689,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys return _lookupTable.TryGetValue(HeaderName, out index) ? index : -1; } - internal static string ToString(int position) - { - return _strings[position]; - } - internal enum Enum { HttpHeaderCacheControl = 0, // general-header [section 4.5] diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs deleted file mode 100644 index 8a6801a3b6..0000000000 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SSPIHandle.cs +++ /dev/null @@ -1,31 +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.Runtime.InteropServices; - -namespace Microsoft.AspNetCore.Server.HttpSys -{ - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct SSPIHandle - { - private IntPtr handleHi; - private IntPtr handleLo; - - public bool IsZero - { - get { return handleHi == IntPtr.Zero && handleLo == IntPtr.Zero; } - } - - internal void SetToInvalid() - { - handleHi = IntPtr.Zero; - handleLo = IntPtr.Zero; - } - - public override string ToString() - { - return handleHi.ToString("x") + ":" + handleLo.ToString("x"); - } - } -} diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs deleted file mode 100644 index c880a7f005..0000000000 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLoadLibrary.cs +++ /dev/null @@ -1,39 +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.Win32.SafeHandles; - -namespace Microsoft.AspNetCore.Server.HttpSys -{ - internal sealed class SafeLoadLibrary : SafeHandleZeroOrMinusOneIsInvalid - { - private const string KERNEL32 = "kernel32.dll"; - - public static readonly SafeLoadLibrary Zero = new SafeLoadLibrary(false); - - private SafeLoadLibrary() - : base(true) - { - } - - private SafeLoadLibrary(bool ownsHandle) - : base(ownsHandle) - { - } - - public static unsafe SafeLoadLibrary LoadLibraryEx(string library) - { - SafeLoadLibrary result = UnsafeNclNativeMethods.SafeNetHandles.LoadLibraryExW(library, null, 0); - if (result.IsInvalid) - { - result.SetHandleAsInvalid(); - } - return result; - } - - protected override bool ReleaseHandle() - { - return UnsafeNclNativeMethods.SafeNetHandles.FreeLibrary(handle); - } - } -} diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs deleted file mode 100644 index 06824eb438..0000000000 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SafeLocalFree.cs +++ /dev/null @@ -1,43 +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.Win32.SafeHandles; - -namespace Microsoft.AspNetCore.Server.HttpSys -{ - internal sealed class SafeLocalFree : SafeHandleZeroOrMinusOneIsInvalid - { - private const int LMEM_FIXED = 0; - private const int NULL = 0; - - // This returned handle cannot be modified by the application. - public static SafeLocalFree Zero = new SafeLocalFree(false); - - private SafeLocalFree() - : base(true) - { - } - - private SafeLocalFree(bool ownsHandle) - : base(ownsHandle) - { - } - - public static SafeLocalFree LocalAlloc(int cb) - { - SafeLocalFree result = UnsafeNclNativeMethods.SafeNetHandles.LocalAlloc(LMEM_FIXED, (UIntPtr)cb); - if (result.IsInvalid) - { - result.SetHandleAsInvalid(); - throw new OutOfMemoryException(); - } - return result; - } - - protected override bool ReleaseHandle() - { - return UnsafeNclNativeMethods.SafeNetHandles.LocalFree(handle) == IntPtr.Zero; - } - } -} diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs deleted file mode 100644 index 591d585172..0000000000 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SchProtocols.cs +++ /dev/null @@ -1,48 +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.AspNetCore.Server.HttpSys -{ - using System; - using System.Globalization; - using System.Runtime.InteropServices; - - // From Schannel.h - [Flags] - internal enum SchProtocols - { - Zero = 0, - PctClient = 0x00000002, - PctServer = 0x00000001, - Pct = (PctClient | PctServer), - Ssl2Client = 0x00000008, - Ssl2Server = 0x00000004, - Ssl2 = (Ssl2Client | Ssl2Server), - Ssl3Client = 0x00000020, - Ssl3Server = 0x00000010, - Ssl3 = (Ssl3Client | Ssl3Server), - Tls10Client = 0x00000080, - Tls10Server = 0x00000040, - Tls10 = (Tls10Client | Tls10Server), - Tls11Client = 0x00000200, - Tls11Server = 0x00000100, - Tls11 = (Tls11Client | Tls11Server), - Tls12Client = 0x00000800, - Tls12Server = 0x00000400, - Tls12 = (Tls12Client | Tls12Server), - Ssl3Tls = (Ssl3 | Tls10), - UniClient = unchecked((int)0x80000000), - UniServer = 0x40000000, - Unified = (UniClient | UniServer), - ClientMask = (PctClient | Ssl2Client | Ssl3Client | Tls10Client | Tls11Client | Tls12Client | UniClient), - ServerMask = (PctServer | Ssl2Server | Ssl3Server | Tls10Server | Tls11Server | Tls12Server | UniServer) - } - - [StructLayout(LayoutKind.Sequential)] - internal struct Bindings - { - // see SecPkgContext_Bindings in - internal int BindingsLength; - internal IntPtr bindings; - } -} diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs deleted file mode 100644 index c46b114d8d..0000000000 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/SecurityStatus.cs +++ /dev/null @@ -1,51 +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.AspNetCore.Server.HttpSys -{ - internal enum SecurityStatus - { - // Success / Informational - OK = 0x00000000, - ContinueNeeded = unchecked((int)0x00090312), - CompleteNeeded = unchecked((int)0x00090313), - CompAndContinue = unchecked((int)0x00090314), - ContextExpired = unchecked((int)0x00090317), - CredentialsNeeded = unchecked((int)0x00090320), - Renegotiate = unchecked((int)0x00090321), - - // Errors - OutOfMemory = unchecked((int)0x80090300), - InvalidHandle = unchecked((int)0x80090301), - Unsupported = unchecked((int)0x80090302), - TargetUnknown = unchecked((int)0x80090303), - InternalError = unchecked((int)0x80090304), - PackageNotFound = unchecked((int)0x80090305), - NotOwner = unchecked((int)0x80090306), - CannotInstall = unchecked((int)0x80090307), - InvalidToken = unchecked((int)0x80090308), - CannotPack = unchecked((int)0x80090309), - QopNotSupported = unchecked((int)0x8009030A), - NoImpersonation = unchecked((int)0x8009030B), - LogonDenied = unchecked((int)0x8009030C), - UnknownCredentials = unchecked((int)0x8009030D), - NoCredentials = unchecked((int)0x8009030E), - MessageAltered = unchecked((int)0x8009030F), - OutOfSequence = unchecked((int)0x80090310), - NoAuthenticatingAuthority = unchecked((int)0x80090311), - IncompleteMessage = unchecked((int)0x80090318), - IncompleteCredentials = unchecked((int)0x80090320), - BufferNotEnough = unchecked((int)0x80090321), - WrongPrincipal = unchecked((int)0x80090322), - TimeSkew = unchecked((int)0x80090324), - UntrustedRoot = unchecked((int)0x80090325), - IllegalMessage = unchecked((int)0x80090326), - CertUnknown = unchecked((int)0x80090327), - CertExpired = unchecked((int)0x80090328), - AlgorithmMismatch = unchecked((int)0x80090331), - SecurityQosFailed = unchecked((int)0x80090332), - SmartcardLogonRequired = unchecked((int)0x8009033E), - UnsupportedPreauth = unchecked((int)0x80090343), - BadBinding = unchecked((int)0x80090346) - } -} diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs index e8a8daa505..c20f95f664 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/NativeInterop/UnsafeNativeMethods.cs @@ -99,16 +99,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys internal static extern int FreeContextBuffer( [In] IntPtr contextBuffer); -#if NETSTANDARD1_3 - [DllImport(sspicli_LIB, ExactSpelling = true, SetLastError = true)] -#else - [DllImport(SECUR32, ExactSpelling = true, SetLastError = true)] -#endif - internal static unsafe extern int QueryContextAttributesW( - ref SSPIHandle contextHandle, - [In] ContextAttribute attribute, - [In] void* buffer); - #if NETSTANDARD1_3 [DllImport(api_ms_win_core_handle_LIB, ExactSpelling = true, SetLastError = true)] #else @@ -116,13 +106,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys #endif internal static extern bool CloseHandle(IntPtr handle); -#if NETSTANDARD1_3 - [DllImport(api_ms_win_core_heap_obsolete_LIB, ExactSpelling = true, SetLastError = true)] -#else - [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] -#endif - internal static extern SafeLocalFree LocalAlloc(int uFlags, UIntPtr sizetdwBytes); - #if NETSTANDARD1_3 [DllImport(api_ms_win_core_heap_obsolete_LIB, EntryPoint = "LocalAlloc", SetLastError = true)] #else @@ -137,20 +120,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] #endif internal static extern IntPtr LocalFree(IntPtr handle); - -#if NETSTANDARD1_3 - [DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] -#else - [DllImport(KERNEL32, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] -#endif - internal static extern unsafe SafeLoadLibrary LoadLibraryExW([In] string lpwLibFileName, [In] void* hFile, [In] uint dwFlags); - -#if NETSTANDARD1_3 - [DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, SetLastError = true)] -#else - [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] -#endif - internal static extern unsafe bool FreeLibrary([In] IntPtr hModule); } // from tokenbinding.h diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs index 7741232aa6..78ed055204 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Request.cs @@ -214,8 +214,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys // HTTP.Sys allows you to upgrade anything to opaque unless content-length > 0 or chunked are specified. internal bool IsUpgradable => !HasEntityBody && ComNetOS.IsWin8orLater; - public string ContentType => Headers[HttpKnownHeaderNames.ContentType]; - internal ClaimsPrincipal User { get; } // Populates the client certificate. The result may be null if there is no client cert. diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs index 9936d817ee..d9f095846e 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/Response.cs @@ -191,26 +191,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys } } - public string ContentType - { - get - { - return Headers[HttpKnownHeaderNames.ContentType]; - } - set - { - CheckResponseStarted(); - if (string.IsNullOrEmpty(value)) - { - Headers.Remove(HttpKnownHeaderNames.ContentType); - } - else - { - Headers[HttpKnownHeaderNames.ContentType] = value; - } - } - } - /// /// Enable kernel caching for the response with the given timeout. Http.Sys determines if the response /// can be cached. @@ -368,7 +348,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys pResponse, &cachePolicy, &bytesSent, - SafeLocalFree.Zero, + IntPtr.Zero, 0, asyncResult == null ? SafeNativeOverlapped.Zero : asyncResult.NativeOverlapped, IntPtr.Zero); diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs index 56a104a800..e34f3184e5 100644 --- a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/ResponseBody.cs @@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys (ushort)dataChunks.Length, pDataChunks, null, - SafeLocalFree.Zero, + IntPtr.Zero, 0, SafeNativeOverlapped.Zero, IntPtr.Zero); @@ -305,7 +305,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys asyncResult.DataChunkCount, asyncResult.DataChunks, &bytesSent, - SafeLocalFree.Zero, + IntPtr.Zero, 0, asyncResult.NativeOverlapped, IntPtr.Zero); @@ -600,7 +600,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys asyncResult.DataChunkCount, asyncResult.DataChunks, &bytesSent, - SafeLocalFree.Zero, + IntPtr.Zero, 0, asyncResult.NativeOverlapped, IntPtr.Zero);