ZF-1920: ClientLogin class creates a new Zend_Http_Client object, destroying proxy adapter settings

Issue Type: Bug Created: 2007-09-07T19:33:43.000+0000 Last Updated: 2009-03-02T18:19:16.000+0000 Status: Resolved Fix version(s): - 1.7.7 (16/Mar/09)

Reporter: Ryan Boyd (rboyd) Assignee: Jochen Hartmann (jhartmann) Tags: - Zend_Gdata

Related issues: Attachments:


After authenticating, the ClientLogin class creates a new Zend_Http_Client object--- ignoring previously set proxy adapter settings. This makes the authentication request succeed in going through the proxy, but all other requests with the client returned from the ClientLogin code will fail, as they won't be going through the proxy.

See: Zend_Gdata_ClientLogin::getHttpClient (line 132 -- $client = new Zend_Http_Client).


Posted by Dennis Becker (radhad) on 2008-06-24T07:01:50.000+0000

This also affects 1.5.x versions!!!

in ZF 1.5.2 line 143 following:

<pre class="highlight">
if ($response->getStatus() == 200) {
            $headers['authorization'] = 'GoogleLogin auth=' . $goog_resp['Auth'];
            $client = new Zend_Http_Client();
            $useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
                    'strictredirects' => true,
                    'useragent' => $useragent
            return $client;

Why don't you use the previous Zend_Http_Client and create a new one? You have already a Zend_Http_Client above!

In ZF 1.5.2 libe 75 following:

<pre class="highlight">
    public static function getHttpClient($email, $password, $service = 'xapi',
        $client = null,
        $source = self::DEFAULT_SOURCE,
        $loginToken = null,
        $loginCaptcha = null,
        $loginUri = self::CLIENTLOGIN_URI)
        if (! ($email && $password)) {
            require_once 'Zend/Gdata/App/AuthException.php';
            throw new Zend_Gdata_App_AuthException('Please set your Google credentials before trying to authenticate');

        if ($client == null) {
            $client = new Zend_Http_Client();
        if (!$client instanceof Zend_Http_Client) {
            require_once 'Zend/Gdata/App/HttpException.php';
            throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Http_Client.');

Solution: remove the code which creates a new Zend_Http_Client or get the previous settings from the first Zend_Http_Client instance!

Posted by Jochen Hartmann (jhartmann) on 2009-02-26T16:50:24.000+0000


Posted by Jochen Hartmann (jhartmann) on 2009-03-02T18:19:04.000+0000

Fixed in r14204 and merged to 1-7 branch in r14205.

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.