This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new aaf5c58644 Add regression tests for BZ 69478.
aaf5c58644 is described below
commit aaf5c58644e1d6fe8f7a49c869bde11c10a02976
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Nov 27 12:24:33 2024 +0000
Add regression tests for BZ 69478.
PR #787 by Thomas Krisch
---
test/jakarta/servlet/http/TestCookie.java | 30 ++++++++++++++++++++++++++++++
webapps/docs/changelog.xml | 4 ++++
2 files changed, 34 insertions(+)
diff --git a/test/jakarta/servlet/http/TestCookie.java
b/test/jakarta/servlet/http/TestCookie.java
index 27268be23c..a6ec8f758c 100644
--- a/test/jakarta/servlet/http/TestCookie.java
+++ b/test/jakarta/servlet/http/TestCookie.java
@@ -57,6 +57,8 @@ public class TestCookie {
Assert.assertNull(cookie.getValue());
Assert.assertEquals(0, cookie.getVersion());
Assert.assertEquals(-1, cookie.getMaxAge());
+ Assert.assertFalse(cookie.isHttpOnly());
+ Assert.assertFalse(cookie.getSecure());
}
@SuppressWarnings("removal")
@@ -145,6 +147,34 @@ public class TestCookie {
}
}
+ @Test
+ public void testHttpOnlySet() {
+ Cookie cookie = new Cookie("name", "value");
+ cookie.setHttpOnly(true);
+ Assert.assertTrue(cookie.isHttpOnly());
+ }
+
+ @Test
+ public void testHttpOnlyUnset() {
+ Cookie cookie = new Cookie("name", "value");
+ cookie.setHttpOnly(false);
+ Assert.assertFalse(cookie.isHttpOnly());
+ }
+
+ @Test
+ public void testSecureSet() {
+ Cookie cookie = new Cookie("name", "value");
+ cookie.setSecure(true);
+ Assert.assertTrue(cookie.getSecure());
+ }
+
+ @Test
+ public void testSecureUnset() {
+ Cookie cookie = new Cookie("name", "value");
+ cookie.setSecure(false);
+ Assert.assertFalse(cookie.getSecure());
+ }
+
@Test
public void testAttribute01() {
Cookie cookie = new Cookie("name", "value");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e52a42dfd5..dd21cbf2e8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -199,6 +199,10 @@
<code>setSecure(boolean)</code> for a cookie, the respective flags were
set regardless of the value passed to the method. (markt)
</fix>
+ <add>
+ <pr>787</pr>: Add regression tests for <bug>69478</bug>. Pull request
+ provided by Thomas Krisch. (markt)
+ </add>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]