Do not change the port when loading HSTS domain

servo/servo#6105
This commit is contained in:
Sam Gibson 2015-06-22 15:23:26 -07:00
parent 72d4433587
commit 855a9487ae

View file

@ -185,6 +185,17 @@ fn test_hsts_list_with_subdomain_when_host_is_exact_match_is_always_secure() {
assert!(hsts_list.always_secure("mozilla.org") == true);
}
#[test]
fn test_make_hsts_secure_does_not_change_explicit_port() {
let load_data = LoadData::new(Url::parse("http://mozilla.org:8080/").unwrap(), None);
let hsts_list = HSTSList {
entries: vec![HSTSEntry { host: "mozilla.org".to_string(), include_subdomains: false}]
};
let secure_load_data = hsts_list.make_hsts_secure(load_data);
assert!(secure_load_data.url.port().unwrap() == 8080u16);
}
#[test]
fn test_make_hsts_secure_doesnt_affect_non_http_schemas() {
let load_data = LoadData::new(Url::parse("file://mozilla.org").unwrap(), None);