This is an automated email from the ASF dual-hosted git repository.
markt 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 bd22a139cb Refactor. Re-order. No functional change.
bd22a139cb is described below
commit bd22a139cbc30cd4d1a0a674d9cb47b9381dc3c4
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 6b4a203e91..8e8110bdab 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -952,11 +952,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 ||
@@ -965,14 +960,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) {
@@ -987,7 +975,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]