소스 검색

Applied patch by Mikko Koppanen to correct a backwards compatibility break from 1.9- which prevents proxy connections passing a secure context to the proxied connection. Fixes ZF-5524

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20946 44c647ce-9c0f-0410-b52a-842ac1e357ba
padraic 16 년 전
부모
커밋
8916c5a0a6

+ 12 - 0
documentation/manual/en/module_specs/Zend_Http_Client-Adapters.xml

@@ -129,6 +129,18 @@
                             <entry>string</entry>
                             <entry><constant>NULL</constant></entry>
                         </row>
+                        
+                        <row>
+                            <entry>sslusecontext</entry>
+
+                            <entry>
+                                Enables proxied connections to use SSL even if
+                                the proxy connection itself does not.
+                            </entry>
+
+                            <entry>boolean</entry>
+                            <entry><constant>FALSE</constant></entry>
+                        </row>
                     </tbody>
                 </tgroup>
             </table>

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

@@ -91,6 +91,11 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
         if (! $this->config['proxy_host']) {
             return parent::connect($host, $port, $secure);
         }
+        
+        /* Url might require stream context even if proxy connection doesn't */
+        if ($secure) {
+        	$this->config['sslusecontext'] = true;
+        }
 
         // Connect (a non-secure connection) to the proxy server
         return parent::connect(

+ 3 - 2
library/Zend/Http/Client/Adapter/Socket.php

@@ -76,7 +76,8 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
         'persistent'    => false,
         'ssltransport'  => 'ssl',
         'sslcert'       => null,
-        'sslpassphrase' => null
+        'sslpassphrase' => null,
+        'sslusecontext' => false
     );
 
     /**
@@ -201,7 +202,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf
         // Now, if we are not connected, connect
         if (! is_resource($this->socket) || ! $this->config['keepalive']) {
             $context = $this->getStreamContext();
-            if ($secure) {
+            if ($secure || $this->config['sslusecontext']) {
                 if ($this->config['sslcert'] !== null) {
                     if (! stream_context_set_option($context, 'ssl', 'local_cert',
                                                     $this->config['sslcert'])) {