cookie headers convention

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

cookie headers convention

Post 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? :?:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I have no idea what you are asking.
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

depending on what modules/extensions you can use you might be interested in http://de2.php.net/function.http-parse-cookie
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post 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" ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You cannot set two cookies with the same header. Two cookies, two headers.
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post 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?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post by visonardo »

thank :wink:
Post Reply