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:16 UTC
[tomcat] branch main 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 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 14ee968 Non-blocking reads should be non-blocking.
14ee968 is described below
commit 14ee9683f8543f59a6c3c217a1b68530297873d7
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 cbf436a..19aa56e 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -1167,10 +1167,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 d9622dd..80eb7a4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -155,6 +155,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