On 6 September 2014 15:16, Oleg Kalnichevski <[email protected]> wrote: > On Fri, 2014-09-05 at 19:22 +0100, sebb AT ASF wrote: >> On 5 September 2014 19:19, <[email protected]> wrote: >> > Author: sebb >> > Date: Fri Sep 5 18:19:55 2014 >> > New Revision: 1622753 >> > >> > URL: http://svn.apache.org/r1622753 >> > Log: >> > string matching is cheaper than regex matching so do it first >> > >> > Modified: >> > >> > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java >> > >> > Modified: >> > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java >> > URL: >> > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java?rev=1622753&r1=1622752&r2=1622753&view=diff >> > ============================================================================== >> > --- >> > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java >> > (original) >> > +++ >> > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java >> > Fri Sep 5 18:19:55 2014 >> > @@ -71,7 +71,7 @@ public class PublicSuffixDomainFilter im >> > @Override >> > public boolean match(final Cookie cookie, final CookieOrigin origin) { >> > final String domain = cookie.getDomain(); >> > - if (matcher.matches(domain) && >> > !domain.equalsIgnoreCase("localhost")) { >> > + if (!domain.equalsIgnoreCase("localhost") && >> > matcher.matches(domain)) { >> >> Having changed the order of checking, I now wonder why localhost is >> being explicitly excluded here? >> > > As far as public suffix matcher is considered 'localhost' is not a valid > domain. We would either need to normalize it to 'localhost.localdomain' > or handle as a special case.
I see. But perhaps the special case belongs in the calling code, rather than here. > HttpClient should still accept cookies from 'localhost', shouldn't it? I guess so. > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
