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
This commit is contained in:
Oleg Kalnichevski 2014-08-26 14:38:28 +00:00
parent 243c862a03
commit 70d3412315
2 changed files with 23 additions and 2 deletions

View File

@ -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(),

View File

@ -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<Cookie> parse(
final Header header,