From 70d341231563c60fd4f412db8dca21ed3bafe8ee Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Tue, 26 Aug 2014 14:38:28 +0000 Subject: [PATCH] Default cookie spec to permit 'expires' attribute for Netscape style cookies only git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1620613 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/cookie/BestMatchSpec.java | 19 +++++++++++++++++-- .../apache/http/impl/cookie/RFC2965Spec.java | 6 ++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java index d2284ffda..c9551146b 100644 --- a/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java +++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java @@ -58,8 +58,23 @@ public class BestMatchSpec implements CookieSpec { public BestMatchSpec(final String[] datepatterns, final boolean oneHeader) { super(); - this.strict = new RFC2965Spec(datepatterns, oneHeader); - this.obsoleteStrict = new RFC2109Spec(datepatterns, oneHeader); + this.strict = new RFC2965Spec(oneHeader, + new RFC2965VersionAttributeHandler(), + new BasicPathHandler(), + new RFC2965DomainAttributeHandler(), + new RFC2965PortAttributeHandler(), + new BasicMaxAgeHandler(), + new BasicSecureHandler(), + new BasicCommentHandler(), + new RFC2965CommentUrlAttributeHandler(), + new RFC2965DiscardAttributeHandler()); + this.obsoleteStrict = new RFC2109Spec(oneHeader, + new RFC2109VersionHandler(), + new BasicPathHandler(), + new RFC2109DomainHandler(), + new BasicMaxAgeHandler(), + new BasicSecureHandler(), + new BasicCommentHandler()); this.netscapeDraft = new NetscapeDraftSpec( new BasicDomainHandler(), new BasicPathHandler(), diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java index 7d2f33124..d433c8d7f 100644 --- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java +++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java @@ -37,6 +37,7 @@ import org.apache.http.HeaderElement; import org.apache.http.NameValuePair; import org.apache.http.annotation.ThreadSafe; import org.apache.http.cookie.ClientCookie; +import org.apache.http.cookie.CommonCookieAttributeHandler; import org.apache.http.cookie.Cookie; import org.apache.http.cookie.CookieAttributeHandler; import org.apache.http.cookie.CookieOrigin; @@ -77,6 +78,11 @@ public class RFC2965Spec extends RFC2109Spec { new RFC2965DiscardAttributeHandler()); } + RFC2965Spec(final boolean oneHeader, + final CommonCookieAttributeHandler... handlers) { + super(oneHeader, handlers); + } + @Override public List parse( final Header header,