You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by Mike Stover <ms...@apache.org> on 2002/09/20 21:37:51 UTC

Re: Cookie Manager, expiration time, bug or wanted behaviour?

Well, that's kind of funny.  It essentially just means cookies will never expire so far 
as JMeter is concerned.  I trust JMeter worked for you either way?

-Mike

On 21 Sep 2002 at 0:19, Tom Wiedenhöft wrote:

> Hi,
> 
> I'm using the CookieManager in my programm and found the following.
> 
> Adding of a Cookie is done in milliseconds (current time in milliseconds + a 
> day in milliseconds). A day seems to be the wanted default expiration time.
> ---schnipp---
> Cookie newCookie =
> 	new Cookie(
> 		name, value, domain, path, false,
> 		System.currentTimeMillis() + 1000 * 60 * 60 * 24);
> ---schnapp--
> 
> Getting a Cookie is done with current time in seconds compared to expiration 
> value in milliseconds
> ---schnipp---
> if (	url.getHost().endsWith(cookie.getDomain()) &&
> 	url.getFile().startsWith(cookie.getPath()) &&
> 	(System.currentTimeMillis() / 1000) <= cookie.getExpires() )
> ---schnapp--
> Is this the wanted behaviour?
> 
> I changed it to:
> ---schnipp---
> if (	url.getHost().endsWith(cookie.getDomain()) &&
> 	url.getFile().startsWith(cookie.getPath()) &&
> 	System.currentTimeMillis() <= cookie.getExpires() )
> ---schnapp--
> This works for me.
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Cookie Manager, expiration time, bug or wanted behaviour?

Posted by Tom Wiedenhöft <pr...@tom-wiedenhoeft.de>.
Of course.
But I use the CookieManager in a different application and was astonished to 
see the CookieManager adding a day to the current time and then comparing 
seconds against milliseconds. It is a little bit like wearing braces AND a 
waistbelt.

Tom


Am Freitag, 20. September 2002 21:37 schrieb Mike Stover:
> Well, that's kind of funny.  It essentially just means cookies will never
> expire so far as JMeter is concerned.  I trust JMeter worked for you either
> way?
>
> -Mike
>
> On 21 Sep 2002 at 0:19, Tom Wiedenhöft wrote:
> > Hi,
> >
> > I'm using the CookieManager in my programm and found the following.
> >
> > Adding of a Cookie is done in milliseconds (current time in milliseconds
> > + a day in milliseconds). A day seems to be the wanted default expiration
> > time. ---schnipp---
> > Cookie newCookie =
> > 	new Cookie(
> > 		name, value, domain, path, false,
> > 		System.currentTimeMillis() + 1000 * 60 * 60 * 24);
> > ---schnapp--
> >
> > Getting a Cookie is done with current time in seconds compared to
> > expiration value in milliseconds
> > ---schnipp---
> > if (	url.getHost().endsWith(cookie.getDomain()) &&
> > 	url.getFile().startsWith(cookie.getPath()) &&
> > 	(System.currentTimeMillis() / 1000) <= cookie.getExpires() )
> > ---schnapp--
> > Is this the wanted behaviour?
> >
> > I changed it to:
> > ---schnipp---
> > if (	url.getHost().endsWith(cookie.getDomain()) &&
> > 	url.getFile().startsWith(cookie.getPath()) &&
> > 	System.currentTimeMillis() <= cookie.getExpires() )
> > ---schnapp--
> > This works for me.
> >
> >
> > --
> > To unsubscribe, e-mail:  
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>

-- 
Tom Wiedenhöft
Falkenstr. 6a, 81541 München
Tel:	089-21939574
Tel:	0163-6702011
Web:	http://www.tom-wiedenhoeft.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>