mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-07 20:12:42 +00:00
Test case for proxy authentication when request is HTTPS
This commit is contained in:
parent
ac50b609ac
commit
077f157adf
1 changed files with 40 additions and 0 deletions
|
@ -19,6 +19,24 @@
|
|||
App::uses('HttpSocket', 'Network/Http');
|
||||
App::uses('BasicAuthentication', 'Network/Http');
|
||||
|
||||
/**
|
||||
* class TestHttpSocket
|
||||
*
|
||||
* @package Cake.Test.Case.Network.Http
|
||||
*/
|
||||
class TestHttpSocket extends HttpSocket {
|
||||
|
||||
/**
|
||||
* testSetProxy method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetProxy($proxy = null) {
|
||||
$this->_proxy=$proxy;
|
||||
$this->_setProxy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* BasicMethodTest class
|
||||
*
|
||||
|
@ -60,4 +78,26 @@ class BasicAuthenticationTest extends CakeTestCase {
|
|||
$this->assertEquals('Basic bWFyazpzZWNyZXQ=', $http->request['header']['Proxy-Authorization']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testProxyAuthenticationSsl method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testProxyAuthenticationSsl() {
|
||||
$http = new TestHttpSocket();
|
||||
$http->request['uri']['scheme'] = 'https';
|
||||
$proxy = array(
|
||||
'host' => 'localhost',
|
||||
'port' => 3128,
|
||||
'method' => 'Basic',
|
||||
'user' => 'mark',
|
||||
'pass' => 'secret'
|
||||
);
|
||||
|
||||
$http->testSetProxy($proxy);
|
||||
|
||||
$this->assertEquals('Basic bWFyazpzZWNyZXQ=', $http->config['proxyauth']);
|
||||
$this->assertFalse(isset($http->request['header']['Proxy-Authorization']));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue