mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Kill hsts::secure_url
This commit is contained in:
parent
d2dc425336
commit
170bcfc03e
2 changed files with 0 additions and 38 deletions
|
@ -10,7 +10,6 @@ use std::collections::HashMap;
|
|||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use std::str::from_utf8;
|
||||
use time;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct HstsEntry {
|
||||
|
@ -136,15 +135,3 @@ impl HstsList {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn secure_url(url: &Url) -> Url {
|
||||
if url.scheme() == "http" {
|
||||
let mut secure_url = url.clone();
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use net::hsts::{HstsEntry, HstsList};
|
||||
use net::hsts::secure_url;
|
||||
use net_traits::IncludeSubdomains;
|
||||
use std::collections::HashMap;
|
||||
use time;
|
||||
|
@ -294,27 +293,3 @@ fn test_preload_hsts_domains_well_formed() {
|
|||
let hsts_list = HstsList::from_servo_preload();
|
||||
assert!(!hsts_list.entries_map.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_secure_url_does_not_change_explicit_port() {
|
||||
let url = Url::parse("http://mozilla.org:8080/").unwrap();
|
||||
let secure = secure_url(&url);
|
||||
|
||||
assert!(secure.port().unwrap() == 8080u16);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_secure_url_does_not_affect_non_http_schemas() {
|
||||
let url = Url::parse("file://mozilla.org").unwrap();
|
||||
let secure = secure_url(&url);
|
||||
|
||||
assert_eq!(secure.scheme(), "file");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_secure_url_forces_an_http_host_in_list_to_https() {
|
||||
let url = Url::parse("http://mozilla.org").unwrap();
|
||||
let secure = secure_url(&url);
|
||||
|
||||
assert_eq!(secure.scheme(), "https");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue