From 9e6b1b6930faf73573d135efab5fa90280967d97 Mon Sep 17 00:00:00 2001 From: Richard van den Berg Date: Fri, 20 Mar 2015 11:27:27 +0100 Subject: [PATCH] Support for SSL Server Name Indication --- lib/Cake/Network/Http/HttpSocket.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index 92ed56121..fe1d2bccc 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -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'; }