New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trailing period causes DomainNotAllowed exception #7
Comments
I'm not sure I understood your point. Could you please add a more concrete example?
You're right, but this kind of validation goes beyond the purpose of the public suffix list. |
I'm working on improving some code that validates domains where we want to exclude known public suffixes like 'co.uk' but allow things like 'department.bigcompany' for internal-only TLDs inside a company. To do this we're pre-filtering domains, sending it to In debugging the problem I got the exceptions confused, forgetting that Still, I think it's a bug that this code raises
Doing this suggests that '.com.' is a known TLD, but 'example' isn't allowed to be registered underneath it, which isn't true. Tracing the code shows that It seems to me it should either raise |
I totally agree.
This is the key point. I need to understand whether the library should be clever enough to handle this, or if I prefer to follow the basic principles of the Public Suffix List. It seems to me you believe |
I thought about this and I think PublicSuffixService should not handle I think this is the behavior most people would expect - either because they're unaware that domains can in some cases have trailing periods, or because they're aware of it and want to normalize their domains before checking them against the Public Suffix List (which is what the browsers appear to do). Also, as you mentioned above, doing domain validation is beyond the scope of the PublicSuffixService, just as you'd expect a developer to remove a trailing comma before passing a domain to the library, it's reasonable for them to remove a trailing period too. |
Add support for Fully Qualified Domain Names (closed by 4b3f695) |
Due to the way how the library works, it was much more flexible to add the support for FQDN other than raising some kind of error. The release 0.8.0 correctly detects and parses FQDN. Thanks for your feedback. |
With public_suffix_service 0.7.0 parsing a standard domain works well:
Adding trailing punctuation correctly returns a
DomainInvalid
error:But if the trailing punctuation is a period, the error returned is instead
DomainNotAllowed
It's sometimes useful to handle miskeyed input data (
DomainInvalid
) differently to domains that shouldn't exist (DomainInvalid
). For example, in an application I'm working on we ignoreDomainInvalid
because some of the hostnames are on private networks (eg:host.bigcompany
). Without extra error checking code our application will fail to handle a common data input mistake.Also, example.com. is actually a valid hostname - the trailing . implies a fully qualified domain name.
The text was updated successfully, but these errors were encountered: