You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dIon Gillard <di...@multitask.com.au> on 2002/03/01 01:54:19 UTC

Re: [httpclient] New change to Cookie.java breaks Cactus

Thanks,

I think I've already closed the bug :)

Vincent Massol wrote:

>It needs to work fine now :-)
>
>Sorry for the delay in my answer but there were other bugs I had to
>resolve before knowing your fix was working !
>
>Thanks
>-Vincent
>
>>-----Original Message-----
>>From: dIon Gillard [mailto:dion@multitask.com.au]
>>Sent: 19 February 2002 23:33
>>To: Jakarta Commons Developers List
>>Subject: Re: [httpclient] New change to Cookie.java breaks Cactus
>>
>>Hi Vincent,
>> can you test this one for me, and let me know if all is now ok??
>>
>>
>>Vincent Massol wrote:
>>
>>>I have had a closer look at my code ... :-) and the problem is not
>>>
>where
>
>>>I though it was. Actually, I do specify the domain for each cookie so
>>>this is not the issue.
>>>
>>>The issue is with the cookie "path". I do not specify any path for my
>>>cookies. This is in conformance with the Cookie class that has a
>>>constructor that do not take a path parameter (i.e. it is not
>>>
>mandatory
>
>>>and can be null).
>>>
>>>Actually the Cookie.matches() method allows for null paths.
>>>
>>>However, it seems the newly introduced compare() method breaks this
>>>
>as
>
>>>it does not check for a null path !
>>>
>>>Also, in createCookieHeader() method (around line 474), there is :
>>>
>>>       Set addedCookies = new TreeSet(cookies[0]);
>>>       for(int i=0;i<cookies.length;i++) {
>>>           if(cookies[i].matches(domain,port,path,secure,now)) {
>>>               addedCookies.add(cookies[i]);
>>>               added = true;
>>>           }
>>>       }
>>>
>>>thus, it seems cookies[0] gets added twice ? Or at least, it gets
>>>checked when it is not needed, as the add() triggers a comparison to
>>>
>see
>
>>>if the element (Cookie) already exist in the Tree, and the
>>>Cookie.compare() method is called.
>>>
>>>Can someone correct this please (sorry I have no time right now. It
>>>actually already took me some time to find this
>>>
>backward-compatibility
>
>>>break ! :-)
>>>
>>>I highly suggest that you start by writing a test case that creates a
>>>Cookie with no path specified and then try to call
>>>
>createCookieHeader().
>
>>>Thus it it will fail. Then, correct the code. This way, it won't
>>>
>happen
>
>>>again ... :-)
>>>
>>>Thanks
>>>-Vincent
>>>
>>--
>>dIon
>>


-- 
dIon Gillard, Multitask Consulting
http://adslgateway.multitask.com.au/developers




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