Added test to a request that server dont response WWW-Authenticate.

This commit is contained in:
Juan Basso 2010-11-24 21:14:52 -02:00
parent 3056fbf680
commit af06b8f179

View file

@ -37,6 +37,12 @@ class DigestHttpSocket extends HttpSocket {
* @return void
*/
public function request($request) {
if ($request === false) {
if (isset($this->response['header']['WWW-Authenticate'])) {
unset($this->response['header']['WWW-Authenticate']);
}
return;
}
$this->response['header']['WWW-Authenticate'] = $this->nextHeader;
}
@ -179,4 +185,17 @@ class DigestAuthenticationTest extends CakeTestCase {
$this->assertNotEqual($response, 'da7e2a46b471d77f70a9bb3698c8902b');
}
/**
* testNoDigestResponse method
*
* @return void
*/
public function testNoDigestResponse() {
$this->HttpSocket->nextHeader = false;
$this->HttpSocket->request['uri']['path'] = '/admin';
$this->HttpSocket->config['request']['auth'] = array();
DigestAuthentication::authentication($this->HttpSocket);
$this->assertFalse(isset($this->HttpSocket->request['header']['Authorization']));
}
}