From 0dfdc94cb21d216d47c58fe8d3a355ae0dfe16bd Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 23 Nov 2015 14:01:00 +0100 Subject: [PATCH] Remove IPv6 subnet parsing in host files like ::1/64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The host replacement code doesn’t do anything useful with it. (It only compares strings.) --- components/net_traits/lib.rs | 2 +- tests/unit/net/resource_task.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index f5e70489fd4..51695e0c980 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -46,7 +46,7 @@ pub mod storage_task; pub static IPV4_REGEX: Regex = regex!( r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); -pub static IPV6_REGEX: Regex = regex!(r"^([a-fA-F0-9]{0,4}[:]?){1,8}(/\d{1,3})?$"); +pub static IPV6_REGEX: Regex = regex!(r"^([a-fA-F0-9]{0,4}[:]?){1,8}$"); /// [Response type](https://fetch.spec.whatwg.org/#concept-response-type) #[derive(Clone, PartialEq, Copy)] diff --git a/tests/unit/net/resource_task.rs b/tests/unit/net/resource_task.rs index c72dc66ba22..70e58fd58b2 100644 --- a/tests/unit/net/resource_task.rs +++ b/tests/unit/net/resource_task.rs @@ -121,12 +121,9 @@ fn test_parse_hostsfile_with_valid_ipv6_addresses() 0000:0000:0000:0000:0000:0000:0000:0001 bar.moz.com\n\ ::1 foo.bar.baz baz.foo.com\n\ 2001:0DB8:85A3:0042:1000:8A2E:0370:7334 baz.bar.moz\n\ - 2002:0DB8:85A3:0042:1000:8A2E:0370:7334/96 baz2.bar.moz\n\ - 2002:0DB8:85A3:0042:1000:8A2E:0370:7334/128 baz3.bar.moz\n\ - :: unspecified.moz.com\n\ - ::/128 unspecified.address.com"; + :: unspecified.moz.com"; let hosts_table = parse_hostsfile(mock_hosts_file_content); - assert_eq!(12, (*hosts_table).len()); + assert_eq!(9, (*hosts_table).len()); } #[test]