This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 44a8be2833 NoEqualsCookie -> CookiesWithoutEquals
44a8be2833 is described below
commit 44a8be2833489c1247f3eb53169383ddeb392411
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Aug 28 10:56:50 2024 +0100
NoEqualsCookie -> CookiesWithoutEquals
---
.../apache/tomcat/util/http/CookieProcessorBase.java | 14 +++++++-------
.../{NoEqualsCookie.java => CookiesWithoutEquals.java} | 12 ++++++------
.../apache/tomcat/util/http/LocalStrings.properties | 4 ++--
.../apache/tomcat/util/http/LocalStrings_fr.properties | 4 ++--
.../apache/tomcat/util/http/LocalStrings_ko.properties | 4 ++--
.../tomcat/util/http/LocalStrings_zh_CN.properties | 4 ++--
.../tomcat/util/http/Rfc6265CookieProcessor.java | 2 +-
java/org/apache/tomcat/util/http/parser/Cookie.java | 18 +++++++++---------
.../org/apache/tomcat/util/http/TestCookieParsing.java | 12 ++++++------
test/org/apache/tomcat/util/http/TestCookies.java | 18 +++++++++---------
webapps/docs/changelog.xml | 2 +-
webapps/docs/config/cookie-processor.xml | 2 +-
12 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/java/org/apache/tomcat/util/http/CookieProcessorBase.java
b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
index 54cb7de5f4..395216aeb6 100644
--- a/java/org/apache/tomcat/util/http/CookieProcessorBase.java
+++ b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
@@ -42,21 +42,21 @@ public abstract class CookieProcessorBase implements
CookieProcessor {
private boolean partitioned = false;
- private NoEqualsCookie noEqualsCookie = NoEqualsCookie.NAME;
+ private CookiesWithoutEquals cookiesWithoutEquals =
CookiesWithoutEquals.NAME;
- public String getNoEqualsCookie() {
- return noEqualsCookie.getValue();
+ public String getCookiesWithoutEquals() {
+ return cookiesWithoutEquals.getValue();
}
- protected NoEqualsCookie getNoEqualsCookieInternal() {
- return noEqualsCookie;
+ protected CookiesWithoutEquals getCookiesWithoutEqualsInternal() {
+ return cookiesWithoutEquals;
}
- public void setNoEqualsCookie(String noEqualsCookie) {
- this.noEqualsCookie = NoEqualsCookie.fromString(noEqualsCookie);
+ public void setCookiesWithoutEquals(String cookiesWithoutEquals) {
+ this.cookiesWithoutEquals =
CookiesWithoutEquals.fromString(cookiesWithoutEquals);
}
diff --git a/java/org/apache/tomcat/util/http/NoEqualsCookie.java
b/java/org/apache/tomcat/util/http/CookiesWithoutEquals.java
similarity index 85%
rename from java/org/apache/tomcat/util/http/NoEqualsCookie.java
rename to java/org/apache/tomcat/util/http/CookiesWithoutEquals.java
index 8d47102b95..02163a8c56 100644
--- a/java/org/apache/tomcat/util/http/NoEqualsCookie.java
+++ b/java/org/apache/tomcat/util/http/CookiesWithoutEquals.java
@@ -20,7 +20,7 @@ import java.util.Locale;
import org.apache.tomcat.util.res.StringManager;
-public enum NoEqualsCookie {
+public enum CookiesWithoutEquals {
IGNORE("ignore"),
NAME("name");
/*
@@ -34,11 +34,11 @@ public enum NoEqualsCookie {
*/
- private static final StringManager sm =
StringManager.getManager(NoEqualsCookie.class);
+ private static final StringManager sm =
StringManager.getManager(CookiesWithoutEquals.class);
private final String value;
- NoEqualsCookie(String value) {
+ CookiesWithoutEquals(String value) {
this.value = value;
}
@@ -46,15 +46,15 @@ public enum NoEqualsCookie {
return value;
}
- public static NoEqualsCookie fromString(String from) {
+ public static CookiesWithoutEquals fromString(String from) {
String trimmedLower = from.trim().toLowerCase(Locale.ENGLISH);
- for (NoEqualsCookie value : values()) {
+ for (CookiesWithoutEquals value : values()) {
if (value.getValue().equals(trimmedLower)) {
return value;
}
}
- throw new IllegalStateException(sm.getString("noEqualsCookie.invalid",
from));
+ throw new
IllegalStateException(sm.getString("cookiesWithoutEquals.invalid", from));
}
}
diff --git a/java/org/apache/tomcat/util/http/LocalStrings.properties
b/java/org/apache/tomcat/util/http/LocalStrings.properties
index f670b79cb9..11ca7e0a07 100644
--- a/java/org/apache/tomcat/util/http/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/http/LocalStrings.properties
@@ -20,9 +20,9 @@ cookies.invalidSameSiteCookies=Unknown setting [{0}], must be
one of: unset, non
cookies.invalidSpecial=Cookies: Unknown Special Cookie
cookies.maxCountFail=More than the maximum allowed number of cookies, [{0}],
were detected.
-headers.maxCountFail=More than the maximum allowed number of headers, [{0}],
were detected.
+cookiesWithoutEquals.invalid=The value [{0}] is not recognised
-noEqualsCookie.invalid=The value [{0}] is not recognised
+headers.maxCountFail=More than the maximum allowed number of headers, [{0}],
were detected.
parameters.bytes=Start processing with input [{0}]
parameters.copyFail=Failed to create copy of original parameter values for
debug logging purposes
diff --git a/java/org/apache/tomcat/util/http/LocalStrings_fr.properties
b/java/org/apache/tomcat/util/http/LocalStrings_fr.properties
index 220337bc53..db7388a16e 100644
--- a/java/org/apache/tomcat/util/http/LocalStrings_fr.properties
+++ b/java/org/apache/tomcat/util/http/LocalStrings_fr.properties
@@ -20,9 +20,9 @@ cookies.invalidSameSiteCookies=Valeur inconnue [{0}], seules
possibles : unset,
cookies.invalidSpecial=Cookie spécial inconnu
cookies.maxCountFail=Le nombre maximum de cookies [{0}] est dépassé
-headers.maxCountFail=Le nombre d''en-têtes [{0}] dépasse le maximum autorisé
+cookiesWithoutEquals.invalid=La valeur [{0}] n''est pas reconnue
-noEqualsCookie.invalid=La valeur [{0}] n''est pas reconnue
+headers.maxCountFail=Le nombre d''en-têtes [{0}] dépasse le maximum autorisé
parameters.bytes=Début du traitement avec les données [{0}]
parameters.copyFail=Echec de la copie des valeurs de paramètres originaux pour
raisons de journalisation du déboguage
diff --git a/java/org/apache/tomcat/util/http/LocalStrings_ko.properties
b/java/org/apache/tomcat/util/http/LocalStrings_ko.properties
index 8fd24e7ae9..0201ec44ec 100644
--- a/java/org/apache/tomcat/util/http/LocalStrings_ko.properties
+++ b/java/org/apache/tomcat/util/http/LocalStrings_ko.properties
@@ -20,9 +20,9 @@ cookies.invalidSameSiteCookies=알 수 없는 설정 값: [{0}]. 반드시 다
cookies.invalidSpecial=쿠키들: 알 수 없는 특별한 쿠키
cookies.maxCountFail=허용된 최대 쿠키 개수 [{0}]을(를) 초과한 쿠키들이 탐지되었습니다.
-headers.maxCountFail=최대 허용 헤더 개수 [{0}]보다 더 많은 헤더들이 탐지되었습니다.
+cookiesWithoutEquals.invalid=해당 값 [{0}]은(는) 인식되지 않습니다.
-noEqualsCookie.invalid=해당 값 [{0}]은(는) 인식되지 않습니다.
+headers.maxCountFail=최대 허용 헤더 개수 [{0}]보다 더 많은 헤더들이 탐지되었습니다.
parameters.bytes=입력 [{0}]을(를) 사용하여 처리를 시작합니다.
parameters.copyFail=디버그 로그를 위한 원래의 파라미터 값들을 복사하지 못했습니다.
diff --git a/java/org/apache/tomcat/util/http/LocalStrings_zh_CN.properties
b/java/org/apache/tomcat/util/http/LocalStrings_zh_CN.properties
index 105b70fcad..85a519d978 100644
--- a/java/org/apache/tomcat/util/http/LocalStrings_zh_CN.properties
+++ b/java/org/apache/tomcat/util/http/LocalStrings_zh_CN.properties
@@ -20,9 +20,9 @@ cookies.invalidSameSiteCookies=未知设置[{0}],必须是以下之一:unset
cookies.invalidSpecial=Cookies:未知特殊的Cookie
cookies.maxCountFail=检测到超过Cookie最大允许的数量[{0}]
-headers.maxCountFail=检测到超过了允许设置的最大header 数[{0}]
+cookiesWithoutEquals.invalid=值[{0}]未识别
-noEqualsCookie.invalid=值[{0}]未识别
+headers.maxCountFail=检测到超过了允许设置的最大header 数[{0}]
parameters.bytes=开始处理输入[{0}]
parameters.copyFail=无法创建以调试日志记录为目的的原始参数值的副本
diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
index 06060aa5ba..4fc165931f 100644
--- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
@@ -92,7 +92,7 @@ public class Rfc6265CookieProcessor extends
CookieProcessorBase {
ByteChunk bc = cookieValue.getByteChunk();
Cookie.parseCookie(bc.getBytes(), bc.getStart(),
bc.getLength(), serverCookies,
- getNoEqualsCookieInternal());
+ getCookiesWithoutEqualsInternal());
}
// search from the next position
diff --git a/java/org/apache/tomcat/util/http/parser/Cookie.java
b/java/org/apache/tomcat/util/http/parser/Cookie.java
index dfbd7da9a7..ef6e48dfe1 100644
--- a/java/org/apache/tomcat/util/http/parser/Cookie.java
+++ b/java/org/apache/tomcat/util/http/parser/Cookie.java
@@ -20,7 +20,7 @@ import java.nio.charset.StandardCharsets;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.http.NoEqualsCookie;
+import org.apache.tomcat.util.http.CookiesWithoutEquals;
import org.apache.tomcat.util.http.ServerCookie;
import org.apache.tomcat.util.http.ServerCookies;
import org.apache.tomcat.util.log.UserDataHelper;
@@ -102,21 +102,21 @@ public class Cookie {
*/
@Deprecated
public static void parseCookie(byte[] bytes, int offset, int len,
ServerCookies serverCookies) {
- parseCookie(bytes, offset, len, serverCookies, NoEqualsCookie.NAME);
+ parseCookie(bytes, offset, len, serverCookies,
CookiesWithoutEquals.NAME);
}
/**
* Parse byte array as cookie header.
*
- * @param bytes Source
- * @param offset Start point in array
- * @param len Number of bytes to read
- * @param serverCookies Structure to store results
- * @param noEqualsCookie How to handle a cookie name-value-pair that does
not contain an equals character
+ * @param bytes Source
+ * @param offset Start point in array
+ * @param len Number of bytes to read
+ * @param serverCookies Structure to store results
+ * @param cookiesWithoutEquals How to handle a cookie name-value-pair that
does not contain an equals character
*/
public static void parseCookie(byte[] bytes, int offset, int len,
ServerCookies serverCookies,
- NoEqualsCookie noEqualsCookie) {
+ CookiesWithoutEquals cookiesWithoutEquals) {
// ByteBuffer is used throughout this parser as it allows the byte[]
// and position information to be easily passed between parsing methods
@@ -161,7 +161,7 @@ public class Cookie {
if (name.hasRemaining()) {
if (value == null) {
- switch (noEqualsCookie) {
+ switch (cookiesWithoutEquals) {
case IGNORE: {
// This name-value-pair is a NO-OP
break;
diff --git a/test/org/apache/tomcat/util/http/TestCookieParsing.java
b/test/org/apache/tomcat/util/http/TestCookieParsing.java
index eaf4f8cafa..04a3b9cbe6 100644
--- a/test/org/apache/tomcat/util/http/TestCookieParsing.java
+++ b/test/org/apache/tomcat/util/http/TestCookieParsing.java
@@ -75,26 +75,26 @@ public class TestCookieParsing extends TomcatBaseTest {
@Test
public void testRfc6265NameOrValueOnlyName() throws Exception {
- doTestRfc6265NoEquals("name",
COOKIES_WITH_NAME_OR_VALUE_ONLY_NAME_CONCAT);
+ doTestRfc6265WithoutEquals("name",
COOKIES_WITH_NAME_OR_VALUE_ONLY_NAME_CONCAT);
}
@Test
public void testRfc6265NameOrValueOnlyIgnore() throws Exception {
- doTestRfc6265NoEquals("ignore",
COOKIES_WITH_NAME_OR_VALUE_ONLY_IGNORE_CONCAT);
+ doTestRfc6265WithoutEquals("ignore",
COOKIES_WITH_NAME_OR_VALUE_ONLY_IGNORE_CONCAT);
}
@Test
public void testRfc6265NameOrValueOnlyDefault() throws Exception {
- doTestRfc6265NoEquals(null,
COOKIES_WITH_NAME_OR_VALUE_ONLY_NAME_CONCAT);
+ doTestRfc6265WithoutEquals(null,
COOKIES_WITH_NAME_OR_VALUE_ONLY_NAME_CONCAT);
}
- private void doTestRfc6265NoEquals(String noEqualsCookie, String expected)
throws Exception {
+ private void doTestRfc6265WithoutEquals(String cookiesWithoutEquals,
String expected) throws Exception {
Rfc6265CookieProcessor cookieProcessor = new Rfc6265CookieProcessor();
- if (noEqualsCookie != null) {
- cookieProcessor.setNoEqualsCookie(noEqualsCookie);
+ if (cookiesWithoutEquals != null) {
+ cookieProcessor.setCookiesWithoutEquals(cookiesWithoutEquals);
}
TestCookieParsingClient client = new
TestCookieParsingClient(cookieProcessor, COOKIES_WITH_NAME_OR_VALUE_ONLY,
expected);
diff --git a/test/org/apache/tomcat/util/http/TestCookies.java
b/test/org/apache/tomcat/util/http/TestCookies.java
index 99788cd352..d3bd4d6be3 100644
--- a/test/org/apache/tomcat/util/http/TestCookies.java
+++ b/test/org/apache/tomcat/util/http/TestCookies.java
@@ -56,7 +56,7 @@ public class TestCookies {
@Test
- public void testNameOnlyAreDroppedRfc6265NoEqualsName() {
+ public void testNameOnlyAreDroppedRfc6265WithoutEqualsName() {
// Name only cookies are not dropped in RFC6265
test("foo=;a=b; ;", NAME, FOO_EMPTY, A);
test("foo;a=b; ;", NAME, FOO_EMPTY, A);
@@ -78,7 +78,7 @@ public class TestCookies {
@Test
- public void testNameOnlyAreDroppedRfc6265NoEqualsIgnore() {
+ public void testNameOnlyAreDroppedRfc6265WithoutEqualsIgnore() {
// Name only cookies are not dropped in RFC6265
test("foo=;a=b; ;", IGNORE, FOO_EMPTY, A);
test("foo;a=b; ;", IGNORE, A);
@@ -100,7 +100,7 @@ public class TestCookies {
@Test
- public void testNameOnlyAreDroppedRfc6265NoEqualsDefault() {
+ public void testNameOnlyAreDroppedRfc6265WithoutEqualsDefault() {
// Name only cookies are not dropped in RFC6265
test("foo=;a=b; ;", FOO_EMPTY, A);
test("foo;a=b; ;", FOO_EMPTY, A);
@@ -128,7 +128,7 @@ public class TestCookies {
}
@Test
- public void testEmptyPairsRfc6265NoEqualsCookieName() {
+ public void testEmptyPairsRfc6265CookiesWithoutEqualsName() {
test("foo;a=b; ;bar", NAME, FOO_EMPTY, A, BAR_EMPTY);
test("foo;a=b;;bar", NAME, FOO_EMPTY, A, BAR_EMPTY);
test("foo;a=b; ;;bar=rab", NAME, FOO_EMPTY, A, BAR);
@@ -139,7 +139,7 @@ public class TestCookies {
@Test
- public void testEmptyPairsRfc6265NoEqualsCookieIgnore() {
+ public void testEmptyPairsRfc6265CookiesWithoutEqualsIgnore() {
test("foo;a=b; ;bar", IGNORE, A);
test("foo;a=b;;bar", IGNORE, A);
test("foo;a=b; ;;bar=rab", IGNORE, A, BAR);
@@ -150,7 +150,7 @@ public class TestCookies {
@Test
- public void testEmptyPairsRfc6265NoEqualsCookieDefault() {
+ public void testEmptyPairsRfc6265CookiesWithoutEqualsDefault() {
test("foo;a=b; ;bar", FOO_EMPTY, A, BAR_EMPTY);
test("foo;a=b;;bar", FOO_EMPTY, A, BAR_EMPTY);
test("foo;a=b; ;;bar=rab", FOO_EMPTY, A, BAR);
@@ -360,13 +360,13 @@ public class TestCookies {
}
- private void test(String header, String noEqualsCookie, Cookie...
expected) {
+ private void test(String header, String cookiesWithoutEquals, Cookie...
expected) {
MimeHeaders mimeHeaders = new MimeHeaders();
ServerCookies serverCookies = new ServerCookies(4);
Rfc6265CookieProcessor cookieProcessor = new Rfc6265CookieProcessor();
- if (noEqualsCookie != null) {
- cookieProcessor.setNoEqualsCookie(noEqualsCookie);
+ if (cookiesWithoutEquals != null) {
+ cookieProcessor.setCookiesWithoutEquals(cookiesWithoutEquals);
}
MessageBytes cookieHeaderValue = mimeHeaders.addValue("Cookie");
byte[] bytes = header.getBytes(StandardCharsets.UTF_8);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0683832046..4f5fd60df5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -115,7 +115,7 @@
data rather than return the data it had already received. (markt)
</fix>
<add>
- Add a new attribute <code>noEqualsCookie</code> to the
+ Add a new attribute <code>cookiesWithoutEquals</code> to the
<code>Rfc6265CookieProcessor</code>. The default behaviour is
unchanged.
(markt)
</add>
diff --git a/webapps/docs/config/cookie-processor.xml
b/webapps/docs/config/cookie-processor.xml
index 49e53a3513..3111f6ae18 100644
--- a/webapps/docs/config/cookie-processor.xml
+++ b/webapps/docs/config/cookie-processor.xml
@@ -99,7 +99,7 @@
<attributes>
- <attribute name="noEqualsCookie" required="false">
+ <attribute name="cookiesWithoutEquals" required="false">
<p>Determines how a cookie received from a user agent should be
interpreted when the name value pair does not contain an equals sign.
The default value is <code>name</code> which means that the cookie will
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]