Browse Source
Prior to this commit, the `StandardWebSocketUpgradeStrategy` would get the HTTP headers from the handshake request and store them in the WebSocket session for the entire duration of the session. As of gh-36334, Spring MVC manages HTTP directly with a native API instead of copying them. This improves performance but also uncovered this bug: we cannot keep a reference to HTTP headers once the HTTP exchange is finished, because such resources can be recycled and reused. This commit ensures that the handshake headers are copied into the session info to keep them around for the entire duration of the session. Without that, Tomcat will raise an `IllegalStateException` at runtime. This was already done for WebFlux in SPR-17250, but the latest header management changes in Framework uncovered this issue for the Standard WebSocket container case. Fixes gh-364867.0.x
3 changed files with 29 additions and 4 deletions
Loading…
Reference in new issue