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
The following commit(s) were added to refs/heads/9.0.x by this push: new d47c20a Simplify the code and fix an edge case for BZ 64830 d47c20a is described below commit d47c20a776e8919eaca8da9390a32bc8bf8210b1 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jan 14 16:59:43 2021 +0000 Simplify the code and fix an edge case for BZ 64830 https://bz.apache.org/bugzilla/show_bug.cgi?id=64830 --- java/org/apache/coyote/AbstractProtocol.java | 6 +++--- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index 39a4f8a..227f9c1 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -889,8 +889,10 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, if (state == SocketState.UPGRADING) { // Get the HTTP upgrade handler UpgradeToken upgradeToken = processor.getUpgradeToken(); - // Retrieve leftover input + // Restore leftover input to the wrapper so the upgrade + // processor can process it. ByteBuffer leftOverInput = processor.getLeftoverInput(); + wrapper.unRead(leftOverInput); if (upgradeToken == null) { // Assume direct HTTP/2 connection UpgradeProtocol upgradeProtocol = getProtocol().getUpgradeProtocol("h2c"); @@ -899,7 +901,6 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, release(processor); // Create the upgrade processor processor = upgradeProtocol.getProcessor(wrapper, getProtocol().getAdapter()); - wrapper.unRead(leftOverInput); // Associate with the processor with the connection wrapper.setCurrentProcessor(processor); } else { @@ -921,7 +922,6 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, getLog().debug(sm.getString("abstractConnectionHandler.upgradeCreate", processor, wrapper)); } - wrapper.unRead(leftOverInput); // Associate with the processor with the connection wrapper.setCurrentProcessor(processor); // Initialise the upgrade handler (which may trigger diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 6b0c60c..0a8762e 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -156,6 +156,10 @@ <subsection name="Coyote"> <changelog> <fix> + Additional fix for <bug>64830</bug> to address an edge case that could + trigger request corruption with h2c connections. (markt) + </fix> + <fix> <bug>64974</bug>: Improve handling of pipelined HTTP requests in combination with the Servlet non-blocking IO API. It was possible that some requests could get dropped. (markt) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org