You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Geert Engels <ge...@inceptor.com> on 2004/01/26 13:41:12 UTC

Cactus 1.5 and WebRequest.addCookie(String, String) ?

Hi,

I have been using Cactus-13-1.4.1 + httpclient (nightly drop from
21-04-2002) for a long time now, and been very happy with it.

Last week, I upgraded to Cactus-13-1.5 + httpclient 2.0RC3, and
noticed that some unit tests which have been working great for 6
months or more suddenly started failing consistently.

What all these tests have in common is that they depend on setting
cookies through WebRequest.addCookie(String, String).  Somehow the
cookies are no longer making it to the serverside instance of the
test.

I tried various things, including setting the cookie domain
explicitly, but no luck.

Switching on debug output for cactus and httpclient revealed that
httpclient no longer deemed the cookies worthy of transfer.

I added some extra debug code to httpclient, and was able to see that in
org.apache.commons.httpclient.cookie.CookieSpecBase.java:462, the method
with signature:

	public boolean match(String host, int port, String path, boolean
secure, final Cookie cookie)

returns false, contrary to my expectations.  More specifically, it is
the pathMatch portion of the test that fails.

In that pathMatch, the following are being compared:

	path={/cactus/ServletRedirector}
	cookie.getPath()={/cheap}

The "/cheap" is part of the request I'm trying to make, set up through
WebRequest.setURL().  But the "/cactus/ServletRedirector" part, is that
not something that is internal to Cactus and should be totally
transparent to my test code ?

In any event, I did not have this problem with prior cactus/httpclient
versions.

I went through the mailing list archives, but could find only one recent
reference to cookie problems, which was a question without reply:
http://www.mail-archive.com/cactus-user@jakarta.apache.org/msg04183.html

Any help would be very much appreciated.

Thanks,

Geert Engels.
VP of Product Development
Inceptor, Inc.



RE: Cactus 1.5 and WebRequest.addCookie(String, String) ?

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Geert,

Your problem seems to come from HttpClient. They were some bugs which
they have fixed in their RC2 version. I guess you could try to use the
same httplient jar that you were previously using (not sure if there are
incompatibilities or not). Alternatively, I would recommend sending an
email to the commons-httpclient-dev mailing list, asking them for help.
They're very reactive and should be able to help you in a snap.

Thanks
-Vincent

> -----Original Message-----
> From: Geert Engels [mailto:geert@inceptor.com]
> Sent: 26 January 2004 13:41
> To: cactus-user@jakarta.apache.org
> Subject: Cactus 1.5 and WebRequest.addCookie(String, String) ?
> 
> 
> Hi,
> 
> I have been using Cactus-13-1.4.1 + httpclient (nightly drop from
> 21-04-2002) for a long time now, and been very happy with it.
> 
> Last week, I upgraded to Cactus-13-1.5 + httpclient 2.0RC3, and
> noticed that some unit tests which have been working great for 6
> months or more suddenly started failing consistently.
> 
> What all these tests have in common is that they depend on setting
> cookies through WebRequest.addCookie(String, String).  Somehow the
> cookies are no longer making it to the serverside instance of the
> test.
> 
> I tried various things, including setting the cookie domain
> explicitly, but no luck.
> 
> Switching on debug output for cactus and httpclient revealed that
> httpclient no longer deemed the cookies worthy of transfer.
> 
> I added some extra debug code to httpclient, and was able to see that
in
> org.apache.commons.httpclient.cookie.CookieSpecBase.java:462, the
method
> with signature:
> 
> 	public boolean match(String host, int port, String path, boolean
> secure, final Cookie cookie)
> 
> returns false, contrary to my expectations.  More specifically, it is
> the pathMatch portion of the test that fails.
> 
> In that pathMatch, the following are being compared:
> 
> 	path={/cactus/ServletRedirector}
> 	cookie.getPath()={/cheap}
> 
> The "/cheap" is part of the request I'm trying to make, set up through
> WebRequest.setURL().  But the "/cactus/ServletRedirector" part, is
that
> not something that is internal to Cactus and should be totally
> transparent to my test code ?
> 
> In any event, I did not have this problem with prior cactus/httpclient
> versions.
> 
> I went through the mailing list archives, but could find only one
recent
> reference to cookie problems, which was a question without reply:
>
http://www.mail-archive.com/cactus-user@jakarta.apache.org/msg04183.html
> 
> Any help would be very much appreciated.
> 
> Thanks,
> 
> Geert Engels.
> VP of Product Development
> Inceptor, Inc.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org