This is an automated email from the ASF dual-hosted git repository.
markt 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 4a5a1e5f52 Refactor. Re-order. No functional change.
4a5a1e5f52 is described below
commit 4a5a1e5f520625392971c1b5149b5db1cb47bce6
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Mar 6 19:45:51 2023 +0000
Refactor. Re-order. No functional change.
---
java/org/apache/coyote/ajp/AjpProcessor.java | 29 ++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java
b/java/org/apache/coyote/ajp/AjpProcessor.java
index 2b547e0312..d2c0e46169 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -961,11 +961,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 ||
@@ -974,14 +969,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) {
@@ -996,7 +984,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++) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]