lithium\net\http\Response::_httpChunkedDecode()

protected method

Decodes content bodies transferred with HTTP chunked encoding.

Parameters

  • string $body

    A chunked HTTP message body.

Returns

string

Returns 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.

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));
	}