mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
Move hosts module into net crate. Remove obsolete functions.
This commit is contained in:
parent
e772086b8c
commit
6f590a87bf
11 changed files with 13 additions and 45 deletions
|
@ -6,7 +6,6 @@ use net::hsts::{HstsEntry, HstsList};
|
|||
use net_traits::IncludeSubdomains;
|
||||
use std::collections::HashMap;
|
||||
use time;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
fn test_hsts_entry_is_not_expired_when_it_has_no_timestamp() {
|
||||
|
|
|
@ -25,8 +25,8 @@ use msg::constellation_msg::TEST_PIPELINE_ID;
|
|||
use net::cookie::Cookie;
|
||||
use net::cookie_storage::CookieStorage;
|
||||
use net::resource_thread::AuthCacheEntry;
|
||||
use net::test::replace_host_table;
|
||||
use net_traits::{CookieSource, NetworkError};
|
||||
use net_traits::hosts::replace_host_table;
|
||||
use net_traits::request::{Request, RequestInit, RequestMode, CredentialsMode, Destination};
|
||||
use net_traits::response::ResponseBody;
|
||||
use new_fetch_context;
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
|
||||
use ipc_channel::ipc;
|
||||
use net::resource_thread::new_core_resource_thread;
|
||||
use net::test::parse_hostsfile;
|
||||
use net_traits::CoreResourceMsg;
|
||||
use net_traits::hosts::{host_replacement, parse_hostsfile};
|
||||
use profile_traits::time::ProfilerChan;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
|
||||
fn ip(s: &str) -> IpAddr {
|
||||
|
@ -143,19 +140,3 @@ fn test_parse_hostsfile_with_end_of_line_whitespace()
|
|||
assert_eq!(ip("2001:db8:0:0:0:ff00:42:8329"), *hosts_table.get("moz.foo.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.2"), *hosts_table.get("servo.test.server").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_replace_hosts() {
|
||||
let mut host_table = HashMap::new();
|
||||
host_table.insert("foo.bar.com".to_owned(), ip("127.0.0.1"));
|
||||
host_table.insert("servo.test.server".to_owned(), ip("127.0.0.2"));
|
||||
|
||||
let url = ServoUrl::parse("http://foo.bar.com:8000/foo").unwrap();
|
||||
assert_eq!(host_replacement(&host_table, url).host_str().unwrap(), "127.0.0.1");
|
||||
|
||||
let url = ServoUrl::parse("http://servo.test.server").unwrap();
|
||||
assert_eq!(host_replacement(&host_table, url).host_str().unwrap(), "127.0.0.2");
|
||||
|
||||
let url = ServoUrl::parse("http://a.foo.bar.com").unwrap();
|
||||
assert_eq!(host_replacement(&host_table, url).host_str().unwrap(), "a.foo.bar.com");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue