You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Kadlabalu, Hareesh" <ha...@fatwire.com> on 2005/08/19 00:25:50 UTC
Question about CookieSpec
Hi,
I am replacing an old HTTP abstraction in my application to use HttpClient.
The old code relied on just 'cookie name' and 'cookie value', the cookies
that are captured/generated did not contain 'domain' and 'path'.
When I tried to pass the same cookies through HttpClient, they are ignored.
After looking through the documentation and code, I see that
CookieSpecsBase.match() ignores it (with a warning in the logs). I believe
this is the most permissive mode.
Unfortunately I still need to support those cookies (they are basically just
key-value pair of Strings), but I do not know if such cookie is a part of a
specific RFC or if there are side effects of using a RFC specific
CookieSpecs on the large existing code base of my application.
So I think I have to roll my own CookieSpec implementation and register that
as default. This is rather drastic (or is it?), just wanted to check if this
problem has been solved before or is there something I am missing. Your help
is very much appreciated.
Thanks
-Hareesh
(my apologies if this question has been asked and answered before)
Re: Question about CookieSpec
Posted by Roland Weber <RO...@de.ibm.com>.
Hello Hareesh,
> When I tried to pass the same cookies through HttpClient, they are
ignored.
> After looking through the documentation and code, I see that
> CookieSpecsBase.match() ignores it (with a warning in the logs). I
believe
> this is the most permissive mode.
What do you mean by "passing through HttpClient"? Did you put cookie
objects
into the HttpState or did you set a Cookie: header or did you try
something
else?
In your place, I would just put the cookies into the HttpState and supply
a
default domain and path. Use the target host name for the domain and / as
the path. Then the match in CookieSpecBase should work.
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org