up vote 1 down vote favorite
share [g+] share [fb]

I'm baking a cookies.txt file for use with some wget scripts and can't find a lot of detailed information. Currently, I'm trying to determine the difference between "domain.tld"-style cookies and ".domain.tld"-style cookies (with and without leading dot).

I've pulled a bunch of cookies from Firefox's database and there doesn't seem to be any consistency, even within the same domain. For example, this very site sets a cookie named "user" for the domain "superuser.com" and another called "__qca" for the domain ".superuser.com".

What is the significance of the leading dot? Is it perhaps related to the "can be read by other machines at the same domain" column in cookies.txt?

link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

If it is set as ".superuser.com", then "foo.superuser.com" will get the cookie, but if it is set as "superuser.com" then "foo.superuser.com" does not get it.

You can read all the gory details of this in RFC 2109

link|improve this answer
I think I see where I was confused; I was focused on the "domains must start with a dot" part of the spec, but if the ";domain=" part of the Set-Cookie header is left off completely, you get a no-leading-dot hostname. Thanks! – Ben Blank Jul 29 '09 at 0:24
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.