Support for SSL Server Name Indication

This commit is contained in:
Richard van den Berg 2015-03-20 11:27:27 +01:00 committed by mark_story
parent 23d4d1155a
commit 9e6b1b6930

View file

@ -718,6 +718,20 @@ class HttpSocket extends CakeSocket {
}
unset($this->config[$key]);
}
if (version_compare(PHP_VERSION, '5.3.2', '>=')) {
if (empty($this->config['context']['ssl']['SNI_enabled'])) {
$this->config['context']['ssl']['SNI_enabled'] = true;
}
if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
if (empty($this->config['context']['ssl']['peer_name'])) {
$this->config['context']['ssl']['peer_name'] = $this->request['uri']['host'];
}
} else {
if (empty($this->config['context']['ssl']['SNI_server_name'])) {
$this->config['context']['ssl']['SNI_server_name'] = $this->request['uri']['host'];
}
}
}
if (empty($this->config['context']['ssl']['cafile'])) {
$this->config['context']['ssl']['cafile'] = CAKE . 'Config' . DS . 'cacert.pem';
}