mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Renamed proxy method and calling togheter from host config.
This commit is contained in:
parent
30a70b700b
commit
d656bdae3b
2 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue