ZF-12490: Error "Error parsing body - doesn't seem to be a chunked message" due to transfer encoding management in Zend\Http\Client\Adapter\Socket

Issue Type: Bug Created: 2012-12-21T09:31:54.000+0000 Last Updated: 2012-12-21T09:54:44.000+0000 Status: Closed Fix version(s): Reporter: Olivier Monaco (olivier.monaco) Assignee: Frank Brückner (frosch) Tags: - Zend_Http_Client

Related issues: Attachments:


This issue affect Zend 2 but I can't create an issue on that project.

Chunked tranfer encoding is managed by Zend\Http\Client\Response in getBody function. But the underlined adapter can also manage this transfer encoding. For instance, Zend\Http\Client\Adapter\Curl manage it so a little piece of code remove the "Transfer-Encoding" header. Zend\Http\Client\Adapter\Socket manage also this transfer encoding but without removing the header. So Zend\Http\Client\Response fail decode body because it is already decoded.

Please copy the following code from Zend\Http\Client\Adapter\Curl to Zend\Http\Client\Adapter\Socket: // cURL automatically decodes chunked-messages, this means we have to disallow the Zend\Http\Response to do it again if (stripos($this->response, "Transfer-Encoding: chunked\r\n")) { $this->response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $this->response); }

It can also be interesting to add a "Content-Length" header to the response once the data is decoded (so in Socket and in Curl class).


Posted by Frank Brückner (frosch) on 2012-12-21T09:54:24.000+0000

For ZF2 please use the issue tracker on Github.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.