This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 889305f1dc Better handling of duplicate content-length
889305f1dc is described below
commit 889305f1dc5bbf37efeadd2874f72c9b9dc006cc
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jun 24 22:52:27 2026 +0100
Better handling of duplicate content-length
---
java/org/apache/catalina/ha/backend/TcpSender.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/ha/backend/TcpSender.java
b/java/org/apache/catalina/ha/backend/TcpSender.java
index 26af09243a..8b13950894 100644
--- a/java/org/apache/catalina/ha/backend/TcpSender.java
+++ b/java/org/apache/catalina/ha/backend/TcpSender.java
@@ -185,18 +185,21 @@ public class TcpSender implements Sender {
// read all the headers.
String header = connectionReaders[i].readLine();
int contentLength = 0;
+ boolean contentLengthSeen = false;
while (header != null && !header.isEmpty()) {
int colon = header.indexOf(':');
if (colon >= 0) {
String headerName = header.substring(0, colon).trim();
String headerValue = header.substring(colon +
1).trim();
if ("content-length".equalsIgnoreCase(headerName)) {
- if (contentLength > 0) {
+ if (contentLengthSeen) {
log.error(sm.getString("tcpSender.duplicateContentLength"));
close(i);
// Clear any content length if one has been
read.
contentLength = 0;
break;
+ } else {
+ contentLengthSeen = true;
}
try {
contentLength = Integer.parseInt(headerValue);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]