Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6696 - don't keep Request object in the WebSocketNegotiation after upgrade #6698

Merged

Conversation

lachlan-roberts
Copy link
Contributor

Issue #6696

null out the baseRequest field in WebSocketNegotiation after the websocket upgrade is complete.

…fter upgrade

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@@ -167,6 +167,7 @@ public boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest
// Save state from request/response and remove reference to the base request/response.
upgradeRequest.upgrade();
upgradeResponse.upgrade();
negotiation.setBaseRequest(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous 2 lines that call upgrade() actually null-out the references to the request and response, respectively.
I would call the method on WebSocketNegotiation as upgrade() as well, just in case in future we want to null-out some other field, or copy something from the Request object to save it for later use, like the other upgrade() methods do.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@gregw
Copy link
Contributor

gregw commented Sep 8, 2021

@lachlan-roberts please merge

@lachlan-roberts lachlan-roberts merged commit aa75d04 into jetty-10.0.x Sep 8, 2021
@lachlan-roberts lachlan-roberts deleted the jetty-10.0.x-6696-WebSocketUpgradeRequest branch September 8, 2021 09:03
@lachlan-roberts lachlan-roberts added this to In progress in Jetty 10.0.7/11.0.7 FROZEN via automation Sep 9, 2021
@lachlan-roberts lachlan-roberts moved this from In progress to Done in Jetty 10.0.7/11.0.7 FROZEN Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants