Skip to content
Permalink
Browse files
Simplify the code and fix an edge case for BZ 64830
  • Loading branch information
markt-asf committed Jan 14, 2021
1 parent 5961f65 commit bb0e7c1e0d737a0de7d794572517bce0e91d30fa
Showing with 7 additions and 3 deletions.
  1. +3 −3 java/org/apache/coyote/AbstractProtocol.java
  2. +4 −0 webapps/docs/changelog.xml
@@ -833,8 +833,10 @@ public SocketState process(SocketWrapperBase<S> wrapper, SocketEvent status) {
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");
@@ -843,7 +845,6 @@ public SocketState process(SocketWrapperBase<S> wrapper, SocketEvent status) {
release(processor);
// Create the upgrade processor
processor = upgradeProtocol.getProcessor(wrapper, getProtocol().getAdapter());
wrapper.unRead(leftOverInput);
// Associate with the processor with the connection
connections.put(socket, processor);
} else {
@@ -865,7 +866,6 @@ public SocketState process(SocketWrapperBase<S> wrapper, SocketEvent status) {
getLog().debug(sm.getString("abstractConnectionHandler.upgradeCreate",
processor, wrapper));
}
wrapper.unRead(leftOverInput);
// Associate with the processor with the connection
connections.put(socket, processor);
// Initialise the upgrade handler (which may trigger
@@ -162,6 +162,10 @@
</subsection>
<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

0 comments on commit bb0e7c1

Please sign in to comment.