Class PublicSuffixList
- java.lang.Object
-
- org.asynchttpclient.cookie.PublicSuffixList
-
public final class PublicSuffixList extends Object
The ICANN section of the Mozilla Public Suffix List, used to decide whether a cookieDomainattribute names a registry rather than a site.RFC 6265 Section 5.3 step 5 requires rejecting a
Domainthat is a public suffix, and that rule cannot be approximated:co.ukhas a dot like any ordinary domain, so counting labels does not distinguish a registry from a site. Without the list a host underco.ukcan set a cookie forco.ukitself and every other host under that suffix receives it.Only the ICANN section is bundled. The private section describes organisations that let others register names beneath them, which is a weaker property than a registry and not what step 5 is about.
Matching lowercases with
Locale.ROOT. The default locale would be wrong here in a way that matters: under Turkish,"INFO".toLowerCase()is notinfo, so the check would answer false for every I-initial suffix and fail open exactly where it is meant to hold.The list is data and goes stale as registries change. A suffix added upstream after this release is not recognised until the bundled copy is refreshed, so this narrows the exposure rather than closing it for all time. If the resource cannot be read the check reports nothing as a public suffix, leaving behaviour as it was rather than rejecting cookies that used to work.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisPublicSuffix(String domain)Whetherdomainis a public suffix, and so may not be theDomainof a cookie.
-
-
-
Method Detail
-
isPublicSuffix
public static boolean isPublicSuffix(String domain)
Whetherdomainis a public suffix, and so may not be theDomainof a cookie.- Parameters:
domain- a hostname, without a leading dot
-
-