Renamed setAuthConfig to configAuth, and setProxyConfig to configProxy.

This commit is contained in:
Juan Basso 2010-12-12 23:48:04 -02:00
parent d332f0624f
commit c20b5d7053
2 changed files with 8 additions and 8 deletions

View file

@ -181,7 +181,7 @@ class HttpSocket extends CakeSocket {
* @param string $pass Password for authentication
* @return void
*/
public function setAuthConfig($method, $user = null, $pass = null) {
public function configAuth($method, $user = null, $pass = null) {
if (empty($method)) {
$this->_auth = array();
return;
@ -203,7 +203,7 @@ class HttpSocket extends CakeSocket {
* @param string $pass Password to proxy authentication
* @return void
*/
public function setProxyConfig($host, $port = 3128, $method = null, $user = null, $pass = null) {
public function configProxy($host, $port = 3128, $method = null, $user = null, $pass = null) {
if (empty($host)) {
$this->_proxy = array();
return;
@ -310,7 +310,7 @@ class HttpSocket extends CakeSocket {
}
if (isset($this->request['uri']['user'], $this->request['uri']['pass'])) {
$this->setAuthConfig('Basic', $this->request['uri']['user'], $this->request['uri']['pass']);
$this->configAuth('Basic', $this->request['uri']['user'], $this->request['uri']['pass']);
}
$this->_setAuth();
$this->request['auth'] = $this->_auth;

View file

@ -715,7 +715,7 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->expects($this->any())->method('connect')->will($this->returnValue(true));
$this->Socket->expects($this->any())->method('read')->will($this->returnValue(false));
$this->Socket->setProxyConfig('proxy.server', 123);
$this->Socket->configProxy('proxy.server', 123);
$expected = "GET http://www.cakephp.org/ HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\n\r\n";
$this->Socket->request('http://www.cakephp.org/');
$this->assertEqual($this->Socket->request['raw'], $expected);
@ -745,7 +745,7 @@ class HttpSocketTest extends CakeTestCase {
$this->assertEqual($this->Socket->request['proxy'], $expected);
$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\n\r\n";
$this->Socket->setProxyConfig('proxy.server', 123, 'Test', 'mark', 'secret');
$this->Socket->configProxy('proxy.server', 123, 'Test', 'mark', 'secret');
$this->Socket->request('http://www.cakephp.org/');
$this->assertEqual($this->Socket->request['raw'], $expected);
$this->assertEqual($this->Socket->config['host'], 'proxy.server');
@ -759,7 +759,7 @@ class HttpSocketTest extends CakeTestCase {
);
$this->assertEqual($this->Socket->request['proxy'], $expected);
$this->Socket->setAuthConfig('Test', 'login', 'passwd');
$this->Socket->configAuth('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\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);
@ -879,11 +879,11 @@ class HttpSocketTest extends CakeTestCase {
$socket->get('http://mark:secret@example.com/test');
$this->assertTrue(strpos($socket->request['header'], 'Authorization: Basic bWFyazpzZWNyZXQ=') !== false);
$socket->setAuthConfig(false);
$socket->configAuth(false);
$socket->get('http://example.com/test');
$this->assertFalse(strpos($socket->request['header'], 'Authorization:'));
$socket->setAuthConfig('Test', 'mark', 'passwd');
$socket->configAuth('Test', 'mark', 'passwd');
$socket->get('http://example.com/test');
$this->assertTrue(strpos($socket->request['header'], 'Authorization: Test mark.passwd') !== false);
}