From 82126948742cf81f66cec7a1d575849ac34d2d82 Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Tue, 24 May 2016 21:08:49 -0700 Subject: [PATCH] Add RawTarget property to IHttpRequestFeature (#596). --- .../IHttpRequestFeature.cs | 11 +++++++++++ .../Features/HttpRequestFeature.cs | 2 ++ .../OwinFeatureCollection.cs | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/src/Microsoft.AspNetCore.Http.Features/IHttpRequestFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IHttpRequestFeature.cs index 16511caa74..5a84221b57 100644 --- a/src/Microsoft.AspNetCore.Http.Features/IHttpRequestFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/IHttpRequestFeature.cs @@ -48,6 +48,17 @@ namespace Microsoft.AspNetCore.Http.Features /// string QueryString { get; set; } + /// + /// The request target as it was sent in the HTTP request. This property contains the + /// raw path and full query, as well as other request targets such as * for OPTIONS + /// requests (https://tools.ietf.org/html/rfc7230#section-5.3). + /// + /// + /// This property is not used internally for routing or authorization decisions. It has not + /// been UrlDecoded and care should be taken in its use. + /// + string RawTarget { get; set; } + /// /// Headers included in the request, aggregated by header name. The values are not split /// or merged across header lines. E.g. The following headers: diff --git a/src/Microsoft.AspNetCore.Http/Features/HttpRequestFeature.cs b/src/Microsoft.AspNetCore.Http/Features/HttpRequestFeature.cs index c23051f6a3..b8b667bf4e 100644 --- a/src/Microsoft.AspNetCore.Http/Features/HttpRequestFeature.cs +++ b/src/Microsoft.AspNetCore.Http/Features/HttpRequestFeature.cs @@ -17,6 +17,7 @@ namespace Microsoft.AspNetCore.Http.Features PathBase = string.Empty; Path = string.Empty; QueryString = string.Empty; + RawTarget = string.Empty; } public string Protocol { get; set; } @@ -25,6 +26,7 @@ namespace Microsoft.AspNetCore.Http.Features public string PathBase { get; set; } public string Path { get; set; } public string QueryString { get; set; } + public string RawTarget { get; set; } public IHeaderDictionary Headers { get; set; } public Stream Body { get; set; } } diff --git a/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs b/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs index 6809d5c4f2..4838b99f5c 100644 --- a/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs +++ b/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs @@ -102,6 +102,12 @@ namespace Microsoft.AspNetCore.Owin set { Prop(OwinConstants.RequestQueryString, Utilities.RemoveQuestionMark(value)); } } + string IHttpRequestFeature.RawTarget + { + get { return string.Empty; } + set { throw new NotSupportedException(); } + } + IHeaderDictionary IHttpRequestFeature.Headers { get { return Utilities.MakeHeaderDictionary(Prop>(OwinConstants.RequestHeaders)); }