This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 573560e980a9e74a6c219a56dec5a4bc47d35ea5 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 cf872a09be..3542625fb7 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -1037,9 +1037,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++) { @@ -1056,7 +1062,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(); @@ -1067,10 +1073,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