HTTPCLIENT-1640: RFC6265 lax cookie policy fails to parse 'max-age' attribute

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1674059 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2015-04-16 12:21:13 +00:00
parent 163f7804b8
commit 2a0cd17536
2 changed files with 4 additions and 3 deletions

View File

@ -214,7 +214,7 @@ public class LaxExpiresHandler extends AbstractCookieAttributeHandler implements
@Override
public String getAttributeName() {
return ClientCookie.MAX_AGE_ATTR;
return ClientCookie.EXPIRES_ATTR;
}
}

View File

@ -151,7 +151,8 @@ public class RFC6265CookieSpec implements CookieSpec {
final Map<String, String> attribMap = new LinkedHashMap<String, String>();
while (!cursor.atEnd()) {
final String paramName = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS);
final String paramName = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS)
.toLowerCase(Locale.ROOT);
String paramValue = null;
if (!cursor.atEnd()) {
final int paramDelim = buffer.charAt(cursor.getPos());
@ -163,7 +164,7 @@ public class RFC6265CookieSpec implements CookieSpec {
}
}
}
cookie.setAttribute(paramName.toLowerCase(Locale.ROOT), paramValue);
cookie.setAttribute(paramName, paramValue);
attribMap.put(paramName, paramValue);
}
// Ignore 'Expires' if 'Max-Age' is present