Skip to content

writing content as bytes to avoid contentLength calculation problems #242

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

Merged
merged 1 commit into from
Apr 9, 2020
Merged

writing content as bytes to avoid contentLength calculation problems #242

merged 1 commit into from
Apr 9, 2020

Conversation

fliptaboada
Copy link
Contributor

The recent changes on setContentLength broke some spring-security functionality as spring-security recalculates content-length when getWriter().write(String) is called to check if the response is completed.
Therefore the session cookie will only be set after everything is over and the response was already sent back to the client.
Here's where this happens: OnCommittedResponseWrapper.java

I think that using the same byte array used to set the content-length is the most secure way to avoid problems like this.

I also changed the test, but not sure if it was the correct approach.

@oliemansm oliemansm added this to the 9.2.0 milestone Apr 9, 2020
@oliemansm oliemansm merged commit cba36c6 into graphql-java-kickstart:master Apr 9, 2020
@oliemansm
Copy link
Member

Thanks a lot for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants