From 90431a7de6c2dac967f5d0c0edc00feec13445fa Mon Sep 17 00:00:00 2001 From: Konstantin Vdovkin Date: Sat, 4 May 2019 22:49:05 +0500 Subject: [PATCH] allowing bidi domain names to start with a digit --- idna/src/uts46.rs | 2 +- tests/unit.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/idna/src/uts46.rs b/idna/src/uts46.rs index ac348d1fa..32a4a8399 100644 --- a/idna/src/uts46.rs +++ b/idna/src/uts46.rs @@ -130,7 +130,7 @@ fn passes_bidi(label: &str, is_bidi_domain: bool) -> bool { match first_char_class { // LTR label - BidiClass::L => { + BidiClass::L | BidiClass::EN => { // Rule 5 loop { match chars.next() { diff --git a/tests/unit.rs b/tests/unit.rs index 62401c943..ad60b1411 100644 --- a/tests/unit.rs +++ b/tests/unit.rs @@ -226,6 +226,8 @@ fn test_idna() { assert!("http://goșu.ro".parse::().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::().is_ok()); + // https://github.com/servo/rust-url/issues/489 + assert!("http://mail.163.com.xn----9mcjf9b4dbm09f.com/iloystgnjfrgthteawvo/indexx.php".parse::().is_ok()); } #[test]