Merge pull request #50 from jpinner/ignore_httponly_cookies_3.2
Ignore httponly cookies 3.2
This commit is contained in:
commit
582b25eaf5
@ -50,11 +50,22 @@ public class CookieDecoder {
|
|||||||
|
|
||||||
private final static String COMMA = ",";
|
private final static String COMMA = ",";
|
||||||
|
|
||||||
|
private final boolean lenient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new decoder.
|
* Creates a new decoder with strict parsing.
|
||||||
*/
|
*/
|
||||||
public CookieDecoder() {
|
public CookieDecoder() {
|
||||||
super();
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new decoder.
|
||||||
|
*
|
||||||
|
* @param lenient ignores cookies with the name 'HTTPOnly' instead of throwing an exception
|
||||||
|
*/
|
||||||
|
public CookieDecoder(boolean lenient) {
|
||||||
|
this.lenient = lenient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,6 +106,11 @@ public class CookieDecoder {
|
|||||||
Set<Cookie> cookies = new TreeSet<Cookie>();
|
Set<Cookie> cookies = new TreeSet<Cookie>();
|
||||||
for (; i < names.size(); i ++) {
|
for (; i < names.size(); i ++) {
|
||||||
String name = names.get(i);
|
String name = names.get(i);
|
||||||
|
// Not all user agents understand the HttpOnly attribute
|
||||||
|
if (lenient && CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String value = values.get(i);
|
String value = values.get(i);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = "";
|
value = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user