Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#7121 from ins0/fix/cur…
Browse files Browse the repository at this point in the history
…l-ssl-verify

Feature: Added sslverifypeer to curl adapter
  • Loading branch information
weierophinney committed Feb 24, 2015
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Client/Adapter/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public function setOptions($options = array())
unset($options['proxyuser'], $options['proxypass']);
}

if (isset($options['sslverifypeer'])) {
$this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $options['sslverifypeer']);
unset($options['sslverifypeer']);
}

foreach ($options as $k => $v) {
$option = strtolower($k);
switch ($option) {
Expand Down
18 changes: 18 additions & 0 deletions test/Client/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@ public function testWorkWithProxyConfiguration()
);
}

public function testSslVerifyPeerCanSetOverOption()
{
$adapter = new Adapter\Curl();
$adapter->setOptions(array(
'sslverifypeer' => true
));

$expected = array(
'curloptions' => array(
CURLOPT_SSL_VERIFYPEER => true
),
);

$this->assertEquals(
$expected, $this->readAttribute($adapter, 'config')
);
}

/**
* @group ZF-7040
*/
Expand Down

0 comments on commit e40932f

Please sign in to comment.