diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java index e1e5e01bbd..0a090313bd 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java @@ -50,11 +50,22 @@ public class CookieDecoder { private final static String COMMA = ","; + private boolean lenient; + /** - * Creates a new decoder. + * Creates a new decoder with strict parsing. */ 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,8 +106,8 @@ public class CookieDecoder { Set cookies = new TreeSet(); for (; i < names.size(); i ++) { String name = names.get(i); - // Not all user agents understand the HttpOnly attribute -- be lenient - if (CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) { + // Not all user agents understand the HttpOnly attribute + if (lenient && CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) { continue; }