Commit 10ad99b8 authored by Arthur Sonzogni's avatar Arthur Sonzogni Committed by Commit Bot

UpgradeInsecureRequest: Stop upgrading port manually.

The GURL class upgrades the port from 80 to 443 when asked to replace
the URL's scheme from 'http' to 'https'. Doing it manually was
pointless.

Bug: none.
Change-Id: I12aaa7f0a243134a3810ed871e73b7473acfad5a
Reviewed-on: https://chromium-review.googlesource.com/1107931Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569265}
parent 90057f85
......@@ -65,11 +65,11 @@ bool CSPContext::ShouldModifyRequestUrlForCsp(
}
void CSPContext::ModifyRequestUrlForCsp(GURL* url) {
if (url->scheme() == "http") {
if (url->SchemeIs(url::kHttpScheme)) {
// Updating the URL's scheme also implicitly updates the URL's port from 80
// to 443 if needed.
GURL::Replacements replacements;
replacements.SetSchemeStr("https");
if (url->port() == "80")
replacements.SetPortStr("443");
replacements.SetSchemeStr(url::kHttpsScheme);
*url = url->ReplaceComponents(replacements);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment