You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/09/27 15:51:34 UTC
[tomcat] branch 8.5.x updated: Non-blocking reads should be
non-blocking.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 4f8f90a Non-blocking reads should be non-blocking.
4f8f90a is described below
commit 4f8f90a36174fc52e3191170c2dea558d24de253
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 27 16:49:45 2021 +0100
Non-blocking reads should be non-blocking.
---
java/org/apache/coyote/http11/Http11InputBuffer.java | 12 ++++++++----
webapps/docs/changelog.xml | 4 ++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java b/java/org/apache/coyote/http11/Http11InputBuffer.java
index bf11eb8..8d279dc 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -1191,10 +1191,14 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler
public int doRead(ApplicationBufferHandler handler) throws IOException {
if (byteBuffer.position() >= byteBuffer.limit()) {
- // The application is reading the HTTP request body which is
- // always a blocking operation.
- if (!fill(true)) {
- return -1;
+ // The application is reading the HTTP request body
+ boolean block = (request.getReadListener() == null);
+ if (!fill(block)) {
+ if (block) {
+ return -1;
+ } else {
+ return 0;
+ }
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6f0c23c..17b9cc2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -121,6 +121,10 @@
Reclassify TLS ciphers that use AESCCM8 as medium security rather than
high security to align with recent changes in OpenSSL. (markt)
</update>
+ <fix>
+ Fix an issue that caused some Servlet non-blocking API reads of the HTTP
+ request body to incorrectly use blocking IO. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org