Skip to content

Commit

Permalink
Add test for not verifying peer name;
Browse files Browse the repository at this point in the history
See #8471;
  • Loading branch information
curtisgibby committed Mar 16, 2016
1 parent 339bbe7 commit d0e2249
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/TestCase/Network/Http/Adapter/StreamTest.php
Expand Up @@ -180,6 +180,7 @@ public function testSendContextSsl()
$options = [
'ssl_verify_host' => true,
'ssl_verify_peer' => true,
'ssl_verify_peer_name' => true,
'ssl_verify_depth' => 9000,
'ssl_allow_self_signed' => false,
'proxy' => [
Expand All @@ -192,6 +193,43 @@ public function testSendContextSsl()
$expected = [
'peer_name' => 'localhost.com',
'verify_peer' => true,
'verify_peer_name' => true,
'verify_depth' => 9000,
'allow_self_signed' => false,
'proxy' => '127.0.0.1:8080',
];
foreach ($expected as $k => $v) {
$this->assertEquals($v, $result[$k]);
}
$this->assertTrue(is_readable($result['cafile']));
}

/**
* Test send() + context options for SSL.
*
* @return void
*/
public function testSendContextSslNoVerifyPeerName()
{
$request = new Request();
$request->url('https://localhost.com/test.html');
$options = [
'ssl_verify_host' => true,
'ssl_verify_peer' => true,
'ssl_verify_peer_name' => false,
'ssl_verify_depth' => 9000,
'ssl_allow_self_signed' => false,
'proxy' => [
'proxy' => '127.0.0.1:8080'
]
];

$this->stream->send($request, $options);
$result = $this->stream->contextOptions();
$expected = [
'peer_name' => 'localhost.com',
'verify_peer' => true,
'verify_peer_name' => false,
'verify_depth' => 9000,
'allow_self_signed' => false,
'proxy' => '127.0.0.1:8080',
Expand Down

0 comments on commit d0e2249

Please sign in to comment.