cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: upload to browser

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Tue, 22 Feb 2005 01:46:01 -0600

Actually, there *is* a number in the cookie file that represents the
expiry date - it's the 5th field, and it's given in seconds since the
Epoch.

A header such as:

Set-Cookie: pma_theme=original; expires=Thu, 24-Mar-2005 07:02:38 GMT;
path=/phpmyadmin

results in a cookie.txt entry like this:

10.134.11.24 FALSE /phpmyadmin FALSE 1111647820
pma_theme original

I think the big number, 1111647820, is the expiry time. You can get
the current time in that format with

     date +%s

So, you might do something like:

  <upload the images with curl>
  x=`date +%s` # get time in seconds
  x=`expr $x + 300` # add 5 minutes
   <edit the cookie file somehow, to replace the timeout>
   /usr/bin/firefox http://wherever.the.images.are.com

The timeout on a session cookie may well be zero, as that's a long way
back in the past... Other cookies will have that big magic number.

If you're going to point to your actual browser cookie file you should
probably mention it in both places:

     curl -b /path/to/cookies.txt -c /path/to/cookies.txt

That way, curl will load up all the cookies you have, then save them
again, along with updates. If you give it an empty to file to load,
it will *only* have the new cookies to save, and you'll lose any other
cookies that were in the browser cookie file. Of course, it's up to
you if you care much about that... :)

Ralph Mitchell

On Tue, 22 Feb 2005 01:00:12 +0100, Magnus Stålnacke <jemamo_at_telia.com> wrote:
> Daniel Stenberg wrote:
>
> >
> > Also, the cookie(s) might be "session" cookies that Mozilla won't
> > (re-) use.
>
> It is sessioncookies (expire at end of session, says the cookie manager).
>
> > You could possibly avoid that by forcing them to expire at a later time.
> >
> I do not have a clue how to do this.
> The values in the mozilla cookie manager does not
> correspond to anything in the cookies.txt file, that is
> obviously the wrong file (though it canges when i get
> a cookie...), there is nothing that even resembles an
> expiring date anywere in that file, but the cookie manager
> says there is.. i do not get it. I know how to use sed, but in
> this case.. i do not know what file to edit.
>
> Anyway, when i use "curl -b none -c path/to/cookie.txt"
> is that at least supposed to be right?
>
>
> --
> Software is not manufactured, it is something you write and publish.
> Keep Europe free from software patents, we do not want censorship
> by patent law on written works.
>
>
Received on 2005-02-22