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 9979b6b517 Performance optimisation for AJP. Don't swallow body on
error conditions
9979b6b517 is described below
commit 9979b6b5170733ed53de3602a7cfadd35366a63b
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Aug 24 14:42:59 2026 +0100
Performance optimisation for AJP. Don't swallow body on error conditions
---
java/org/apache/coyote/ajp/AjpProcessor.java | 13 +++++++------
webapps/docs/changelog.xml | 4 ++++
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java
b/java/org/apache/coyote/ajp/AjpProcessor.java
index c8cc01c5d5..e718c5ad2c 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -1057,15 +1057,16 @@ public class AjpProcessor extends AbstractProcessor {
return;
}
- // Swallow the unread body packet if present
- if (waitingForBodyMessage || first && request.getContentLengthLong() >
0) {
- refillReadBuffer(true);
- }
-
- // Add the end message
if (getErrorState().isError()) {
+ // Write the end and close message
socketWrapper.write(true, endAndCloseMessageArray, 0,
endAndCloseMessageArray.length);
} else {
+ // Swallow the unread body packet if present
+ if (waitingForBodyMessage || first &&
request.getContentLengthLong() > 0) {
+ refillReadBuffer(true);
+ }
+
+ // Write the end message
socketWrapper.write(true, endMessageArray, 0,
endMessageArray.length);
}
socketWrapper.flush(true);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 64fde35898..0084d5a04e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -394,6 +394,10 @@
Cleaner handling of AJP response headers which overflow the maximum
message size. (remm)
</fix>
+ <fix>
+ Small per performance optimisation. Don't waste cycles swallowing an
AJP
+ response body when the connection is going to be closed. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]