mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Uses the approach suggested by @SimonSapin for changing Url scheme
servo/rust-url#61
This commit is contained in:
parent
5014da42fc
commit
118122da38
1 changed files with 5 additions and 1 deletions
|
@ -125,7 +125,11 @@ pub fn secure_url(url: &Url) -> Url {
|
|||
if &*url.scheme == "http" {
|
||||
let mut secure_url = url.clone();
|
||||
secure_url.scheme = "https".to_string();
|
||||
Url::parse(&secure_url.serialize()).unwrap()
|
||||
secure_url.relative_scheme_data_mut()
|
||||
.map(|scheme_data| {
|
||||
scheme_data.default_port = Some(443);
|
||||
});
|
||||
secure_url
|
||||
} else {
|
||||
url.clone()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue