lithium\net\http\Response::_httpChunkedDecode()
Decodes content bodies transferred with HTTP chunked encoding.
Parameters
-
string
$body
A chunked HTTP message body.
Returns
stringReturns the value of $body
with chunks decoded, but only if the value of the
Transfer-Encoding
header is set to 'chunked'
. Otherwise, returns $body
unmodified.
Links
Source
protected function _httpChunkedDecode($body) {
if (stripos($this->headers('Transfer-Encoding'), 'chunked') === false) {
return $body;
}
$stream = fopen('data://text/plain;base64,' . base64_encode($body), 'r');
stream_filter_append($stream, 'dechunk');
return trim(stream_get_contents($stream));
}