Skip to content
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

UrlParse, TLD not consistent when TLD is like co.nz #1

Open
jimasun opened this issue Mar 22, 2017 · 3 comments
Open

UrlParse, TLD not consistent when TLD is like co.nz #1

jimasun opened this issue Mar 22, 2017 · 3 comments

Comments

@jimasun
Copy link

jimasun commented Mar 22, 2017

At public function parseHost($string) you assume that the TLD is the piece after the last period.

This assumption break in the case of sub.domain.com.af. One way to solve it is to check for valid values (co, com).

@maximkott
Copy link
Member

Hi @jimasun

From my point of view af is the one and only tld in this url. It is wrong, obviously, but it is not the job of a url to validate tlds, domains and protocols. What would you expect to happen, that you get com as tld and af is thrown away?

@jimasun
Copy link
Author

jimasun commented Mar 22, 2017

I would of course expect to get com.af as a valid suffix. Here is some info on the issue, which is a bit more complicated as the values of TLD need to be validated against a list: http://uri.thephpleague.com/5.0/components/host/#host-represented-by-a-registered-name

Also, here is the project that league URI is using https://github.com/jeremykendall/php-domain-parser

Thanks.

@maximkott
Copy link
Member

maximkott commented Mar 23, 2017

Thank you for the links! I see your point. So basically it's about a new feature, like getPublicSuffix, since com.af is not a valid tld, but a tld with an extension / suffix.

I'll try to add this feature in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants