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 2023/01/20 17:07:08 UTC
[tomcat] branch main updated: Update terminology - thanks to review by kkolinko
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
The following commit(s) were added to refs/heads/main by this push:
new e0b25a379e Update terminology - thanks to review by kkolinko
e0b25a379e is described below
commit e0b25a379e1653874521595f9dcb0d42e9591ab6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 20 10:53:44 2023 +0000
Update terminology - thanks to review by kkolinko
---
java/org/apache/coyote/http11/Http11Processor.java | 2 ++
java/org/apache/coyote/http2/StreamProcessor.java | 3 ++-
test/jakarta/servlet/http/HttpServletDoHeadBaseTest.java | 9 ++++++---
test/jakarta/servlet/http/TestHttpServlet.java | 6 +++---
webapps/docs/changelog.xml | 5 +++--
5 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java
index 951d276593..ac23d73128 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -1057,6 +1057,8 @@ public class Http11Processor extends AbstractProcessor {
headers.setValue("Server").setString(server);
}
+ // Exclude some HTTP header fields where the value is determined only
+ // while generating the content as per section 9.3.2 of RFC 9110.
if (head) {
headers.removeHeader("content-length");
headers.removeHeader("content-range");
diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java
index acd9dce237..dba23bd09c 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -221,7 +221,8 @@ class StreamProcessor extends AbstractProcessor {
headers.addValue("date").setString(FastHttpDateFormat.getCurrentDate());
}
- // Remove payload headers for HEAD requests
+ // Exclude some HTTP header fields where the value is determined only
+ // while generating the content as per section 9.3.2 of RFC 9110.
if (coyoteRequest != null && "HEAD".equals(coyoteRequest.method().toString())) {
headers.removeHeader("content-length");
headers.removeHeader("content-range");
diff --git a/test/jakarta/servlet/http/HttpServletDoHeadBaseTest.java b/test/jakarta/servlet/http/HttpServletDoHeadBaseTest.java
index e513be2430..a8842431f3 100644
--- a/test/jakarta/servlet/http/HttpServletDoHeadBaseTest.java
+++ b/test/jakarta/servlet/http/HttpServletDoHeadBaseTest.java
@@ -97,8 +97,9 @@ public class HttpServletDoHeadBaseTest extends Http2TestBase {
// Headers should be the same part from:
// - Date header may be different
- // - HEAD requests don't include payload headers
- // (RFC 7231, section 4.3.2)
+ // Exclude some HTTP header fields where the value is determined only
+ // while generating the content as per section 9.3.2 of RFC 9110.
+ // (previously RFC 7231, section 4.3.2)
getHeaders.remove("content-length");
getHeaders.remove("content-range");
getHeaders.remove("trailer");
@@ -168,7 +169,9 @@ public class HttpServletDoHeadBaseTest extends Http2TestBase {
int i = 0;
int j = 0;
for (; i < getHeaders.length; i++) {
- // Ignore payload headers
+ // Exclude some HTTP header fields where the value is determined
+ // only while generating the content as per section 9.3.2 of RFC
+ // 9110.
if (getHeaders[i].contains("content-length") || getHeaders[i].contains("content-range") ) {
// Skip
} else {
diff --git a/test/jakarta/servlet/http/TestHttpServlet.java b/test/jakarta/servlet/http/TestHttpServlet.java
index 077467454e..03a78c46e3 100644
--- a/test/jakarta/servlet/http/TestHttpServlet.java
+++ b/test/jakarta/servlet/http/TestHttpServlet.java
@@ -47,7 +47,7 @@ public class TestHttpServlet extends TomcatBaseTest {
/*
* Nature of test has changed from original bug report since content-length
- * is no longer returned for HEAD requests as allowed by RFC 7231.
+ * is no longer returned for HEAD requests as allowed by RFC 9110.
*/
@Test
public void testBug53454() throws Exception {
@@ -181,7 +181,7 @@ public class TestHttpServlet extends TomcatBaseTest {
int rc = getUrl(path, out, getHeaders);
Assert.assertEquals(HttpServletResponse.SC_OK, rc);
- removePayloadHeaders(getHeaders);
+ removeGeneratingContentHeaders(getHeaders);
out.recycle();
Map<String,List<String>> headHeaders = new HashMap<>();
@@ -212,7 +212,7 @@ public class TestHttpServlet extends TomcatBaseTest {
* Removes headers that are not expected to appear in the response to the
* equivalent HEAD request.
*/
- private void removePayloadHeaders(Map<String,List<String>> headers) {
+ private void removeGeneratingContentHeaders(Map<String,List<String>> headers) {
headers.remove("content-length");
headers.remove("content-range");
headers.remove("trailer");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 32076954cb..38d2b08b10 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -126,8 +126,9 @@
that accept <code>Charset</code> objects. (markt)
</add>
<update>
- The default HEAD response no longer includes the payload HTTP header
- fields as per section 9.3.2 of RFC 9110. (markt)
+ The default HEAD response no longer includes some HTTP header fields
+ where the value is determined only while generating the content as per
+ section 9.3.2 of RFC 9110. (markt)
</update>
</changelog>
</subsection>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org