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 ced5a9506f Fix off-by-error causing first response header to be
dropped.
ced5a9506f is described below
commit ced5a9506f1922859905f24685928467304c2d59
Author: Mark Thomas <[email protected]>
AuthorDate: Fri May 3 15:54:15 2024 +0100
Fix off-by-error causing first response header to be dropped.
Fix based on #710 by foremans.
---
java/org/apache/coyote/http11/Http11Processor.java | 3 ++-
test/org/apache/coyote/http11/TestHttp11OutputBuffer.java | 1 +
webapps/docs/changelog.xml | 9 +++++++--
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/coyote/http11/Http11Processor.java
b/java/org/apache/coyote/http11/Http11Processor.java
index b9e65ad6bb..f1f3fb9501 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -1054,7 +1054,8 @@ public class Http11Processor extends AbstractProcessor {
size--;
// Header buffer is corrupted. Reset it and start again.
outputBuffer.resetHeaderBuffer();
- i = 0;
+ // -1 as it will be incremented at the start of the loop
and header indexes start at 0.
+ i = -1;
outputBuffer.sendStatus();
}
}
diff --git a/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
b/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
index 00a4664d75..4f63cb13f6 100644
--- a/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
+++ b/test/org/apache/coyote/http11/TestHttp11OutputBuffer.java
@@ -110,6 +110,7 @@ public class TestHttp11OutputBuffer extends TomcatBaseTest {
Assert.assertEquals(HttpServletResponse.SC_OK, rc);
List<String> values =
resHeaders.get(HeaderServlet.CUSTOM_HEADER_NAME);
Assert.assertNull(values);
+ Assert.assertEquals(5, resHeaders.size());
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 146b88150e..96cae84eb1 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -138,7 +138,7 @@
</fix>
<fix>
Remove MBean metadata for attibutes that have been removed. Based on
- <pr>719</pr> by Shawn Q. (markt)
+ pull request <pr>719</pr> by Shawn Q. (markt)
</fix>
</changelog>
</subsection>
@@ -179,6 +179,11 @@
<fix>
Fix non-blocking reads of chunked request bodies. (markt)
</fix>
+ <fix>
+ When an invalid HTTP response header was dropped, an off-by-one error
+ meant that the first header in the response was also dropped. Fix based
+ on pull request <pr>710</pr> by foremans. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
@@ -361,7 +366,7 @@
<changelog>
<fix>
Minor performance improvement for building filter chains. Based on
- ideas from <pr>702</pr> by Luke Miao. (remm)
+ ideas from pull request <pr>702</pr> by Luke Miao. (remm)
</fix>
<fix>
Align error handling for <code>Writer</code> and
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]