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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[streaming] Do not set a Transfer-Encoding header of chunked
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 automatically
switch 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.
  • Loading branch information
igorw committed Jan 2, 2012
commit 83c23ca0bea1b10224266fcf7ec58cc2fa52b94a
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,6 @@ public function testPrepareWith11Protocol()
$response->prepare($request);

$this->assertEquals('1.1', $response->getProtocolVersion());
$this->assertEquals('chunked', $response->headers->get('Transfer-Encoding'));
$this->assertEquals('no-cache, private', $response->headers->get('Cache-Control'));
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

Expand Down