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
commit 5bb7db277a66d5f60ea8dac47249d53e83f54f79 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 7a7b17faf8..045c2ed8b1 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -1036,9 +1036,15 @@ public class Http11Processor extends AbstractProcessor { headers.setValue("Server").setString(server); } - // 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++) { @@ -1055,7 +1061,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(); @@ -1066,10 +1072,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