aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/hsts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/net/hsts.rs')
-rw-r--r--components/net/hsts.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/components/net/hsts.rs b/components/net/hsts.rs
index 8bbecb86eb1..b64b797c754 100644
--- a/components/net/hsts.rs
+++ b/components/net/hsts.rs
@@ -122,13 +122,11 @@ impl HstsList {
}
pub fn secure_url(url: &Url) -> Url {
- if &*url.scheme == "http" {
+ if url.scheme() == "http" {
let mut secure_url = url.clone();
- secure_url.scheme = "https".to_owned();
- secure_url.relative_scheme_data_mut()
- .map(|scheme_data| {
- scheme_data.default_port = Some(443);
- });
+ secure_url.set_scheme("https").unwrap();
+ // .set_port(Some(443)) would set the port to None,
+ // and should only be done when it was already None.
secure_url
} else {
url.clone()