hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: httpClient and cokkies troubles
Date Thu, 10 Feb 2005 13:56:22 GMT
Michael,

I think I know what is going on. Are you using PHP on the server side,
by any chance? 

In the browser compatibility mode force all cookies into one request
header. This should do the trick.

See for details:
<http://jakarta.apache.org/commons/httpclient/3.0/cookies.html#Browser%20Compatibility>

Hope this helps

Oleg

On Thu, Feb 10, 2005 at 10:04:07AM +0100, Michael Niemaz wrote:
> Actually I don't know. The thing is that somehow the server does not 
> accept the cookie I'm reforwarding.
> When I compare the log when it's working (=server without dot AND cookie 
> policy set to RFC_2109)
> and when it's not (=server with dot and cookie policy set to 
> COMPATIBILITY), there are
> the following differences:
> 
>    non working mode:
>    2005/02/10 09:36:17:869 CET [DEBUG] header - ->> "GET
>    http://cxtst.xrce.xerox.com/my/ HTTP/1.1[\r][\n]"
>    2005/02/10 09:36:17:869 CET [DEBUG] HttpMethodBase - -Adding Host
>    request header
>    2005/02/10 09:36:17:869 CET [DEBUG] header - ->> "User-Agent:
>    Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)[\r][\n]"
>    2005/02/10 09:36:17:869 CET [DEBUG] header - ->> "Host:
>    cxtst.xrce.xerox.com[\r][\n]"
>    2005/02/10 09:36:17:870 CET [DEBUG] header - ->> "Cookie:
>    SF_THEME=000000codex[\r][\n]"
>    2005/02/10 09:36:17:870 CET [DEBUG] header - ->> "Cookie:
>    SF_FONTSIZE=0000002[\r][\n]"
>    2005/02/10 09:36:17:870 CET [DEBUG] header - ->> "Cookie:
>    session_hash=e8bef1b1619761b6cd90aeed32f448bb[\r][\n]"
>    2005/02/10 09:36:17:870 CET [DEBUG] header - ->> "Proxy-Connection:
>    Keep-Alive[\r][\n]"
>    2005/02/10 09:36:17:870 CET [DEBUG] header - ->> "[\r][\n]"
>    2005/02/10 09:36:17:969 CET [DEBUG] header - -<< "HTTP/1.0 302 Moved
>    Temporarily[\r][\n]"
> 
>    working mode:
>    2005/02/10 09:41:35:116 CET [DEBUG] header - ->> "GET
>    http://cxtst.xrce.xerox.com/my/ HTTP/1.1[\r][\n]"
>    2005/02/10 09:41:35:117 CET [DEBUG] HttpMethodBase - -Adding Host
>    request header
>    2005/02/10 09:41:35:117 CET [DEBUG] header - ->> "User-Agent:
>    Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)[\r][\n]"
>    2005/02/10 09:41:35:117 CET [DEBUG] header - ->> "Host:
>    cxtst.xrce.xerox.com[\r][\n]"
>    2005/02/10 09:41:35:118 CET [DEBUG] header - ->> "Cookie:
>    *$Version=0;* SF_THEME=000000codex; *$Path=/[\r][\n]*"
>    2005/02/10 09:41:35:118 CET [DEBUG] header - ->> "Cookie:
>    *$Version=0;* SF_FONTSIZE=0000002; *$Path=/[\r][\n]*"
>    2005/02/10 09:41:35:118 CET [DEBUG] header - ->> "Cookie:
>    *$Version=0;* session_hash=8f0bb58325e4861c4771ac94195e1039;
>    *$Path=/[\r][\n]"*
>    2005/02/10 09:41:35:118 CET [DEBUG] header - ->> "Proxy-Connection:
>    Keep-Alive[\r][\n]"
>    2005/02/10 09:41:35:118 CET [DEBUG] header - ->> "[\r][\n]"
>    2005/02/10 09:41:35:214 CET [DEBUG] header - -<< "HTTP/1.0 200
>    OK[\r][\n]"
> 
> We can see that when it's working, the cookies are different. They have 
> 2 more params: Version & Path.
> Is it due to the cookie policy which is different?
> The problem we're facing here is that to make the server recognize the 
> forwarded cookie we must use the
> RFC_2109 policy but to prevent the client from rejecting the cookie sent 
> by the server, we must use the
> COMPATIBILITY policy ...
> Should I try to add the 2 more params by hand and stick to the 
> COMPATIBILITY policy?
> I'll try that and see how it goes.
> 
> What do you think?
> 
> --mike
> 
> 
> Oleg Kalnichevski wrote:
> 
> >Michael,
> >
> >What exactly does not work? As far as I can tell all cookies get
> >accepted and are sent back. The session seems properly maintained. What
> >is exactly the problem?
> >
> >...
> ><< "Set-Cookie: SF_THEME=000000codex; expires=Thu, 09-Feb-2006 17:52:31
> >GMT; path=/[\r][\n]"
> ><< "Set-Cookie: SF_FONTSIZE=0000002; expires=Thu, 09-Feb-2006 17:52:31
> >GMT; path=/[\r][\n]
> >...
> >Cookie accepted: "SF_THEME=000000codex"
> >Cookie accepted: "SF_FONTSIZE=0000002"
> >...
> > 
> >
> >>>"Cookie: SF_THEME=000000codex[\r][\n]"
> >>>"Cookie: SF_FONTSIZE=0000002[\r][\n]"
> >>>     
> >>>
> >...
> ><< "Set-Cookie: SF_FONTSIZE=0000002; expires=Thu, 09-Feb-2006 17:52:31
> >GMT; path=/[\r][\n]"
> ><< "Set-Cookie: session_hash=d2061ff094fc1d471121292b24613d83; path=/;
> >domain=.cxtst.xrce.xerox.com[\r][\n]"
> >...
> >Cookie accepted: "SF_FONTSIZE=0000002"
> >Cookie accepted: "session_hash=d2061ff094fc1d471121292b24613d83"
> >...
> > 
> >
> >>>"Cookie: SF_THEME=000000codex[\r][\n]"
> >>>"Cookie: SF_FONTSIZE=0000002[\r][\n]"
> >>>"Cookie: session_hash=d2061ff094fc1d471121292b24613d83[\r][\n]"
> >>>     
> >>>
> >...
> ><< "Set-Cookie: SF_FONTSIZE=0000002; expires=Thu, 09-Feb-2006 17:52:32
> >GMT; path=/[\r][\n]"
> >...
> >Cookie accepted: "SF_FONTSIZE=0000002"
> >...
> > 
> >
> >>>"Cookie: SF_THEME=000000codex[\r][\n]"
> >>>"Cookie: session_hash=d2061ff094fc1d471121292b24613d83[\r][\n]"
> >>>"Cookie: SF_FONTSIZE=0000002[\r][\n]"
> >>>     
> >>>
> >
> ><< "Set-Cookie: SF_FONTSIZE=0000002; expires=Thu, 09-Feb-2006 17:52:32
> >GMT; path=/[\r][\n]"
> >...
> >Cookie accepted: "SF_FONTSIZE=0000002"
> >...
> > 
> >
> >>>"Cookie: SF_THEME=000000codex[\r][\n]"
> >>>"Cookie: session_hash=d2061ff094fc1d471121292b24613d83[\r][\n]"
> >>>"Cookie: SF_FONTSIZE=0000002[\r][\n]"
> >>>     
> >>>
> >...
> ><< "Set-Cookie: SF_FONTSIZE=0000002; expires=Thu, 09-Feb-2006 17:52:33
> >GMT; path=/[\r][\n]"
> >...
> >Cookie accepted: "SF_FONTSIZE=0000002"
> >
> >
> >
> >
> >On Wed, 2005-02-09 at 19:07 +0100, Michael Niemaz wrote:
> > 
> >
> >>wire log with full headers, if you prefer:
> >>       domainMatch? true
> >>   
> >>
> >
> ><snip>
> >
> >
> >.
> >
> > 
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message