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 1f4175d65c Refactor so the buffered data is used directly rather than
copied
1f4175d65c is described below
commit 1f4175d65cd7bb44af7fa098e8160b084870865a
Author: Mark Thomas <[email protected]>
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 | 4 ++++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
b/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
index 9bead7331e..84b6ae8f7b 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 1139fbf064..3589714fea 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -178,6 +178,10 @@
processing poller events for the NIO Connector as this may occur in
normal usage. (markt)
</fix>
+ <scode>
+ Refactor the <code>SavedRequestInputFilter</code> so the buffered data
+ is used directly rather than copied. (markt)
+ </scode>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]