silverstripe/sapphire — pull request #1123 by chillu (2013-01-23 14:07:36+00:00)
Title: API Remove Content-Length setting from HTTPResponse (fixes #8010)

This reverts commit 356a367eb5d05bea3dfa2edaeabc52a2496b93b2.
We can't use headers_sent() to determine an accurate
content length, since PHP defaults to buffering a couple of bytes
even without ob_start() (see "output_buffering" setting).
This makes the patch harmful, since it breaks any responses relying
on more structure data, like removing closing brackets from JSON.
Which in turn breaks the CMS in horrible ways (see http://open.silverstripe.org/ticket/8010).
See http://open.silverstripe.org/ticket/7574for context.

I'm proposing to fix this in 3.0. Its been a common source of frustration,
so a necessary API change - in reality, I don't think anybody's relying
on a PHP-generated Content-Length anyway, it was just a workaround
for some crazy proxy edge cases which should really be fixed in the proxy itself.