Skip to content

Commit

Permalink
add missing quotes around the header Value from set-cookie header
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensSahs committed Sep 5, 2013
1 parent a6bd16f commit b8022f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Http/Header/SetCookie.php
Expand Up @@ -208,7 +208,7 @@ public function getFieldValue()

$value = urlencode($this->getValue());

$fieldValue = $this->getName() . '=' . $value;
$fieldValue = $this->getName() . '="' . $value . '"';

$version = $this->getVersion();
if ($version!==null) {
Expand Down
32 changes: 16 additions & 16 deletions tests/ZendTest/Http/Header/SetCookieTest.php
Expand Up @@ -338,7 +338,7 @@ public static function validCookieWithInfoProvider()

return array(
array(
'Set-Cookie: justacookie=foo; domain=example.com',
'Set-Cookie: justacookie="foo"; domain=example.com',
array(
'name' => 'justacookie',
'value' => 'foo',
Expand All @@ -348,10 +348,10 @@ public static function validCookieWithInfoProvider()
'secure' => false,
'httponly'=> false
),
'justacookie=foo; Domain=example.com'
'justacookie="foo"; Domain=example.com'
),
array(
'Set-Cookie: expires=tomorrow; secure; path=/Space Out/; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=.example.com',
'Set-Cookie: expires="tomorrow"; secure; path=/Space Out/; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=.example.com',
array(
'name' => 'expires',
'value' => 'tomorrow',
Expand All @@ -361,10 +361,10 @@ public static function validCookieWithInfoProvider()
'secure' => true,
'httponly'=> false
),
'expires=tomorrow; Expires=Tue, 21-Nov-2006 08:33:44 GMT; Domain=.example.com; Path=/Space Out/; Secure'
'expires="tomorrow"; Expires=Tue, 21-Nov-2006 08:33:44 GMT; Domain=.example.com; Path=/Space Out/; Secure'
),
array(
'Set-Cookie: domain=unittests; expires=' . gmdate('D, d-M-Y H:i:s', $now) . ' GMT; domain=example.com; path=/some%20value/',
'Set-Cookie: domain="unittests"; expires=' . gmdate('D, d-M-Y H:i:s', $now) . ' GMT; domain=example.com; path=/some%20value/',
array(
'name' => 'domain',
'value' => 'unittests',
Expand All @@ -374,10 +374,10 @@ public static function validCookieWithInfoProvider()
'secure' => false,
'httponly'=> false
),
'domain=unittests; Expires=' . gmdate('D, d-M-Y H:i:s', $now) . ' GMT; Domain=example.com; Path=/some%20value/'
'domain="unittests"; Expires=' . gmdate('D, d-M-Y H:i:s', $now) . ' GMT; Domain=example.com; Path=/some%20value/'
),
array(
'Set-Cookie: path=indexAction; path=/; domain=.foo.com; expires=' . gmdate('D, d-M-Y H:i:s', $yesterday) . ' GMT',
'Set-Cookie: path="indexAction"; path=/; domain=.foo.com; expires=' . gmdate('D, d-M-Y H:i:s', $yesterday) . ' GMT',
array(
'name' => 'path',
'value' => 'indexAction',
Expand All @@ -387,11 +387,11 @@ public static function validCookieWithInfoProvider()
'secure' => false,
'httponly'=> false
),
'path=indexAction; Expires=' . gmdate('D, d-M-Y H:i:s', $yesterday) . ' GMT; Domain=.foo.com; Path=/'
'path="indexAction"; Expires=' . gmdate('D, d-M-Y H:i:s', $yesterday) . ' GMT; Domain=.foo.com; Path=/'
),

array(
'Set-Cookie: secure=sha1; secure; SECURE; domain=some.really.deep.domain.com',
'Set-Cookie: secure="sha1"; secure; SECURE; domain=some.really.deep.domain.com',
array(
'name' => 'secure',
'value' => 'sha1',
Expand All @@ -401,10 +401,10 @@ public static function validCookieWithInfoProvider()
'secure' => true,
'httponly'=> false
),
'secure=sha1; Domain=some.really.deep.domain.com; Secure'
'secure="sha1"; Domain=some.really.deep.domain.com; Secure'
),
array(
'Set-Cookie: justacookie=foo; domain=example.com; httpOnly',
'Set-Cookie: justacookie="foo"; domain=example.com; httpOnly',
array(
'name' => 'justacookie',
'value' => 'foo',
Expand All @@ -414,10 +414,10 @@ public static function validCookieWithInfoProvider()
'secure' => false,
'httponly'=> true
),
'justacookie=foo; Domain=example.com; HttpOnly'
'justacookie="foo"; Domain=example.com; HttpOnly'
),
array(
'Set-Cookie: PHPSESSID=123456789+abcd%2Cef; secure; domain=.localdomain; path=/foo/baz; expires=Tue, 21-Nov-2006 08:33:44 GMT;',
'Set-Cookie: PHPSESSID="123456789+abcd%2Cef"; secure; domain=.localdomain; path=/foo/baz; expires=Tue, 21-Nov-2006 08:33:44 GMT;',
array(
'name' => 'PHPSESSID',
'value' => '123456789+abcd%2Cef',
Expand All @@ -427,10 +427,10 @@ public static function validCookieWithInfoProvider()
'secure' => true,
'httponly'=> false
),
'PHPSESSID=123456789+abcd%2Cef; Expires=Tue, 21-Nov-2006 08:33:44 GMT; Domain=.localdomain; Path=/foo/baz; Secure'
'PHPSESSID="123456789+abcd%2Cef"; Expires=Tue, 21-Nov-2006 08:33:44 GMT; Domain=.localdomain; Path=/foo/baz; Secure'
),
array(
'Set-Cookie: myname=myvalue; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly',
'Set-Cookie: myname="myvalue"; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly',
array(
'name' => 'myname',
'value' => 'myvalue',
Expand All @@ -440,7 +440,7 @@ public static function validCookieWithInfoProvider()
'secure' => true,
'httponly'=> true
),
'myname=myvalue; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Domain=docs.foo.com; Path=/accounts; Secure; HttpOnly'
'myname="myvalue"; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Domain=docs.foo.com; Path=/accounts; Secure; HttpOnly'
),
array(
'Set-Cookie:',
Expand Down

0 comments on commit b8022f9

Please sign in to comment.