From f0eab4410aa710357f9b294f3bf460fc3c1f5cba Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 9 Apr 2018 15:20:28 -0700 Subject: [PATCH] Cleanup --- .../NativeIISSample/PlaintextMiddleware.cs | 51 ------------------- samples/NativeIISSample/Startup.cs | 2 - src/IISLib/macros.h | 7 --- 3 files changed, 60 deletions(-) delete mode 100644 samples/NativeIISSample/PlaintextMiddleware.cs diff --git a/samples/NativeIISSample/PlaintextMiddleware.cs b/samples/NativeIISSample/PlaintextMiddleware.cs deleted file mode 100644 index c7915a968b..0000000000 --- a/samples/NativeIISSample/PlaintextMiddleware.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. - -using System; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; - -namespace Benchmarks.Middleware -{ - public class PlaintextMiddleware - { - private static readonly PathString _path = new PathString("/plaintext"); - private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!"); - - private readonly RequestDelegate _next; - - public PlaintextMiddleware(RequestDelegate next) - { - _next = next; - } - - public Task Invoke(HttpContext httpContext) - { - if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal)) - { - return WriteResponse(httpContext.Response); - } - - return _next(httpContext); - } - - public static Task WriteResponse(HttpResponse response) - { - var payloadLength = _helloWorldPayload.Length; - response.StatusCode = 200; - response.ContentType = "text/plain"; - response.ContentLength = payloadLength; - return response.Body.WriteAsync(_helloWorldPayload, 0, payloadLength); - } - } - - public static class PlaintextMiddlewareExtensions - { - public static IApplicationBuilder UsePlainText(this IApplicationBuilder builder) - { - return builder.UseMiddleware(); - } - } -} diff --git a/samples/NativeIISSample/Startup.cs b/samples/NativeIISSample/Startup.cs index 59af05d747..1a41f5a848 100644 --- a/samples/NativeIISSample/Startup.cs +++ b/samples/NativeIISSample/Startup.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using Benchmarks.Middleware; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -19,7 +18,6 @@ namespace NativeIISSample // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IAuthenticationSchemeProvider authSchemeProvider) { - app.UsePlainText(); app.Run(async (context) => { context.Response.ContentType = "text/plain"; diff --git a/src/IISLib/macros.h b/src/IISLib/macros.h index 6aa5b1a821..960f663a98 100644 --- a/src/IISLib/macros.h +++ b/src/IISLib/macros.h @@ -60,11 +60,4 @@ SAFEIsDigit(UCHAR c) return isdigit( c ); } -#define __RETURN_GLE_FAIL(str) return HRESULT_FROM_WIN32(GetLastError()); -#define __RETURN_HR_FAIL(hr, str) do { HRESULT __hr = (hr); return __hr; } while (0, 0) - -#define RETURN_IF_FAILED(hr) do { HRESULT __hrRet = hr; if (FAILED(__hrRet)) { __RETURN_HR_FAIL(__hrRet, #hr); }} while (0, 0) -#define RETURN_LAST_ERROR_IF_NULL(ptr) do { if ((ptr) == nullptr) { __RETURN_GLE_FAIL(#ptr); }} while (0, 0) -#define RETURN_IF_HANDLE_INVALID(handle) do { HANDLE __hRet = (handle); if (__hRet == INVALID_HANDLE_VALUE) { __RETURN_GLE_FAIL(#handle); }} while (0, 0) - #endif // _MACROS_H