Patching an issue I discovered whilst debugging performance behind Clouflare.

By trimming the $buffer and not updating the Content-Length, Cloudflare will wait until it times out for the rest of the response body.

It's important to update the Content-Length with the trimmed string.