From d656bdae3b3c622f03a8eabab9dd8c09e194a71d Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Mon, 6 Dec 2010 11:28:40 -0200 Subject: [PATCH] Renamed proxy method and calling togheter from host config. --- cake/libs/http_socket.php | 4 ++-- cake/tests/cases/libs/http_socket.test.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cake/libs/http_socket.php b/cake/libs/http_socket.php index 263dcb585..84742fddd 100644 --- a/cake/libs/http_socket.php +++ b/cake/libs/http_socket.php @@ -245,6 +245,7 @@ class HttpSocket extends CakeSocket { if (isset($host)) { $this->config['host'] = $host; } + $this->_setProxy(); $cookies = null; if (is_array($this->request['header'])) { @@ -275,7 +276,6 @@ class HttpSocket extends CakeSocket { $this->setAuthConfig('Basic', $this->request['uri']['user'], $this->request['uri']['pass']); } $this->_setAuth(); - $this->_setProxyConfig(); if (is_array($this->request['body'])) { $this->request['body'] = $this->_httpSerialize($this->request['body']); @@ -501,7 +501,7 @@ class HttpSocket extends CakeSocket { * @return void * @throws Exception */ - protected function _setProxyConfig() { + protected function _setProxy() { if (empty($this->_proxy) || !isset($this->_proxy['host'], $this->_proxy['port'])) { return; } diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php index d589f11a3..156dc9816 100644 --- a/cake/tests/cases/libs/http_socket.test.php +++ b/cake/tests/cases/libs/http_socket.test.php @@ -662,7 +662,7 @@ class HttpSocketTest extends CakeTestCase { $this->assertEqual($this->Socket->config['port'], 123); $this->Socket->setAuthConfig('Test', 'login', 'passwd'); - $expected = "GET http://www.cakephp.org/ HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\nAuthorization: Test login.passwd\r\nProxy-Authorization: Test mark.secret\r\n\r\n"; + $expected = "GET http://www.cakephp.org/ HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\nProxy-Authorization: Test mark.secret\r\nAuthorization: Test login.passwd\r\n\r\n"; $this->Socket->request('http://www.cakephp.org/'); $this->assertEqual($this->Socket->request['raw'], $expected); }