Skip to content

Commit

Permalink
Applied patch by Mikko Koppanen to correct a backwards compatibility …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
padraic committed Feb 6, 2010
1 parent 2404ed1 commit 8916c5a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions documentation/manual/en/module_specs/Zend_Http_Client-Adapters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions library/Zend/Http/Client/Adapter/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public function connect($host, $port = 80, $secure = false)
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(
Expand Down
5 changes: 3 additions & 2 deletions library/Zend/Http/Client/Adapter/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

/**
Expand Down Expand Up @@ -201,7 +202,7 @@ public function connect($host, $port = 80, $secure = false)
// 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'])) {
Expand Down

0 comments on commit 8916c5a

Please sign in to comment.