mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Remove dependency on regex_macros
This reduces the amount of code using unstable features that we depend on. The hand-written IP address parser is probably just as fast.
This commit is contained in:
parent
0dfdc94cb2
commit
45ec900745
9 changed files with 7 additions and 52 deletions
|
@ -2,8 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use net_traits::{IPV4_REGEX, IPV6_REGEX, IncludeSubdomains};
|
||||
use net_traits::IncludeSubdomains;
|
||||
use rustc_serialize::json::{decode};
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use std::str::{from_utf8};
|
||||
use time;
|
||||
use url::Url;
|
||||
|
@ -19,7 +20,7 @@ pub struct HSTSEntry {
|
|||
|
||||
impl HSTSEntry {
|
||||
pub fn new(host: String, subdomains: IncludeSubdomains, max_age: Option<u64>) -> Option<HSTSEntry> {
|
||||
if IPV4_REGEX.is_match(&host) || IPV6_REGEX.is_match(&host) {
|
||||
if host.parse::<Ipv4Addr>().is_ok() || host.parse::<Ipv6Addr>().is_ok() {
|
||||
None
|
||||
} else {
|
||||
Some(HSTSEntry {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue