From 7810f2dec2db9737fd741fd144e2e05b5807c9ee Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 2 Oct 2019 10:18:06 +0200 Subject: [PATCH] Reverted 82a00524d17b79a9b48dd9279395866d7ce0cbd4. The connection upgrade check is necessary both after the parsing and after the handling. After the parsing covers HTTP/2 prior knowledge "PRI * HTTP/2" case; after the handling covers the WebSocket case. Signed-off-by: Simone Bordet --- .../java/org/eclipse/jetty/server/HttpConnection.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index 0da3803a9ba..3509e3a2d53 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -257,12 +257,19 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http // Parse the request buffer. boolean handle = parseRequestBuffer(); + // There could be a connection upgrade before handling + // the HTTP/1.1 request, for example PRI * HTTP/2. + // If there was a connection upgrade, the other + // connection took over, nothing more to do here. + if (getEndPoint().getConnection() != this) + break; + // Handle channel event if (handle) { boolean suspended = !_channel.handle(); - // We should break iteration if we have suspended or changed connection or this is not the handling thread. + // We should break iteration if we have suspended or upgraded the connection. if (suspended || getEndPoint().getConnection() != this) break; }