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:
Simon Sapin 2015-11-23 14:01:00 +01:00
parent 0dfdc94cb2
commit 45ec900745
9 changed files with 7 additions and 52 deletions

View file

@ -42,8 +42,6 @@ time = "0.1.17"
openssl="0.6.1"
rustc-serialize = "0.3"
cookie = "0.1"
regex = "0.1.14"
regex_macros = "0.1.8"
mime_guess = "1.1.1"
flate2 = "0.2.0"
uuid = "0.1.16"

View file

@ -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 {