SSL trough proxy server

9 messages Options
Embed this post
Permalink
kranthi117

SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
Hi,

I am behind a proxy and i always get a "Unable to Connect to ssl://www.google.com:443" error

after searching a bit i found that "The current release version of the code doesn't have support for SSL connections through proxy servers" in this post.
Wanna know if they are supported in current release. If not please inform me of a workaround.

Thanks.
Ryan Boyd-3

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
Hi,

You should be able to do something like the following (substituting valid values for your proxy_host and proxy_port).

$client = new Zend_Http_Client('https://www.example.com/', array(
       'adapter'      => 'Zend_Http_Client_Adapter_Proxy',
       'proxy_host'   => 'proxy.shr.secureserver.net',
       'proxy_port'   => 3128
)); 

$sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($singleUseToken, $client);

Does this answer your question?

Cheers,
-Ryan

On Fri, Jun 6, 2008 at 10:21 AM, kranthi <[hidden email]> wrote:
Hi,

I am behind a proxy and i always get a "Unable to Connect to ssl://www.google.com:443" error

after searching a bit i found that "The current release version of the code doesn't have support for SSL connections through proxy servers" in this post.
Wanna know if they are supported in current release. If not please inform me of a workaround.

Thanks.

kranthi117

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
to some extent yes.. to some extent no...(i tried this earlier before making this post)

now i get "Please set your Google credentials before trying to authenticate" error regardless of the validity of my Google credentials.. in fact i m getting the same message even if the proxy address i specified is wrong(which clearly states that Zend is not working through a proxy)
Ryan Boyd-3

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
Hi,

Can you give us the code you're using, and what version of ZF you're running?

Thanks,
-Ryan


On Tue, Jun 10, 2008 at 9:26 PM, kranthi <[hidden email]> wrote:
to some extent yes.. to some extent no...(i tried this earlier before making this post)

now i get "Please set your Google credentials before trying to authenticate" error regardless of the validity of my Google credentials.. in fact i m getting the same message even if the proxy address i specified is wrong(which clearly states that Zend is not working through a proxy)

kranthi117

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$user = '[hidden email]';
$pass = '********';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar

        /**
        * Create an authenticated HTTP Client to talk to Google.
        */
        $config = array(
                'adapter'    => 'Zend_Http_Client_Adapter_Proxy',
                'proxy_host' => '144.16.192.247',
                'proxy_port' => 8080
        );
        // Instantiate a client object
        $clientp = new Zend_Http_Client($myCalendar, $config);
        $client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'cl', $clientp);

var_dump($client);
?>


and the version of ZF is 1.5.2
kranthi117

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
made sum silly mistakes.. sorry to bother u guys

edited the code and it is working fine.

<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$user = '[hidden email]';
$pass = '********';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar

        /**
        * Create an authenticated HTTP Client to talk to Google.
        */
        $config = array(
                'adapter'    => 'Zend_Http_Client_Adapter_Proxy',
                'proxy_host' => '144.16.192.247',
                'proxy_port' => 8080
        );
        // Instantiate a client object
           $clientp = new Zend_Http_Client($myCalendar, $config);
       
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service, $clientp);
var_dump($client);
?>

but the only thing i dnt get is the above is working well but the below 1 is not

        $clientp = new Zend_Http_Client($service, $config);

it gives the message "Scheme "cl" is not supported"


Ryan Boyd-3

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink


On Tue, Jun 10, 2008 at 11:38 PM, kranthi <[hidden email]> wrote:
made sum silly mistakes.. sorry to bother u guys

edited the code and it is working fine.


<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$user = '[hidden email]';
$pass = '********';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar

        /**
        * Create an authenticated HTTP Client to talk to Google.
        */
        $config = array(
                'adapter'    => 'Zend_Http_Client_Adapter_Proxy',
                'proxy_host' => '144.16.192.247',
                'proxy_port' => 8080
        );
        // Instantiate a client object
           $clientp = new Zend_Http_Client($myCalendar, $config);
       
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service, $clientp);
var_dump($client);
?>

but the only thing i dnt get is the above is working well but the below 1 is not

        $clientp = new Zend_Http_Client($service, $config);

it gives the message "Scheme "cl" is not supported"

The first argument to Zend_Http_Client is a URL, so it validates that it's of appropriate syntax:

 In reality, the Zend_Gdata code will override the URL with every request (so, the value will never be used). Just passing 'http://www.example.com/' as in the snippet earlier in this thread should work fine.

After you have the $client, you then pass it to the constructor of Zend_Gdata_Calendar:

Cheers,
-Ryan


kranthi117

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
tnkz...that answers my question. nyways i must have studied a bit further before asking the question
nico dotti

Re: SSL trough proxy server

Reply Threaded More More options
Print post
Permalink
Hello all,

I just joined and I thought I had sent this out already but I guess
not. I get an error when trying to run the Calendar example. I don't
even see the Zend/Validate/Hostname/Com.php in the framework so I'm
baffled:

fopen(Zend/Validate/Hostname/Com.php) [<a
href='function.fopen'>function.fopen</a>]: failed to open stream: No
such file or directory
Error Type:   E_WARNING

Rendered Page:   Click here to view contents able to be rendered

Source File:   /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Loader.php
    Line:   160

Line 155:         * @param string   $filename
Line 156:         * @return boolean
Line 157:         */
Line 158:        public static function isReadable($filename)
Line 159:        {
Line 160:            if (!$fh = @fopen($filename, 'r', true)) {
Line 161:                return false;
Line 162:            }
Line 163:
Line 164:            return true;
Line 165:        }


Call Stack:

#0 (): QcodoHandleError()
#1 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Loader.php(160): fopen()
#2 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Validate/Hostname.php(336):
Zend_Loader::isReadable()
#3 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Uri/Http.php(354):
Zend_Validate_Hostname->isValid()
#4 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Uri/Http.php(185):
Zend_Uri_Http->validateHost()
#5 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Uri/Http.php(96):
Zend_Uri_Http->valid()
#6 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Uri.php(117):
Zend_Uri_Http->__construct()
#7 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Http/Client.php(223):
Zend_Uri::factory()
#8 /usr/local/apache/htdocs/mappily/rlevin/lib/Zend/Gdata/ClientLogin.php(96):
Zend_Http_Client->setUri()
#9 /usr/local/apache/htdocs/mappily/rlevin/test/gdata_tests/Calendar.php(202):
Zend_Gdata_ClientLogin::getHttpClient()
#10 /usr/local/apache/htdocs/mappily/rlevin/test/gdata_tests/Calendar.php(827):
getClientLoginHttpClient()

Thanks for any attempt to give me info.