Page 1 of 1

cookie headers convention

Posted: Thu Dec 14, 2006 11:40 pm
by visonardo
there is some convention about the order that appear the field in set-cookie?
for example its from google

Code: Select all

Set-Cookie: PREF=ID=bd23b0a91a2fe443:TM=1166146444:LM=1166146444:S=IQAgNP7HITfub-x1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com

may be that appear first the path or domain or expires field? :?:

Posted: Fri Dec 15, 2006 8:05 am
by feyd
I have no idea what you are asking.

Posted: Fri Dec 15, 2006 8:54 am
by visonardo
if can appear thus:

Code: Select all

Set-Cookie: domain=blablablabla; name=value; path=/; expires=blablablabla
or

Code: Select all

Set-Cookie: path=/; domain=domain.com; expires=blablaballba; name=value

i ask about the order where appeaver cookie´s name=cookie´s value

Posted: Fri Dec 15, 2006 9:01 am
by feyd
Have you tried it? Have you read the HTTP specification regarding the Set-Cookie directive? The latter will give you the definitive answer.

Posted: Fri Dec 15, 2006 10:36 am
by visonardo
feyd wrote:Have you tried it? Have you read the HTTP specification regarding the Set-Cookie directive? The latter will give you the definitive answer.
yes, now i did :D


but by that i have this problem (to take the cookie´s name everywhere be) viewtopic.php?t=60867

Posted: Sat Dec 16, 2006 4:32 am
by volka
depending on what modules/extensions you can use you might be interested in http://de2.php.net/function.http-parse-cookie

Posted: Sat Dec 16, 2006 10:10 am
by visonardo
Thank :wink:

Other thing: here

Code: Select all

"foo=bar; bar=baz; path=/; domain=example.com; comment=; secure"
is the example that give php.net of string set-cookie header to use with http_parse_cookie, why appear two times a pair name=value? does it means that i can set two cookies of same atributes but different name-value at the same "set-cookie" ?

does it the same that:

"foo=bar; path=/; domain=example.com; comment=; secure"
and in other linke
"bar=baz; path=/; domain=example.com; comment=; secure" ?

Posted: Sat Dec 16, 2006 10:56 am
by feyd
You cannot set two cookies with the same header. Two cookies, two headers.

Posted: Sat Dec 16, 2006 11:01 am
by visonardo
feyd wrote:You cannot set two cookies with the same header. Two cookies, two headers.
then why appear this "foo=bar; bar=baz;" in the example of php.net what does it means?

Posted: Sat Dec 16, 2006 11:08 am
by volka
Probably a mix of the way cookies are sent back client->server
http://wp.netscape.com/newsref/std/cookie_spec.html wrote:Cookie: NAME1=OPAQUE_STRING1; NAME2=OPAQUE_STRING2 ...
and Set-Cookie2
http://www.faqs.org/rfcs/rfc2965 wrote:Informally, the Set-Cookie2 response header comprises the token Set-
Cookie2:, followed by a comma-separated list of one or more cookies. Each cookie begins with a NAME=VALUE pair, followed by zero or more semi-colon-separated attribute-value pairs.

Posted: Sat Dec 16, 2006 11:43 am
by visonardo
thank :wink: