Skip to content

Commit

Permalink
Ignore UTS46 validity criteria V2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Ezell authored and canova committed Nov 19, 2016
1 parent 288dd37 commit 695a507
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions idna/src/uts46.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,10 @@ fn validate(label: &str, flags: Flags, errors: &mut Vec<Error>) {
}

// Can not contain '.' since the input is from .split('.')
if {
let mut chars = label.chars().skip(2);
let third = chars.next();
let fourth = chars.next();
(third, fourth) == (Some('-'), Some('-'))
} || label.starts_with("-")
// Spec says that the label must not contain a HYPHEN-MINUS character in both the
// third and fourth positions. But nobody follows this criteria. See the spec issue below:
// https://github.com/whatwg/url/issues/53
if label.starts_with("-")
|| label.ends_with("-")
|| label.chars().next().map_or(false, is_combining_mark)
|| label.chars().any(|c| match *find_char(c) {
Expand Down
1 change: 1 addition & 0 deletions tests/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ fn host_serialization() {
fn test_idna() {
assert!("http://goșu.ro".parse::<Url>().is_ok());
assert_eq!(Url::parse("http://☃.net/").unwrap().host(), Some(Host::Domain("xn--n3h.net")));
assert!("https://r2---sn-huoa-cvhl.googlevideo.com/crossdomain.xml".parse::<Url>().is_ok());
}

#[test]
Expand Down

0 comments on commit 695a507

Please sign in to comment.