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


The following commit(s) were added to refs/heads/main by this push:
     new 6280d27454 Refactor code to use constant rather than literal for 103 
status code
6280d27454 is described below

commit 6280d274544a8eeba14f1e27062a5be25315dfcf
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Nov 22 18:53:32 2024 +0000

    Refactor code to use constant rather than literal for 103 status code
---
 java/org/apache/coyote/http11/Http11Processor.java | 2 +-
 java/org/apache/coyote/http2/Stream.java           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index afdef54424..437e8a028e 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -1250,7 +1250,7 @@ public class Http11Processor extends AbstractProcessor {
 
     @Override
     protected void earlyHints() throws IOException {
-        writeHeaders(103, response.getMimeHeaders());
+        writeHeaders(HttpServletResponse.SC_EARLY_HINTS, 
response.getMimeHeaders());
         outputBuffer.writeHeaders();
         outputBuffer.resetHeaderBuffer();
     }
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 7d959e321e..2efe820f3a 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -31,6 +31,7 @@ import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Supplier;
 
 import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.http.HttpServletResponse;
 
 import org.apache.coyote.ActionCode;
 import org.apache.coyote.CloseNowException;
@@ -604,7 +605,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
     final void writeEarlyHints() throws IOException {
         MimeHeaders headers = coyoteResponse.getMimeHeaders();
         String originalStatus = headers.getHeader(":status");
-        headers.setValue(":status").setString("103");
+        
headers.setValue(":status").setString(Integer.toString(HttpServletResponse.SC_EARLY_HINTS));
         try {
             handler.writeHeaders(this, headers, false, 
Constants.DEFAULT_HEADERS_FRAME_SIZE);
         } finally {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to