Skip to content

Commit

Permalink
Refactor code to use constant rather than literal for 103 status code
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Nov 22, 2024
1 parent 3a17b1d commit 6280d27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion java/org/apache/coyote/http11/Http11Processor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ protected final void ack(ContinueResponseTiming continueResponseTiming) {

@Override
protected void earlyHints() throws IOException {
writeHeaders(103, response.getMimeHeaders());
writeHeaders(HttpServletResponse.SC_EARLY_HINTS, response.getMimeHeaders());
outputBuffer.writeHeaders();
outputBuffer.resetHeaderBuffer();
}
Expand Down
3 changes: 2 additions & 1 deletion java/org/apache/coyote/http2/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.function.Supplier;

import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.coyote.ActionCode;
import org.apache.coyote.CloseNowException;
Expand Down Expand Up @@ -604,7 +605,7 @@ final void writeAck() throws IOException {
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 {
Expand Down

0 comments on commit 6280d27

Please sign in to comment.