rushmorem / publicsuffix

An implementation of Mozilla's Public Suffix List in Rust
MIT License
97 stars 17 forks source link

Track longest valid suffix seen #26

Closed dead10ck closed 5 years ago

dead10ck commented 5 years ago

When finding the suffix of an input domain, it was not remembering if it had ever encountered a valid suffix along the way, so when a shorter suffix matches, but then it partially matches another rule, it would erroneously find no suffix. For example, cdn.fbsbx.com should find the suffix of com, but because it partially matches the rule for apps.fbsbx.com, it finds no suffix or root domain.

This changes the suffix finding algorithm to remember the longest valid suffix it has seen and uses that.

Fixes #24

hiratara commented 5 years ago

It's my fault. #20 causes this bug. I agree with this PR.

rushmorem commented 5 years ago

Thank you