From 4c3996f8241df09ad811008111440e8c6cf20c9d Mon Sep 17 00:00:00 2001 From: shnja Date: Tue, 5 Mar 2019 17:39:37 -0500 Subject: [PATCH] Use Request.Scheme instead of Protocol (#7911) --- src/Mvc/Mvc.Core/src/UrlHelperExtensions.cs | 4 ++-- .../Mvc.Core/test/Routing/UrlHelperExtensionsTest.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Mvc/Mvc.Core/src/UrlHelperExtensions.cs b/src/Mvc/Mvc.Core/src/UrlHelperExtensions.cs index 7767263b9d..2a1d43d963 100644 --- a/src/Mvc/Mvc.Core/src/UrlHelperExtensions.cs +++ b/src/Mvc/Mvc.Core/src/UrlHelperExtensions.cs @@ -572,7 +572,7 @@ namespace Microsoft.AspNetCore.Mvc if (protocol == null) { - protocol = httpContext.Request.Protocol; + protocol = httpContext.Request.Scheme; } if (host == null) @@ -624,7 +624,7 @@ namespace Microsoft.AspNetCore.Mvc if (protocol == null) { - protocol = httpContext.Request.Protocol; + protocol = httpContext.Request.Scheme; } if (host == null) diff --git a/src/Mvc/Mvc.Core/test/Routing/UrlHelperExtensionsTest.cs b/src/Mvc/Mvc.Core/test/Routing/UrlHelperExtensionsTest.cs index 2f170b1c56..02ebfc549b 100644 --- a/src/Mvc/Mvc.Core/test/Routing/UrlHelperExtensionsTest.cs +++ b/src/Mvc/Mvc.Core/test/Routing/UrlHelperExtensionsTest.cs @@ -615,7 +615,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test.Routing { Request = { - Protocol = expectedProtocol, + Scheme = expectedProtocol, Host = new HostString(expectedHost), } }; @@ -650,7 +650,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test.Routing { Request = { - Protocol = "http://", + Scheme = "http://", Host = new HostString(expectedHost), } }; @@ -685,7 +685,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test.Routing { Request = { - Protocol = expectedProtocol, + Scheme = expectedProtocol, Host = new HostString("www.asp.net"), } }; @@ -723,7 +723,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test.Routing { Request = { - Protocol = expectedProtocol, + Scheme = expectedProtocol, Host = new HostString(expectedHost), } }, @@ -771,7 +771,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test.Routing { Request = { - Protocol = "http://", + Scheme = "http://", Host = new HostString(expectedHost), } }, @@ -819,7 +819,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test.Routing { Request = { - Protocol = expectedProtocol, + Scheme = expectedProtocol, Host = new HostString("www.asp.net"), } },