[PATCH] Addition of setcookie2() to support RFC 2965
| From: | Ben Ramsey | Date: | Sat, 25 Aug 2007 06:35:31 +0000 |
| Subject: | [PATCH] Addition of setcookie2() to support RFC 2965 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-31905@lists.php.net to get a copy of this message | ||
Here is a patch I am submitting as a recommendation to implement a
setcookie2() function to support the Set-Cookie2 response header defined
in RFC 2965.
RFC 2965 obsoletes the original Netscape cookie specification and RFC
2109. Unfortunately, the only major browser I can find that implements
Cookie2 and Set-Cookie2 from the client side is Opera. Nevertheless, the
Set-Cookie2 header provides improvements over the original Set-Cookie
header:
1) Clients can provide users with more control over what they accept and
show them the provided Comment or a link to the CommentURL, allowing the
application can tell the user how it is using the specific cookie.
2) Discard and Max-Age provide better control over cookie expiration and
deletion. (Expires is not present.)
3) Port provides the ability to specify a list of ports for which the
cookie is valid (at the given Domain).
There are a few statements in RFC 2965 that this patch does not cover:
"When it receives a Cookie header, the origin server SHOULD treat
cookies with NAMEs whose prefix is $ specially, as an attribute for the
cookie."
"User agents that receive in the same response both a Set-Cookie and
Set-Cookie2 response header for the same cookie MUST discard the
Set-Cookie information and use only the Set-Cookie2 information." (If
the user agent obeys this rule, then this could potentially cause a
problem setting PHPSESSID with Set-Cookie and setting cookies with
setcookie2() in the same response.)
--
Ben Ramsey
http://benramsey.com/