Browse Source

Fixing ZF-6844 - Notices when falling back to no-proxy from Adapter_Proxy, when connecting to an HTTPS server

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17056 44c647ce-9c0f-0410-b52a-842ac1e357ba
shahar 16 years ago
parent
commit
01f1c0ee3c

+ 2 - 0
library/Zend/Http/Client/Adapter/Proxy.php

@@ -58,6 +58,8 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
      */
     protected $config = array(
         'ssltransport'  => 'ssl',
+        'sslcert'       => null,
+        'sslpassphrase' => null,
         'proxy_host'    => '',
         'proxy_port'    => 8080,
         'proxy_user'    => '',

+ 19 - 0
tests/Zend/Http/Client/ProxyAdapterTest.php

@@ -69,6 +69,25 @@ class Zend_Http_Client_ProxyAdapterTest extends Zend_Http_Client_SocketTest
             $this->markTestSkipped("Zend_Http_Client proxy server tests are not enabled in TestConfiguration.php");
         }
     }
+    
+    /**
+     * Test that when no proxy is set the adapter falls back to direct connection
+     * 
+     */
+    public function testFallbackToSocket()
+    {
+        $this->_adapter->setConfig(array(
+            'proxy_host' => null,
+        ));
+        
+        $this->client->setUri($this->baseuri . 'testGetLastRequest.php');
+        $res = $this->client->request(Zend_Http_Client::TRACE);
+        if ($res->getStatus() == 405 || $res->getStatus() == 501) {
+            $this->markTestSkipped("Server does not allow the TRACE method");
+        }
+
+        $this->assertEquals($this->client->getLastRequest(), $res->getBody(), 'Response body should be exactly like the last request');
+    }
 
     public function testGetLastRequest()
     {