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

compute-1.amazonaws.com return none #28

Closed
Kuzuto opened this issue Apr 12, 2024 · 2 comments
Closed

compute-1.amazonaws.com return none #28

Kuzuto opened this issue Apr 12, 2024 · 2 comments

Comments

@Kuzuto
Copy link

Kuzuto commented Apr 12, 2024

Hi,
I made a test on the hostname "ec2-100-24-188-149.compute-1.amazonaws.com" , and was expecting it to return amazonaws.com.
But I'm getting None as return.

    def test_amazonaws(self):
        self.assertEqual(self.psl.privatesuffix("ec2-100-24-188-149.compute-1.amazonaws.com"), "amazonaws.com")

'amazonaws.com' != None
Expected :None
Actual :'amazonaws.com'

If I remove the first ec2-... I'm getting correct result:

    def test_amazonaws(self):
        self.assertEqual(self.psl.privatesuffix("compute-1.amazonaws.com"), "amazonaws.com")

PASSED [100%]
Process finished with exit code 0

In https://publicsuffix.org/list/public_suffix_list.dat I can see *.compute-1.amazonaws.com.
Should the first not match ?

@Kuzuto Kuzuto closed this as completed Apr 12, 2024
@Kuzuto Kuzuto reopened this Apr 12, 2024
@ko-zu
Copy link
Owner

ko-zu commented Apr 12, 2024

Assume you used the current PSL untouched, None should be correct for the first test.

psl.privatesuffix("compute-1.amazonaws.com") == "amazonaws.com" because "compute-1.amazonaws.com" and "amazonaws.com" are not a public suffix, but still, "ec2-aaa-aaa-aaa-aaa.compute-1.amazonaws.com" is a public suffix since the PSL declared that "*.compute-1.amazonaws.com" is a wildcard public suffix.

psl.privatesuffix("ec2-aaa-aaa-aaa-aaa.compute-1.amazonaws.com") == psl.privatesuffix("com") == None, which means the argument has no private part on top of the public suffix.

Such a company-owned public suffix declaration can be ignored with PublicSuffixList(only_icann=True) option.

@Kuzuto
Copy link
Author

Kuzuto commented Apr 13, 2024

Make sense.. thank you.

@Kuzuto Kuzuto closed this as completed Apr 13, 2024
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