Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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 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 2 commits into from
Jan 2, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Symfony/Component/HttpFoundation/StreamedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function prepare(Request $request)
{
if ('1.0' != $request->server->get('SERVER_PROTOCOL')) {
$this->setProtocolVersion('1.1');
$this->headers->set('Transfer-Encoding', 'chunked');
}

$this->headers->set('Cache-Control', 'no-cache');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testPrepareWith11Protocol()
$response->prepare($request);

$this->assertEquals('1.1', $response->getProtocolVersion());
$this->assertEquals('chunked', $response->headers->get('Transfer-Encoding'));
$this->assertNotEquals('chunked', $response->headers->get('Transfer-Encoding'), 'Apache assumes responses with a Transfer-Encoding header set to chunked to already be encoded.');
Copy link
Contributor

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(...)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

$this->assertEquals('no-cache, private', $response->headers->get('Cache-Control'));
}

Expand Down