mkodekar / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Not under a public suffix: s3.amazonaws.com #1829

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Getting exception "Not under a public suffix: s3.amazonaws.com".
But domain is ok. 

Original issue reported on code.google.com by maxim.ze...@gmail.com on 7 Aug 2014 at 11:13

GoogleCodeExporter commented 9 years ago
s3.amazonaws.com is itself a public suffix, so it's not "under" one. The fact 
that a privately owned domains is a "public suffix" is surprising to basically 
everyone, but as a starting point, it means that many people can register 
domains under it. This might not match with what you're hoping to use 
topPrivateDomain() for. If you can say more about your requirements, we may be 
able to suggest something.

https://publicsuffix.org/list/effective_tld_names.dat

Original comment by cpov...@google.com on 7 Aug 2014 at 1:16

GoogleCodeExporter commented 9 years ago
But it's used in links. Check this: 
http://s3.amazonaws.com/content.sitezoogle.com/u/37580/f9d229abdacc73fc55b3f5d28
d176dbdc8fa4cdd/large/under-high-cotton-tunecore.jpg?1391996119

So it's unexpected to get exceptions on trying to get topPrivateDomain.

Original comment by maxim.ze...@gmail.com on 7 Aug 2014 at 4:03

GoogleCodeExporter commented 9 years ago
Is there any specific reason that a public suffix cannot itself be considered 
to be under another public suffix? It's an odd situation to be sure.

Original comment by cgdecker@google.com on 7 Aug 2014 at 4:42

GoogleCodeExporter commented 9 years ago
Got it. It sounds like you're looking for hasPublicSuffix():

"Indicates whether this domain name ends in a public suffix, including if it is 
a public suffix itself. For example, returns true for www.google.com, foo.co.uk 
and com, but not for google or google.foo. This is the recommended method for 
determining whether a domain is potentially an addressable host."

Whereas topPrivateDomain() says:

"This method should not be used to determine the topmost parent domain which is 
addressable as a host, as many public suffixes are also addressable hosts. For 
example, the domain foo.bar.uk.com has a public suffix of uk.com, so it would 
return bar.uk.com from this method. But uk.com is itself an addressable host."

Original comment by cpov...@google.com on 7 Aug 2014 at 4:43

GoogleCodeExporter commented 9 years ago
Hmm, I don't know what would happen if we considered "s3.amazonaws.com" to be 
under "com." My worry would be that this would allow people to set cookies on 
"amazonaws.com," which is the sort of thing that the public-suffix list is 
designed to prevent.

Original comment by cpov...@google.com on 7 Aug 2014 at 4:46

GoogleCodeExporter commented 9 years ago
Understood. 
So currently there is no other way but to create an exclusion around call to 
'topPrivateDomain()'?...

for s1.amazonaws.com, s3.amazonaws.com, ... it doesn't throw exception.

Original comment by maxim.ze...@gmail.com on 7 Aug 2014 at 9:03

GoogleCodeExporter commented 9 years ago
That's hard to say for sure without knowing what you're trying to do. What are 
you using topPrivateDomain for?

Original comment by cpov...@google.com on 7 Aug 2014 at 9:34

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07