Skip to content
Permalink
Browse files

Fixed issue #7579 on the 2.7 branch

  • Loading branch information...
wiserfirst committed Dec 1, 2015
1 parent caf93bf commit 48dd778bd0eedcaaad57e81cebf74f7ebb76db9f
Showing with 23 additions and 1 deletion.
  1. +5 −1 lib/Cake/Network/CakeSocket.php
  2. +18 −0 lib/Cake/Test/Case/Network/CakeSocketTest.php
@@ -129,8 +129,12 @@ public function connect() {
$this->disconnect();
}
$hasProtocol = strpos($this->config['host'], '://') !== false;
if ($hasProtocol) {
list($this->config['protocol'], $this->config['host']) = explode('://', $this->config['host']);
}
$scheme = null;
if (!empty($this->config['protocol']) && strpos($this->config['host'], '://') === false && empty($this->config['proxy'])) {
if (!empty($this->config['protocol'])) {
$scheme = $this->config['protocol'] . '://';
}
@@ -265,6 +265,24 @@ public function testEnableCryptoSocketExceptionNoTls() {
$this->Socket->enableCrypto('tls', 'client');
}
/**
* Test that protocol in the host doesn't cause cert errors.
*
* @return void
*/
public function testConnectProtocolInHost() {
$this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.');
$configSslTls = array('host' => 'ssl://smtp.gmail.com', 'port' => 465, 'timeout' => 5);
$socket = new CakeSocket($configSslTls);
try {
$socket->connect();
$this->assertEquals('smtp.gmail.com', $socket->config['host']);
$this->assertEquals('ssl', $socket->config['protocol']);
} catch (SocketException $e) {
$this->markTestSkipped('Cannot test network, skipping.');
}
}
/**
* _connectSocketToSslTls
*

0 comments on commit 48dd778

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.