Merge branch '6.1.x'

This commit is contained in:
Stéphane Nicoll 2024-10-04 10:20:28 +02:00
commit beca562ac2
1 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import jakarta.servlet.http.HttpServletRequest;
import org.springframework.context.Lifecycle;
import org.springframework.context.SmartLifecycle;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.lang.Nullable;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.servlet.HandlerExecutionChain;
@ -127,7 +128,7 @@ public class WebSocketHandlerMapping extends SimpleUrlHandlerMapping implements
handler = (handler instanceof HandlerExecutionChain chain ? chain.getHandler() : handler);
if (this.webSocketUpgradeMatch && handler instanceof WebSocketHttpRequestHandler) {
String header = request.getHeader(HttpHeaders.UPGRADE);
return (request.getMethod().equals("GET") &&
return (HttpMethod.GET.matches(request.getMethod()) &&
header != null && header.equalsIgnoreCase("websocket"));
}
return true;