1

Why does curl receive an expired cookie?

In a response to some url the server is sending a 302 Found response and a cookie. In Firefox this cookie gets set seamlessly. Firebug says:

    Set-Cookie  somekookie=91b115e3d4a5889ed93e70a7ddb24957a1eb0e27cbcd96a3342a8064; expires=Sun, 24-Oct-2010 23:28:55 GMT; path=/; domain=.somedomain.ru

However when curl requests the same url, the cookie is expired, curl's output:

    * Added cookie somecookie="deleted" for domain somedomain.com, path /, expire 1224891945
    < Set-Cookie: somecookie=deleted; expires=Fri, 24-Oct-2008 23:45:45 GMT; path=/; domain=.somedomain.com

Why does the date appear to be so old and how to resolve this issue?

Alex
  • 2,287
  • 5
  • 32
  • 41

2 Answers2

2

Have you tried:

curl -L -b null somedomain.com

-b turns on cookies, -L follows a location (302). 'null' is any empty/nonexistent file.

or perhaps storing the cookies:

curl -b cookies -c cookies somedomain.com

-c writes to a netscape-style cookies file.

Without any more information that's the best I can do. HTH.

Sam Halicke
  • 6,122
  • 1
  • 24
  • 35
1

Well, when curl does the request there's no Cookie set (unless you specify one), so the server is probably just saying: this is a new session, I'm gonna delete any cookie you might have for any of the sites on this domain just in case.

On the firefox one, is there a cookie sent with the request?

David d C e Freitas
  • 2,712
  • 1
  • 16
  • 13