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 ab8c8a800e Expand testing of If-Match and If-Unmodified-Since
combinations
ab8c8a800e is described below
commit ab8c8a800edcbd4acf4fbfb35a039b78168990ff
Author: Mark Thomas <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]