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 95ea8ac12f5df68ae7df273372766e344548d515 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jul 4 13:50:37 2024 +0100 Rename method that performs commit to commit() This refactoring is in preparation for RFC 8293 (Early Hints) support. That will introduce a method that writes headers without a commit. This rename will reduce potential confusion between writeHeaders() and sendHeaders(). --- java/org/apache/catalina/connector/OutputBuffer.java | 2 +- java/org/apache/coyote/Response.java | 11 +++++++++++ java/org/apache/coyote/http2/Http2OutputBuffer.java | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/connector/OutputBuffer.java b/java/org/apache/catalina/connector/OutputBuffer.java index de6dbd35fd..ede9343c65 100644 --- a/java/org/apache/catalina/connector/OutputBuffer.java +++ b/java/org/apache/catalina/connector/OutputBuffer.java @@ -282,7 +282,7 @@ public class OutputBuffer extends Writer { try { doFlush = true; if (initial) { - coyoteResponse.sendHeaders(); + coyoteResponse.commit(); initial = false; } if (cb.remaining() > 0) { diff --git a/java/org/apache/coyote/Response.java b/java/org/apache/coyote/Response.java index a7eddfd7ff..01815ce936 100644 --- a/java/org/apache/coyote/Response.java +++ b/java/org/apache/coyote/Response.java @@ -448,8 +448,19 @@ public final class Response { /** * Signal that we're done with the headers, and body will follow. + * + * @deprecated Unused. Will be removed in Tomcat 11 onwards. Use {@link #commit()}. */ + @Deprecated public void sendHeaders() { + commit(); + } + + + /** + * Signal that we're done with the headers, and body will follow. + */ + public void commit() { action(ActionCode.COMMIT, this); setCommitted(true); } diff --git a/java/org/apache/coyote/http2/Http2OutputBuffer.java b/java/org/apache/coyote/http2/Http2OutputBuffer.java index 1de4569900..3d4d6b96c5 100644 --- a/java/org/apache/coyote/http2/Http2OutputBuffer.java +++ b/java/org/apache/coyote/http2/Http2OutputBuffer.java @@ -52,7 +52,7 @@ public class Http2OutputBuffer implements HttpOutputBuffer { @Override public int doWrite(ByteBuffer chunk) throws IOException { if (!coyoteResponse.isCommitted()) { - coyoteResponse.sendHeaders(); + coyoteResponse.commit(); } return next.doWrite(chunk); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org