This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit de25e1d9d3097df727f27cfe046d0cfe96696125 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jan 9 14:01:18 2025 +0000 Refactor so the buffered data is used directly rather than copied This also aligns with other uses of o.a.catalina.connector.InputBuffer where a pre-populated buffer replaces InputBuffer#bb rather than the data being copied into the existing InputBuffer#bb --- .../apache/coyote/http11/filters/SavedRequestInputFilter.java | 9 ++++----- webapps/docs/changelog.xml | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java b/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java index 8e02af182d..c6609be67a 100644 --- a/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java +++ b/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java @@ -49,11 +49,10 @@ public class SavedRequestInputFilter implements InputFilter { return -1; } - ByteBuffer byteBuffer = handler.getByteBuffer(); - byteBuffer.position(byteBuffer.limit()).limit(byteBuffer.capacity()); - input.subtract(byteBuffer); - - return byteBuffer.remaining(); + int len = input.getLength(); + handler.setByteBuffer(ByteBuffer.wrap(input.getBytes(), input.getStart(), len)); + input.setStart(input.getEnd()); + return len; } /** diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 3193b83f03..8ad753dc31 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -123,6 +123,14 @@ </fix> </changelog> </subsection> + <subsection name="Coyote"> + <changelog> + <scode> + Refactor the <code>SavedRequestInputFilter</code> so the buffered data + is used directly rather than copied. (markt) + </scode> + </changelog> + </subsection> <subsection name="Jasper"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org