Skip to content

Commit

Permalink
Merge pull request zendframework#2222 from taisph/2e1ac19cc886a5fc892…
Browse files Browse the repository at this point in the history
…a2ec0f8044064ac3e3595

Fix only setting SSL context options requiring verifypeer to be true when it is
  • Loading branch information
Maks3w committed Aug 22, 2012
2 parents 32d81eb + 2e1ac19 commit 3566bf1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions library/Zend/Http/Client/Adapter/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,16 @@ public function connect($host, $port = 80, $secure = false)
$this->config['sslverifypeer'])) {
throw new AdapterException\RuntimeException('Unable to set sslverifypeer option');
}
if (! stream_context_set_option($context, 'ssl', 'capath',
$this->config['sslcapath'])) {
throw new AdapterException\RuntimeException('Unable to set sslcapath option');
}
if ($this->config['sslallowselfsigned'] !== null) {
if (! stream_context_set_option($context, 'ssl', 'allow_self_signed',
$this->config['sslallowselfsigned'])) {
throw new AdapterException\RuntimeException('Unable to set sslallowselfsigned option');
if ($this->config['sslverifypeer'] == true) {
if (! stream_context_set_option($context, 'ssl', 'capath',
$this->config['sslcapath'])) {
throw new AdapterException\RuntimeException('Unable to set sslcapath option');
}
if ($this->config['sslallowselfsigned'] !== null) {
if (! stream_context_set_option($context, 'ssl', 'allow_self_signed',
$this->config['sslallowselfsigned'])) {
throw new AdapterException\RuntimeException('Unable to set sslallowselfsigned option');
}
}
}
}
Expand Down

0 comments on commit 3566bf1

Please sign in to comment.