Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] Do not set a Transfer-Encoding header of chunked for streaming responses#3017
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Apache expects the response to already be in chunked format in that case,which causes it to not deliver the streamed body.If no Content-Length is set on the response, web servers will automaticallyswitch to chunked Transfer-Encoding, and handle the chunking for you.Nginx does not share the issue that apache has, but will add the Content-Length header too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
How about adding a negative test to avoid regressions and document why it's necessary, i.e. assertNotEquals(...)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done.
Commits-------7ae9348 [streaming] Document and test that Transfer-Encoding is absent83c23ca [streaming] Do not set a Transfer-Encoding header of chunkedDiscussion----------[HttpFoundation] Do not set a Transfer-Encoding header of chunked for streaming responsesBug fix: yesFeature addition: noBackwards compatibility break: noSymfony2 tests pass: yesThis is an adjustment to the streaming introduced in#2935.Apache expects the response to already be in chunked format when the Transfer-Encoding header is set to chunked, which causes it to not deliver the streamed body.If no Content-Length is set on the response (regardless of Transfer-Encoding), web servers will automatically switch to chunked Transfer-Encoding, and handle the chunking for you.I have tested this with Apache 2.2.2 and nginx 1.0.5. Testing with other webservers is appreciated.
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
This is an adjustment to the streaming introduced in#2935.
Apache expects the response to already be in chunked format when the Transfer-Encoding header is set to chunked, which causes it to not deliver the streamed body.
If no Content-Length is set on the response (regardless of Transfer-Encoding), web servers will automatically switch to chunked Transfer-Encoding, and handle the chunking for you.
I have tested this with Apache 2.2.2 and nginx 1.0.5. Testing with other webservers is appreciated.