You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2023/07/12 18:29:47 UTC
[tomee] 04/07: TOMEE-4230 - Backports formatting / refactoring changes
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch tomee-9.x
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 562fbba879dc01c9de39507a2763762b258c3d36
Author: Richard Zowalla <13...@users.noreply.github.com>
AuthorDate: Mon Jul 3 19:59:24 2023 +0200
TOMEE-4230 - Backports formatting / refactoring changes
(cf. https://github.com/apache/tomcat/commit/9bcdc19334e959dcd8e98b689b5a86405e4e2198)
---
.../java/org/apache/coyote/ajp/AjpProcessor.java | 29 +++++++++++-----------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/tomee/apache-tomee/src/patch/java/org/apache/coyote/ajp/AjpProcessor.java b/tomee/apache-tomee/src/patch/java/org/apache/coyote/ajp/AjpProcessor.java
index 991a31d0f2..198ce6c3d1 100644
--- a/tomee/apache-tomee/src/patch/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/tomee/apache-tomee/src/patch/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -960,11 +960,6 @@ public class AjpProcessor extends AbstractProcessor {
response.setCommitted(true);
- tmpMB.recycle();
- responseMsgPos = -1;
- responseMessage.reset();
- responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
-
// Responses with certain status codes and/or methods are not permitted to include a response body.
int statusCode = response.getStatus();
if (statusCode < 200 || statusCode == 204 || statusCode == 205 || statusCode == 304 ||
@@ -973,14 +968,7 @@ public class AjpProcessor extends AbstractProcessor {
swallowResponse = true;
}
- // HTTP header contents
- responseMessage.appendInt(statusCode);
- // Reason phrase is optional but mod_jk + httpd 2.x fails with a null
- // reason phrase - bug 45026
- tmpMB.setString(Integer.toString(response.getStatus()));
- responseMessage.appendBytes(tmpMB);
-
- // Special headers
+ // Prepare special headers
MimeHeaders headers = response.getMimeHeaders();
String contentType = response.getContentType();
if (contentType != null) {
@@ -995,7 +983,20 @@ public class AjpProcessor extends AbstractProcessor {
headers.setValue("Content-Length").setLong(contentLength);
}
- // Other headers
+ // Write AJP message header
+ tmpMB.recycle();
+ responseMsgPos = -1;
+ responseMessage.reset();
+ responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
+
+ // Write HTTP response line
+ responseMessage.appendInt(statusCode);
+ // Reason phrase is optional but mod_jk + httpd 2.x fails with a null
+ // reason phrase - bug 45026
+ tmpMB.setString(Integer.toString(response.getStatus()));
+ responseMessage.appendBytes(tmpMB);
+
+ // Write headers
int numHeaders = headers.size();
responseMessage.appendInt(numHeaders);
for (int i = 0; i < numHeaders; i++) {