From 0cb08a09dc3e131d092183fb66f72a4267b60647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Lorenzo=20Rodri=CC=81guez?= Date: Mon, 21 Feb 2011 23:58:46 -0430 Subject: [PATCH] Fixing class loading for authentication clasess in HttpSocket, also allowing the use of plugin authentication classes --- lib/Cake/Network/Http/HttpSocket.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index e8f675c14a7..1d5d1400d5a 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -530,8 +530,11 @@ protected function _setAuth() { return; } $method = key($this->_auth); - $authClass = Inflector::camelize($method) . 'Authentication'; - if (!App::import('Lib', 'http/' . $authClass)) { + list($plugin, $authClass) = pluginSplit($method, true); + $authClass = Inflector::camelize($authClass) . 'Authentication'; + App::uses($authClass, $plugin . 'Network/Http'); + + if (!class_exists($authClass)) { throw new SocketException(__('Unknown authentication method.')); } if (!method_exists($authClass, 'authentication')) { @@ -556,8 +559,11 @@ protected function _setProxy() { if (empty($this->_proxy['method']) || !isset($this->_proxy['user'], $this->_proxy['pass'])) { return; } - $authClass = Inflector::camelize($this->_proxy['method']) . 'Authentication'; - if (!App::import('Lib', 'http/' . $authClass)) { + list($plugin, $authClass) = pluginSplit($this->_proxy['method'], true); + $authClass = Inflector::camelize($authClass) . 'Authentication'; + App::uses($authClass, $plugin. 'Network/Http'); + + if (!class_exists($authClass)) { throw new SocketException(__('Unknown authentication method for proxy.')); } if (!method_exists($authClass, 'proxyAuthentication')) {