mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 10:03:27 +01:00
Merge pull request #1406 from dvaeversted/noqoute-cookies
Do not attempt to escape cookie values.
This commit is contained in:
commit
739b9c8378
@ -58,22 +58,10 @@ class CookieJar implements CookieJarInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote the cookie value if it is not already quoted and it contains
|
||||
* problematic characters.
|
||||
*
|
||||
* @param string $value Value that may or may not need to be quoted
|
||||
*
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getCookieValue($value)
|
||||
{
|
||||
if (substr($value, 0, 1) !== '"' &&
|
||||
substr($value, -1, 1) !== '"' &&
|
||||
strpbrk($value, ';,=')
|
||||
) {
|
||||
$value = '"' . $value . '"';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
@ -248,7 +236,7 @@ class CookieJar implements CookieJarInterface
|
||||
(!$cookie->getSecure() || $scheme == 'https')
|
||||
) {
|
||||
$values[] = $cookie->getName() . '='
|
||||
. self::getCookieValue($cookie->getValue());
|
||||
. $cookie->getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,6 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testQuotesBadCookieValues()
|
||||
{
|
||||
$this->assertEquals('foo', CookieJar::getCookieValue('foo'));
|
||||
$this->assertEquals('"foo,bar"', CookieJar::getCookieValue('foo,bar'));
|
||||
$this->assertEquals('"foobar="', CookieJar::getCookieValue('foobar='));
|
||||
$this->assertEquals('"foo;bar"', CookieJar::getCookieValue('foo;bar'));
|
||||
}
|
||||
|
||||
public function testCreatesFromArray()
|
||||
{
|
||||
$jar = CookieJar::fromArray([
|
||||
|
Loading…
x
Reference in New Issue
Block a user