From 13ba3126fd64b09dfe97cc414835c842c5e179ba Mon Sep 17 00:00:00 2001 From: gregw Date: Wed, 15 Feb 2023 22:58:09 +1100 Subject: [PATCH] Updates from review --- .../java/org/eclipse/jetty/server/CookieCutter.java | 6 ------ .../org/eclipse/jetty/server/CookieCutterTest.java | 12 +++++------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java b/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java index f06cd93c071d..60a9f5208db1 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java @@ -424,12 +424,6 @@ protected boolean isRFC6265RejectedCharacter(boolean inQuoted, char c) } else { - /* From RFC6265 - Section 4.1.1 - Syntax - * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E - * ; US-ASCII characters excluding CTLs, - * ; whitespace DQUOTE, comma, semicolon, - * ; and backslash - */ return Character.isISOControl(c) || // control characters c > 127 || // 8-bit characters c == ',' || // comma diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java index 6a2f10468722..3e84ce6ce467 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java @@ -301,19 +301,17 @@ public static List rfc6265Cookies() new Param("A= 1; B=2; C=3", "A=1", "B=2", "C=3"), new Param("A=\"1; B=2\"; C=3", "C=3"), new Param("A=\"1; B=2; C=3"), - new Param("A=\"1 B=2\"; C=3", "A=1 B=2", "C=3"), // Why should A be rejected? Shouldn't it be A=<1 B=2>? + new Param("A=\"1 B=2\"; C=3", "A=1 B=2", "C=3"), new Param("A=\"\"1; B=2; C=3", "B=2", "C=3"), new Param("A=\"\" ; B=2; C=3", "A=", "B=2", "C=3"), new Param("A=\"\"; B=2; C=3", "A=", "B=2", "C=3"), new Param("A=1\"\"; B=2; C=3", "B=2", "C=3"), new Param("A=1\"; B=2; C=3", "B=2", "C=3"), new Param("A=1\"1; B=2; C=3", "B=2", "C=3"), - /* TODO Use Legacy mode for these - new Param("A=\" 1\"; B=2; C=3", "A=1", "B=2", "C=3"), // Why should the whitespaces be trimmed? They were not in the prev impl. - new Param("A=\"1 \"; B=2; C=3", "A=1", "B=2", "C=3"), // ditto - new Param("A=\" 1 \"; B=2; C=3", "A=1", "B=2", "C=3"), // ditto - new Param("A=\" 1 1 \"; B=2; C=3", "A=1 1", "B=2", "C=3"), // ditto - */ + new Param("A=\" 1\"; B=2; C=3", "A= 1", "B=2", "C=3"), + new Param("A=\"1 \"; B=2; C=3", "A=1 ", "B=2", "C=3"), + new Param("A=\" 1 \"; B=2; C=3", "A= 1 ", "B=2", "C=3"), + new Param("A=\" 1 1 \"; B=2; C=3", "A= 1 1 ", "B=2", "C=3"), new Param("A=1,; B=2; C=3", "B=2", "C=3"), new Param("A=\"1,\"; B=2; C=3", "B=2", "C=3"), new Param("A=\\1; B=2; C=3", "B=2", "C=3"),