This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 1c4a89a7a3 Fix regression following fix for 69967
1c4a89a7a3 is described below

commit 1c4a89a7a35cb89e3ee4f6b84a28fb28d638858d
Author: remm <[email protected]>
AuthorDate: Mon Apr 13 15:05:43 2026 +0200

    Fix regression following fix for 69967
    
    The two special headers get added during commit.
    BZ70000
---
 java/org/apache/catalina/connector/Response.java | 12 +++++++-----
 webapps/docs/changelog.xml                       |  4 ++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 7e4f5380dc..01b5a930a9 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -820,11 +820,13 @@ public class Response implements HttpServletResponse {
         for (int i = 0; i < n; i++) {
             result.add(headers.getName(i).toString());
         }
-        if (getCoyoteResponse().getContentType() != null) {
-            result.add("Content-Type");
-        }
-        if (getCoyoteResponse().getContentLengthLong() != -1) {
-            result.add("Content-Length");
+        if (!getCoyoteResponse().isCommitted()) {
+            if (getCoyoteResponse().getContentType() != null) {
+                result.add("Content-Type");
+            }
+            if (getCoyoteResponse().getContentLengthLong() != -1) {
+                result.add("Content-Length");
+            }
         }
         return result;
     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4471af1d01..ab15662278 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
         Align the escaping in <code>ExtendedAccessLogValve</code> with the 
other
         <code>AccessLogValve</code> implementations. (markt)
       </fix>
+      <fix>
+        <bug>70000</bug>: fix duplication of special headers in the response
+        after commit, following fix for <bug>69967</bug>. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to