diff options
Diffstat (limited to 'components/net/hsts.rs')
-rw-r--r-- | components/net/hsts.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/components/net/hsts.rs b/components/net/hsts.rs index 70c301a2ed8..8bbecb86eb1 100644 --- a/components/net/hsts.rs +++ b/components/net/hsts.rs @@ -11,19 +11,19 @@ use url::Url; use util::resource_files::read_resource_file; #[derive(RustcDecodable, RustcEncodable, Clone)] -pub struct HSTSEntry { +pub struct HstsEntry { pub host: String, pub include_subdomains: bool, pub max_age: Option<u64>, pub timestamp: Option<u64> } -impl HSTSEntry { - pub fn new(host: String, subdomains: IncludeSubdomains, max_age: Option<u64>) -> Option<HSTSEntry> { +impl HstsEntry { + pub fn new(host: String, subdomains: IncludeSubdomains, max_age: Option<u64>) -> Option<HstsEntry> { if host.parse::<Ipv4Addr>().is_ok() || host.parse::<Ipv6Addr>().is_ok() { None } else { - Some(HSTSEntry { + Some(HstsEntry { host: host, include_subdomains: (subdomains == IncludeSubdomains::Included), max_age: max_age, @@ -52,28 +52,28 @@ impl HSTSEntry { } #[derive(RustcDecodable, RustcEncodable, Clone)] -pub struct HSTSList { - pub entries: Vec<HSTSEntry> +pub struct HstsList { + pub entries: Vec<HstsEntry> } -impl HSTSList { - pub fn new() -> HSTSList { - HSTSList { +impl HstsList { + pub fn new() -> HstsList { + HstsList { entries: vec![] } } - /// Create an `HSTSList` from the bytes of a JSON preload file. - pub fn from_preload(preload_content: &[u8]) -> Option<HSTSList> { + /// Create an `HstsList` from the bytes of a JSON preload file. + pub fn from_preload(preload_content: &[u8]) -> Option<HstsList> { from_utf8(&preload_content) .ok() .and_then(|c| decode(c).ok()) } - pub fn from_servo_preload() -> HSTSList { + pub fn from_servo_preload() -> HstsList { let file_bytes = read_resource_file("hsts_preload.json") .expect("Could not find Servo HSTS preload file"); - HSTSList::from_preload(&file_bytes) + HstsList::from_preload(&file_bytes) .expect("Servo HSTS preload file is invalid") } @@ -104,7 +104,7 @@ impl HSTSList { }) } - pub fn push(&mut self, entry: HSTSEntry) { + pub fn push(&mut self, entry: HstsEntry) { let have_domain = self.has_domain(&entry.host); let have_subdomain = self.has_subdomain(&entry.host); |