Hi Mark, response.getStatus() should be identical I mean it is json eval
On Fri, 19 Jul 2024, 20:39 , <ma...@apache.org> wrote: > 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 > > commit ff7a869fd203b3b60ffd699c47da1d07e77f0c3a > Author: Mark Thomas <ma...@apache.org> > AuthorDate: Thu Jul 4 14:15:50 2024 +0100 > > Refactor writing of the status code > > This refactoring is part of the preparation for RFC 8297 (Early Hints) > support. > --- > java/org/apache/coyote/http11/Http11OutputBuffer.java | 14 +++++++++++++- > java/org/apache/coyote/http11/Http11Processor.java | 4 ++-- > 2 files changed, 15 insertions(+), 3 deletions(-) > > diff --git a/java/org/apache/coyote/http11/Http11OutputBuffer.java > b/java/org/apache/coyote/http11/Http11OutputBuffer.java > index be7955c1b0..76fdb0d126 100644 > --- a/java/org/apache/coyote/http11/Http11OutputBuffer.java > +++ b/java/org/apache/coyote/http11/Http11OutputBuffer.java > @@ -320,14 +320,26 @@ public class Http11OutputBuffer implements > HttpOutputBuffer { > > /** > * Send the response status line. > + * > + * @deprecated Unused. Will be removed in Tomcat 11. Use {@link > #sendStatus(int)}. > */ > + @Deprecated > public void sendStatus() { > + sendStatus(response.getStatus()); > + } > + > + > + /** > + * Send the response status line. > + * > + * @param status The HTTP status code to include in the status line > + */ > + public void sendStatus(int status) { > // Write protocol name > write(Constants.HTTP_11_BYTES); > headerBuffer.put(Constants.SP); > > // Write status code > - int status = response.getStatus(); > switch (status) { > case 200: > write(Constants._200_BYTES); > diff --git a/java/org/apache/coyote/http11/Http11Processor.java > b/java/org/apache/coyote/http11/Http11Processor.java > index 681db0e96b..f6f34e8f45 100644 > --- a/java/org/apache/coyote/http11/Http11Processor.java > +++ b/java/org/apache/coyote/http11/Http11Processor.java > @@ -1037,7 +1037,7 @@ public class Http11Processor extends > AbstractProcessor { > > // Build the response header > try { > - outputBuffer.sendStatus(); > + outputBuffer.sendStatus(response.getStatus()); > > int size = headers.size(); > for (int i = 0; i < size; i++) { > @@ -1054,7 +1054,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(); > + outputBuffer.sendStatus(response.getStatus()); > } > } > outputBuffer.endHeaders(); > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >