Unable to set explicit Accept-Encoding header in Zend\Http\Client due to (perhaps) obsolete code #2607

Closed
zfbot opened this Issue Sep 28, 2012 · 2 comments

Comments

Projects
None yet
3 participants

zfbot commented Sep 28, 2012

Jira Information

Original Issue:ZF2-582
Issue Type:Bug
Reporter:commanche
Created:09/25/12
Assignee:weierophinney
Components:Zend\Http

Description

In Zend\Http\Client::prepareHeaders (https://github.com/zendframework/zf2/blob/master/library/Zend/Http/Client.php#L1043):

        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.

zfbot commented Sep 28, 2012

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-582

Known GitHub users mentioned in the original message or comment:
@Commanche, @weierophinney

I have committed a fix for this issue which can be found at zendframework#3125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment