From 518e1b8dba036f0011fa24c138ec31526fea26c0 Mon Sep 17 00:00:00 2001 From: Ruoyun Tang Date: Wed, 12 Jul 2023 14:36:49 +0800 Subject: [PATCH 1/5] close #365: add HttpCapabilitiesBase.Cookies --- .../Configuration/HttpCapabilitiesBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs index af664ae5e9..7bad5463cb 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Globalization; +using System.Net; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.SystemWebAdapters; using Microsoft.Extensions.DependencyInjection; From c5b5c6ee27f9d9e9f979ac846159f7eee7d1f089 Mon Sep 17 00:00:00 2001 From: Ruoyun Tang Date: Thu, 13 Jul 2023 10:02:52 +0800 Subject: [PATCH 2/5] remove unnecessary using --- .../Configuration/HttpCapabilitiesBase.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs index 7bad5463cb..af664ae5e9 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Configuration/HttpCapabilitiesBase.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Globalization; -using System.Net; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.SystemWebAdapters; using Microsoft.Extensions.DependencyInjection; From 048f7976ba6199008209cdf57fa631e981f68b27 Mon Sep 17 00:00:00 2001 From: Ruoyun Tang Date: Wed, 26 Jul 2023 17:27:37 +0800 Subject: [PATCH 3/5] add httpResponse.HeadersWritten --- src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs index e3eeb2dc7d..dbbf3b3af2 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs @@ -175,6 +175,11 @@ public bool HeadersWritten get => _response.HasStarted; } + public bool HeadersWritten + { + get => _response.HasStarted; + } + public string? RedirectLocation { get => _response.Headers.Location; From f5193110a2752f8d01ba0785b70a3ab4954a3b2c Mon Sep 17 00:00:00 2001 From: Ruoyun Tang Date: Thu, 24 Aug 2023 16:54:30 +0800 Subject: [PATCH 4/5] add IHttpRequestPathFeature.CurrentExecutionFilePath --- .../HttpRequestInputStreamFeature.cs | 2 ++ .../Adapters/IHttpRequestPathFeature.cs | 2 ++ .../Generated/Ref.Standard.cs | 1 + src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs | 2 ++ 4 files changed, 7 insertions(+) diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/HttpRequestInputStreamFeature.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/HttpRequestInputStreamFeature.cs index c343be74ea..352e57873d 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/HttpRequestInputStreamFeature.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/HttpRequestInputStreamFeature.cs @@ -215,6 +215,8 @@ void IHttpRequestPathFeature.Rewrite(string filePath, string pathInfo, string? q string IHttpRequestPathFeature.RawUrl => _other.RawTarget; + string IHttpRequestPathFeature.CurrentExecutionFilePath => _filePath ?? Path; + internal static class AspNetCoreTempDirectory { private static string? _tempDirectory; diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IHttpRequestPathFeature.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IHttpRequestPathFeature.cs index ec66030b33..f14a3d02fd 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IHttpRequestPathFeature.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IHttpRequestPathFeature.cs @@ -13,6 +13,8 @@ internal interface IHttpRequestPathFeature string RawUrl { get; } + string CurrentExecutionFilePath { get; } + void Rewrite(string filePath, string pathInfo, string? queryString, bool setClientFilePath); } diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs index 65c4e06ec9..a839b6bd8e 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs @@ -337,6 +337,7 @@ internal HttpRequest() { } public int ContentLength { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public string ContentType { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} set { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Web.HttpCookieCollection Cookies { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } + public string CurrentExecutionFilePath { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public string FilePath { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Web.HttpFileCollection Files { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Collections.Specialized.NameValueCollection Form { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs index fde8d21d34..e9a2625541 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs @@ -52,6 +52,8 @@ internal HttpRequest(HttpRequestCore request) [SuppressMessage("Design", "CA1056:URI-like properties should not be strings", Justification = Constants.ApiFromAspNet)] public string RawUrl => _request.HttpContext.Features.GetRequired().RawUrl; + public string CurrentExecutionFilePath => _request.HttpContext.Features.GetRequired().CurrentExecutionFilePath; + public NameValueCollection Headers => _headers ??= _request.Headers.ToNameValueCollection(); public Uri Url => new(_request.GetEncodedUrl()); From ed33a2891cd75732d36f69345a75de4f935ccbf6 Mon Sep 17 00:00:00 2001 From: Ruoyun Tang Date: Mon, 28 Aug 2023 17:12:21 +0800 Subject: [PATCH 5/5] remove conflicts after rebase --- src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs index dbbf3b3af2..e3eeb2dc7d 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpResponse.cs @@ -175,11 +175,6 @@ public bool HeadersWritten get => _response.HasStarted; } - public bool HeadersWritten - { - get => _response.HasStarted; - } - public string? RedirectLocation { get => _response.Headers.Location;