You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/12/12 11:38:14 UTC
(tomcat) branch main updated (7a60e1d22f -> d40728a3f4)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from 7a60e1d22f Refactoring
new b2c84dde30 Reduce duplication
new 02cb64167c Expand testing of If-Match and If-Unmodified-Since combinations
new d40728a3f4 Add a test for an invalid date precondition
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
...efaultServletRfc9110Section13Parameterized.java | 92 ++++++++++++----------
1 file changed, 49 insertions(+), 43 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 03/03: Add a test for an invalid date precondition
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit d40728a3f469eda2fd62faf084c564489105939e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Dec 12 11:35:08 2024 +0000
Add a test for an invalid date precondition
---
.../servlets/TestDefaultServletRfc9110Section13Parameterized.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
index c653cdbb1d..10c2b1d4e4 100644
--- a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
+++ b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
@@ -96,6 +96,8 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
null, Boolean.FALSE, SC_200 });
parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null,
null, null, Boolean.FALSE, SC_200 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.INVALID, null,
+ null, null, Boolean.FALSE, SC_200 });
// Ensure If-Unmodified-Since takes precedence over If-Modified-Since
// If-Unmodified-Since only
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/03: Expand testing of If-Match and If-Unmodified-Since combinations
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 02cb64167c35474522237cc293da31f256e01504
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Dec 12 11:30:48 2024 +0000
Expand testing of If-Match and If-Unmodified-Since combinations
---
...efaultServletRfc9110Section13Parameterized.java | 48 ++++++++++++++++------
1 file changed, 35 insertions(+), 13 deletions(-)
diff --git a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
index e3948e5ab9..c653cdbb1d 100644
--- a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
+++ b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
@@ -70,19 +70,24 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
public static Collection<Object[]> parameters() {
List<Object[]> parameterSets = new ArrayList<>();
for (Boolean useStrongEtag : booleans) {
- // RFC 9110, Section 13.2.2, Step 1, HEAD
- parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null, null,
- null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412});
- parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null,
- null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412 });
- parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null,
- null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER,
- null, null, null, null, Boolean.FALSE, SC_400 });
+ // RFC 9110, Section 13.2.2, Step 1, HEAD: If-Match with and without If-Unmodified-Since
+ for (DatePrecondition dateCondition : DatePrecondition.values()) {
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL,
+ dateCondition, null, null, null, Boolean.FALSE, SC_200 });
+ parameterSets.add(
+ new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, dateCondition,
+ null, null, null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412 });
+ parameterSets
+ .add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, dateCondition,
+ null, null, null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN,
+ dateCondition, null, null, null, Boolean.FALSE, SC_412 });
+ parameterSets.add(
+ new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER,
+ dateCondition, null, null, null, Boolean.FALSE, SC_400 });
+ }
- // RFC 9110, Section 13.2.2, Step 2, HEAD
+ // RFC 9110, Section 13.2.2, Step 2, HEAD: If-Unmodified-Since only
parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null,
null, Boolean.FALSE, SC_200 });
parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null,
@@ -91,6 +96,15 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
null, Boolean.FALSE, SC_200 });
parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null,
null, null, Boolean.FALSE, SC_200 });
+
+ // Ensure If-Unmodified-Since takes precedence over If-Modified-Since
+ // If-Unmodified-Since only
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null,
+ null, Boolean.FALSE, SC_412 });
+ // If-Modified-Since only
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, null, null, DatePrecondition.GT,
+ null, Boolean.FALSE, SC_304 });
+ // Both
parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null,
DatePrecondition.GT, null, Boolean.FALSE, SC_412 });
}
@@ -100,6 +114,7 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
private static Integer SC_200 = Integer.valueOf(200);
+ private static Integer SC_304 = Integer.valueOf(304);
private static Integer SC_400 = Integer.valueOf(400);
private static Integer SC_412 = Integer.valueOf(412);
@@ -174,7 +189,11 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
/**
* not a valid HTTP-date
*/
- INVALID;
+ INVALID,
+ /**
+ * None.
+ */
+ NONE;
}
@@ -244,6 +263,9 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
case INVALID:
headerValues.add("2024.12.09 GMT");
break;
+ case NONE:
+ // NO-OP
+ break;
}
if (!headerValues.isEmpty()) {
requestHeaders.put(headerName, headerValues);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/03: Reduce duplication
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit b2c84dde30ebbfb4d9c46fdf9567b727a26fb52c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Dec 12 11:22:44 2024 +0000
Reduce duplication
---
...efaultServletRfc9110Section13Parameterized.java | 68 ++++++++--------------
1 file changed, 25 insertions(+), 43 deletions(-)
diff --git a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
index 9f9b7926b6..e3948e5ab9 100644
--- a/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
+++ b/test/org/apache/catalina/servlets/TestDefaultServletRfc9110Section13Parameterized.java
@@ -69,49 +69,31 @@ public class TestDefaultServletRfc9110Section13Parameterized extends TomcatBaseT
@Parameterized.Parameters(name = "{index} resource-strong [{0}], matchHeader [{1}]")
public static Collection<Object[]> parameters() {
List<Object[]> parameterSets = new ArrayList<>();
- // testPreconditions_rfc9110_13_2_2_1_head0
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null,
- null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER,
- null, null, null, null, Boolean.FALSE, SC_400 });
-
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null,
- null, null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null,
- null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null,
- null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER,
- null, null, null, null, Boolean.FALSE, SC_400 });
-
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null,
- null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.GT, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null,
- null, null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.TRUE, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null,
- DatePrecondition.GT, null, Boolean.FALSE, SC_412 });
-
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null,
- null, Boolean.FALSE, SC_412 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.GT, null, null,
- null, Boolean.FALSE, SC_200 });
- parameterSets.add(new Object[] { Boolean.FALSE, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null,
- null, null, Boolean.FALSE, SC_200 });
-
+ for (Boolean useStrongEtag : booleans) {
+ // RFC 9110, Section 13.2.2, Step 1, HEAD
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.ALL, null, null, null,
+ null, Boolean.FALSE, SC_200 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.EXACTLY, null, null, null,
+ null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412});
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.IN, null, null, null,
+ null, Boolean.FALSE, useStrongEtag.booleanValue() ? SC_200 : SC_412 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.NOT_IN, null, null, null,
+ null, Boolean.FALSE, SC_412 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, EtagPrecondition.INVALID_ALL_PLUS_OTHER,
+ null, null, null, null, Boolean.FALSE, SC_400 });
+
+ // RFC 9110, Section 13.2.2, Step 2, HEAD
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.EQ, null, null,
+ null, Boolean.FALSE, SC_200 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null, null,
+ null, Boolean.FALSE, SC_412 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.GT, null, null,
+ null, Boolean.FALSE, SC_200 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.MULTI_IN, null,
+ null, null, Boolean.FALSE, SC_200 });
+ parameterSets.add(new Object[] { useStrongEtag, Task.HEAD_INDEX_HTML, null, DatePrecondition.LT, null,
+ DatePrecondition.GT, null, Boolean.FALSE, SC_412 });
+ }
return parameterSets;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org