Skip to content

Commit

Permalink
Renamed setAuthConfig to configAuth, and setProxyConfig to configProxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Dec 13, 2010
1 parent d332f06 commit c20b5d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cake/libs/http_socket.php
Expand Up @@ -181,7 +181,7 @@ public function __construct($config = array()) {
* @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;
Expand All @@ -203,7 +203,7 @@ public function setAuthConfig($method, $user = null, $pass = null) {
* @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;
Expand Down Expand Up @@ -310,7 +310,7 @@ public function &request($request = array()) {
}

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;
Expand Down
10 changes: 5 additions & 5 deletions cake/tests/cases/libs/http_socket.test.php
Expand Up @@ -715,7 +715,7 @@ public function testProxy() {
$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);
Expand Down Expand Up @@ -745,7 +745,7 @@ public function testProxy() {
$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');
Expand All @@ -759,7 +759,7 @@ public function testProxy() {
);
$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);
Expand Down Expand Up @@ -879,11 +879,11 @@ public function testAuth() {
$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);
}
Expand Down

0 comments on commit c20b5d7

Please sign in to comment.