diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index 1977a1541..2c8e01fa3 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -134,7 +134,12 @@ class CakeSocket { $scheme = $this->config['protocol'] . '://'; } - $this->_setSslContext($this->config['host']); + $host = $this->config['host']; + if (isset($this->config['request']['uri']['host'])) { + $host = $this->config['request']['uri']['host']; + } + $this->_setSslContext($host); + if (!empty($this->config['context'])) { $context = stream_context_create($this->config['context']); } else {