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
commit 2d939ecf4ce214281d6f3db41a6c98fb8134cc47 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jul 4 14:18:16 2024 +0100 Refactoring writing of HTTP headers to separate method This in preparation for RFC 8297 (Early Hints) support that will need to write the current headers without committing the response. --- java/org/apache/coyote/http11/Http11Processor.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index f6f34e8f45..dac9e8e419 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -1035,9 +1035,15 @@ public class Http11Processor extends AbstractProcessor { headers.removeHeader("transfer-encoding"); } - // Build the response header + writeHeaders(response.getStatus(), headers); + + outputBuffer.commit(); + } + + + private void writeHeaders(int status, MimeHeaders headers) { try { - outputBuffer.sendStatus(response.getStatus()); + outputBuffer.sendStatus(status); int size = headers.size(); for (int i = 0; i < size; i++) { @@ -1054,7 +1060,7 @@ public class Http11Processor extends AbstractProcessor { outputBuffer.resetHeaderBuffer(); // -1 as it will be incremented at the start of the loop and header indexes start at 0. i = -1; - outputBuffer.sendStatus(response.getStatus()); + outputBuffer.sendStatus(status); } } outputBuffer.endHeaders(); @@ -1065,10 +1071,9 @@ public class Http11Processor extends AbstractProcessor { outputBuffer.resetHeaderBuffer(); throw t; } - - outputBuffer.commit(); } + private static boolean isConnectionToken(MimeHeaders headers, String token) throws IOException { MessageBytes connection = headers.getValue(Constants.CONNECTION); if (connection == null) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org