ZF2-582: Unable to set explicit Accept-Encoding header in Zend\Http\Client due to (perhaps) obsolete code


In Zend\Http\Client::prepareHeaders (…):

        if (! isset($this->headers['accept-encoding'])) {
            if (function_exists('gzinflate')) {
                $headers['Accept-encoding'] = 'gzip, deflate';
            } else {
                $headers['Accept-encoding'] = 'identity';

The "$this->headers" property is not used anywhere else, perhaps the "if" line should be something like that, according to the surrounding code:

if (!$this->getRequest()->getHeaders()->has('Accept-Encoding')) {

Now the condition is always true and there is no other option to disable gzip in the HTTP response than removing the gzip PHP extension.


This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: