From dd5c2e315fd89295e1b6d7becc69a4e6582af0c3 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 8 Apr 2019 10:00:53 -0500 Subject: [PATCH] Issue #3530 - Warning on attempt to use WebSocket Bootstrap on HTTP/2 Signed-off-by: Joakim Erdfelt --- .../websocket/server/WebSocketServerFactory.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java index acb0dc36205..8c4223916d8 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; - import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -514,7 +513,14 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc if (!"HTTP/1.1".equals(request.getProtocol())) { - LOG.debug("Not a 'HTTP/1.1' request (was [" + request.getProtocol() + "])"); + if ("HTTP/2".equals(request.getProtocol())) + { + LOG.warn("WebSocket Bootstrap from HTTP/2 (RFC8441) not supported in Jetty 9.x"); + } + else + { + LOG.warn("Not a 'HTTP/1.1' request (was [" + request.getProtocol() + "])"); + } return false; } @@ -562,6 +568,7 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc { throw new IllegalStateException("Not a 'WebSocket: Upgrade' request"); } + if (!"HTTP/1.1".equals(request.getHttpVersion())) { throw new IllegalStateException("Not a 'HTTP/1.1' request");