DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=25157>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=25157

HTTP Cookie Manager doesn't work





------- Additional Comments From [EMAIL PROTECTED]  2004-03-16 16:09 -------
I too have had the same issue. I have debugged it down to the clear() method 
inside of CookieManager. This method removes all cookies from it's properties, 
including one's that are StoredCookies from the GUI, or from the config file.

If you do not check the 'Clear cookies from each iteration?' box, the 
StoredCookies will stay there, but if you check the box (which I would assume 
*would not* clear the stored ones), it removes all the StoredCookies.

**HOWEVER**** -- none of this was able to be caught until I found a bug 
dealing with the Cookie Expiration. The logic to see if a cookie should be put 
on the header (getCookieHeaderForURL()) checks to see if the expiration is 
greater than currentTimeMillis()/1000. That is fine for cookies that are set 
by the browser, because they know what the current time is. But for 
StoredCookies that want to be memory resident, they should be able to set the 
expiration time to '0' and have it work.

So, the quick fix for this is to change line 292 in CookieManager.java from (I 
will sumbit a new bug for this):

 && (System.currentTimeMillis() / 1000) <= cookie.getExpires())

to:
 && ((cookie.getExpires()==0)||(System.currentTimeMillis() / 1000) <= 
cookie.getExpires()))

This will allow StoredCookies to be memory resident cookies, and not have to 
worry about expirations.

However, the 'Clear cookies' bug still exists -- it clears all of the cookies, 
and not just browser set ones. I think the level of this bug should be 
increased.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to