Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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