fixed detection of secure cookies received over https
BrowserKit's cookie handling only recognises a secure cookie if the cookie option is set and the cookie was set over an https request. The client was not passing the url into the cookiejar update code, causing Cookie::isSecure() to always return false for every cookie. Fixes symfony/symfony#7666
This commit is contained in:
parent
1454af7235
commit
c2bc707a4d
@ -266,7 +266,7 @@ abstract class Client
|
||||
|
||||
$response = $this->filterResponse($this->response);
|
||||
|
||||
$this->cookieJar->updateFromResponse($response);
|
||||
$this->cookieJar->updateFromResponse($response, $uri);
|
||||
|
||||
$this->redirect = $response->getHeader('Location');
|
||||
|
||||
|
@ -205,6 +205,15 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array('foo' => 'bar'), $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
||||
}
|
||||
|
||||
public function testRequestSecureCookies()
|
||||
{
|
||||
$client = new TestClient();
|
||||
$client->setNextResponse(new Response('<html><a href="/foo">foo</a></html>', 200, array('Set-Cookie' => 'foo=bar; path=/; secure')));
|
||||
$client->request('GET', 'https://www.example.com/foo/foobar');
|
||||
|
||||
$this->assertTrue($client->getCookieJar()->get('foo','/','www.example.com')->isSecure());
|
||||
}
|
||||
|
||||
public function testClick()
|
||||
{
|
||||
if (!class_exists('Symfony\Component\DomCrawler\Crawler')) {
|
||||
|
Reference in New Issue
Block a user