Skip to content

Commit 84de798

Browse files
author
lishuo
committed
check idna prefix for all sub labels per comment
1 parent 1f46217 commit 84de798

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

url/src/host.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl Host<String> {
170170
fn domain_to_ascii(domain: &str) -> Result<String, ParseError> {
171171
// without idna feature, we can't verify that xn-- domains correctness
172172
let domain = domain.to_lowercase();
173-
if domain.is_ascii() && !domain.starts_with("xn--") {
173+
if domain.is_ascii() && domain.split('.').all(|s| !s.starts_with("xn--")) {
174174
Ok(domain)
175175
} else {
176176
Err(ParseError::InvalidDomainCharacter)

0 commit comments

Comments
 (0)