You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by "GoMp@tcl.no" <go...@tcl.no> on 2005/01/12 00:41:31 UTC

Cookies and expiration

Does anyone have a thorough explanation of the cookie expiration format?

I've tried the '-minutes <minutes to expiration as integer>' without any 
luck. I'm also a bit confused regarding ?-expires Wdy, DD-Mon-YYYY 
HH:MM:SS GMT?... What is actually neccessary here? And in what format 
comes the first part, Wdy, and what is GMT to represent, unless it is an 
optional switch?

These are rather simple questions, so I hope someone can help me.

Sincerely,
    GoMp
    www.g0mp.org
    www.tcl.no

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Cookies and expiration

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> That's helpful, thank you. But alas, there is some unclear objects:
> 
> 1) Concrete example would be helpful.
> 2) Since my timezone is GMT+1, does that mean I can do [expr [clock 
> seconds] - 3600] and from there on use [clock format]?

clock format [clock seconds] -format "%a, %d-%b-%Y %T %Z" -gmt 1

Ronnie
----------------------------------------------------------------------
Ronnie Brunner                             ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich   phone +41 1 247 79 79 fax +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Cookies and expiration

Posted by "David N. Welton" <da...@dedasys.com>.
> I specifically stated that I did NOT get the -minutes option to work
> properly.

What was wrong with it?  What is actually going out over the wire?

-- 
David N. Welton
 - http://www.dedasys.com/davidw/

Apache, Linux, Tcl Consulting
 - http://www.dedasys.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Cookies and expiration

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> Now I have one more question to you peeps out there... it has come to my 
> attention that the cookieformat in mod_dtcl allowed +1y etc... Is this 
> the case for Rivet too? That would make it way simpler by using +15m, as 
> I can't get the -minutes option to work...

-expires [clock format [clock scan "15min"] -format "%a, %d-%b-%Y %T %Z" -gmt 1]

Ronnie
----------------------------------------------------------------------
Ronnie Brunner                             ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich   phone +41 1 247 79 79 fax +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Cookies and expiration

Posted by "GoMp@tcl.no" <go...@tcl.no>.

Ben L. wrote:
>>That's helpful, thank you. But alas, there is some unclear objects:
>>
>>1) Concrete example would be helpful.
>>2) Since my timezone is GMT+1, does that mean I can do [expr [clock
>>seconds] - 3600] and from there on use [clock format]?
>>
>>Regarding what you said, Ben L, I think it seemed quite obvious that I
>>HAD read the documentation, as the line I pasted was a quotation from
>>the docs of Rivet. Anyhow, thanks for helping.
> 
> 
> I was just trying to present you with the simplist solution. Why go thru
> all the date math and clock formatting when all you need to do is
> -minutes, -days?
> 
> Anyways here's some more code that may be useful to you. Once you get the
> seconds you want then you can use clock_to_rfc850_gmt. This will format it
> correctly for [cookie]. It's a shortcut from using [clock format]
> 
> #sets the exprdate to +1 day
> set exprdate [clock_to_rfc850_gmt [expr [clock seconds]+86400]]
> #setting cookie
> cookie set cookiename "cookiedata" -expires $exprdate
> 
> or you could just do:
> 
> cookie set cookiename "cookiedata" -days 1
> 
> Hope this helps,
> Ben
> 
> 
> 

Thanks one more time, but I think you need to re-read the original mail 
I sent out. I specifically stated that I did NOT get the -minutes option 
to work properly. I will try what you now mentioned, but earlier 
experience suggested that I should try to use the -expires option instead.

Now I have one more question to you peeps out there... it has come to my 
attention that the cookieformat in mod_dtcl allowed +1y etc... Is this 
the case for Rivet too? That would make it way simpler by using +15m, as 
I can't get the -minutes option to work...

Sincerely,
	GoMp
	www.g0mp.org
	www.tcl.no

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Cookies and expiration

Posted by "GoMp@tcl.no" <go...@tcl.no>.
That's helpful, thank you. But alas, there is some unclear objects:

1) Concrete example would be helpful.
2) Since my timezone is GMT+1, does that mean I can do [expr [clock 
seconds] - 3600] and from there on use [clock format]?

Regarding what you said, Ben L, I think it seemed quite obvious that I 
HAD read the documentation, as the line I pasted was a quotation from 
the docs of Rivet. Anyhow, thanks for helping.

Sincerely,
	GoMp
	www.g0mp.org
	www.tcl.no


Ronnie Brunner wrote:
>>Does anyone have a thorough explanation of the cookie expiration format?
>>
>>I've tried the '-minutes <minutes to expiration as integer>' without any 
>>luck. I'm also a bit confused regarding ?-expires Wdy, DD-Mon-YYYY 
>>HH:MM:SS GMT?... What is actually neccessary here? And in what format 
>>comes the first part, Wdy, and what is GMT to represent, unless it is an 
>>optional switch?
>>
>>These are rather simple questions, so I hope someone can help me.
> 
> 
> Don't know about the -minutes option, but the second form is just the
> actual form needed in the cookie. (GMT is not optional and the time
> must be specified in GMT): 
> 
> expires=DATE
>     The expires attribute specifies a date string that defines the
>     valid life time of that cookie. Once the expiration date has been
>     reached, the cookie will no longer be stored or given out.
> 
>     The date string is formatted as:
> 
>         Wdy, DD-Mon-YYYY HH:MM:SS GMT
> 
>     This is based on RFC 822, RFC 850, RFC 1036, and RFC 1123, with
>     the variations that the only legal time zone is GMT and the
>     separators between the elements of the date must be dashes.
> 
>     expires is an optional attribute. If not specified, the cookie
>     will expire when the user's session ends.
> 
>     Note: There is a bug in Netscape Navigator version 1.1 and
>     earlier. Only cookies whose path attribute is set explicitly to
>     "/" will be properly saved between sessions if they have an
>     expires attribute.
> 
> (from http://wp.netscape.com/newsref/std/cookie_spec.html)
> 
> hth
> Ronnie
> ----------------------------------------------------------------------
> Ronnie Brunner                             ronnie.brunner@netcetera.ch
> Netcetera AG, 8040 Zuerich   phone +41 1 247 79 79 fax +41 1 247 70 75
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Cookies and expiration

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> Does anyone have a thorough explanation of the cookie expiration format?
> 
> I've tried the '-minutes <minutes to expiration as integer>' without any 
> luck. I'm also a bit confused regarding ?-expires Wdy, DD-Mon-YYYY 
> HH:MM:SS GMT?... What is actually neccessary here? And in what format 
> comes the first part, Wdy, and what is GMT to represent, unless it is an 
> optional switch?
> 
> These are rather simple questions, so I hope someone can help me.

Don't know about the -minutes option, but the second form is just the
actual form needed in the cookie. (GMT is not optional and the time
must be specified in GMT): 

expires=DATE
    The expires attribute specifies a date string that defines the
    valid life time of that cookie. Once the expiration date has been
    reached, the cookie will no longer be stored or given out.

    The date string is formatted as:

        Wdy, DD-Mon-YYYY HH:MM:SS GMT

    This is based on RFC 822, RFC 850, RFC 1036, and RFC 1123, with
    the variations that the only legal time zone is GMT and the
    separators between the elements of the date must be dashes.

    expires is an optional attribute. If not specified, the cookie
    will expire when the user's session ends.

    Note: There is a bug in Netscape Navigator version 1.1 and
    earlier. Only cookies whose path attribute is set explicitly to
    "/" will be properly saved between sessions if they have an
    expires attribute.

(from http://wp.netscape.com/newsref/std/cookie_spec.html)

hth
Ronnie
----------------------------------------------------------------------
Ronnie Brunner                             ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich   phone +41 1 247 79 79 fax +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org