Use enableCrypto()

This commit is contained in:
Richard van den Berg 2015-03-18 16:10:04 +01:00 committed by mark_story
parent 54a3f8724b
commit bb8e0ae835

View file

@ -171,7 +171,6 @@ class CakeSocket {
stream_set_timeout($this->connection, $this->config['timeout']); stream_set_timeout($this->connection, $this->config['timeout']);
} }
if (!empty($this->config['request']) && $this->config['request']['uri']['scheme'] == 'https' && !empty($this->config['proxy'])) { if (!empty($this->config['request']) && $this->config['request']['uri']['scheme'] == 'https' && !empty($this->config['proxy'])) {
$req = array(); $req = array();
$req[] = 'CONNECT '. $this->config['request']['uri']['host'] . ':' . $this->config['request']['uri']['port'] . ' HTTP/1.1'; $req[] = 'CONNECT '. $this->config['request']['uri']['host'] . ':' . $this->config['request']['uri']['port'] . ' HTTP/1.1';
@ -187,15 +186,7 @@ class CakeSocket {
} }
} }
$modes = array(STREAM_CRYPTO_METHOD_TLS_CLIENT, $this->enableCrypto('tls', 'client');
STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
STREAM_CRYPTO_METHOD_SSLv2_CLIENT);
$success = false;
foreach($modes as $mode) {
$success = stream_socket_enable_crypto($this->connection, true, $mode);
if ($success) break;
}
} }
return $this->connected; return $this->connected;