Reduce boxing in RedirectRule.cs (#8988)

This commit is contained in:
Kirill Rakhman 2019-04-02 19:04:07 +02:00 committed by Justin Kotalik
parent f4c61de490
commit 3cc3ab00c9
1 changed files with 2 additions and 2 deletions

View File

@ -74,11 +74,11 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
QueryString.FromUriComponent(
newPath.Substring(split)));
// not using the HttpContext.Response.redirect here because status codes may be 301, 302, 307, 308
response.Headers[HeaderNames.Location] = pathBase + newPath.Substring(0, split) + query;
response.Headers[HeaderNames.Location] = pathBase + newPath.Substring(0, split) + query.ToUriComponent();
}
else
{
response.Headers[HeaderNames.Location] = pathBase + newPath + context.HttpContext.Request.QueryString;
response.Headers[HeaderNames.Location] = pathBase + newPath + context.HttpContext.Request.QueryString.ToUriComponent();
}
context.Logger?.RedirectedRequest(newPath);