You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Domain { full: "com", typ: Some(Icann), suffix: Some("com"), registrable: None }eprintln!("{:?}", list.parse_domain("com").unwrap());// Domain { full: "localhost", typ: None, suffix: None, registrable: None }eprintln!("{:?}", list.parse_domain("localhost").unwrap());// Domain { full: "test.com.", typ: None, suffix: Some("com"), registrable: Some("test.com") }eprintln!("{:?}", list.parse_domain("test.com.").unwrap());// Domain { full: "test.localhost.", typ: None, suffix: Some("localhost"), registrable: Some("test.localhost") }eprintln!("{:?}", list.parse_domain("test.localhost.").unwrap());// panicked at 'index 2 out of range for slice of length 1'eprintln!("{:?}", list.parse_domain("com.").unwrap());// panicked at 'index 2 out of range for slice of length 1'eprintln!("{:?}", list.parse_domain("localhost.").unwrap());
Notice how the suffix is different for localhost and test.localhost.. I am not sure if this is the same or a different issue.
Stracktrace:
10: <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index
at /checkout/src/libcore/slice/mod.rs:866
11: <core::ops::range::RangeTo<usize> as core::slice::SliceIndex<[T]>>::index
at /checkout/src/libcore/slice/mod.rs:912
12: core::slice::<impl core::ops::index::Index<I> for [T]>::index
at /checkout/src/libcore/slice/mod.rs:717
13: <alloc::vec::Vec<T> as core::ops::index::Index<core::ops::range::RangeTo<usize>>>::index
at /checkout/src/liballoc/vec.rs:1584
14: publicsuffix::Domain::assemble
at /cargo/registry/src/github.com-1ecc6299db9ec823/publicsuffix-1.4.0/src/lib.rs:600
15: publicsuffix::Domain::find_match
at /cargo/registry/src/github.com-1ecc6299db9ec823/publicsuffix-1.4.0/src/lib.rs:647
16: publicsuffix::Domain::parse::{{closure}}
at /cargo/registry/src/github.com-1ecc6299db9ec823/publicsuffix-1.4.0/src/lib.rs:677
17: <core::result::Result<T, E>>::and_then
at /checkout/src/libcore/result.rs:602
18: publicsuffix::Domain::parse
at /cargo/registry/src/github.com-1ecc6299db9ec823/publicsuffix-1.4.0/src/lib.rs:676
19: publicsuffix::List::parse_dns_name
at /cargo/registry/src/github.com-1ecc6299db9ec823/publicsuffix-1.4.0/src/lib.rs:484
Changing lib.rs:671 to
let input = domain.trim_right_matches('.');
fixes the problem. I will provide a pull request with matching tests later.
The text was updated successfully, but these errors were encountered:
Since a valid domain name can only have one trailing ., we must make sure this is the case before calling trim_right_matches otherwise a domain like test.com.. will be parsed as a valid domain name.
Notice how the suffix is different for
localhost
andtest.localhost.
. I am not sure if this is the same or a different issue.Stracktrace:
Changing lib.rs:671 to
fixes the problem. I will provide a pull request with matching tests later.
The text was updated successfully, but these errors were encountered: