hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: No Cookie when running FormLoginDemo
Date Thu, 16 Mar 2006 09:16:09 GMT
On Thu, 2006-03-16 at 09:48 +0100, Roland Weber wrote:
> Hi John,
> 
> > What do you mean This bit is obviously the culprit.  Why don't the
> > cookies match.  Sorry, if I'm asked a stupid question, but I'm new to
> > this.
> 
> the Cookie Spec defines an algorithm for selecting the cookies that
> are sent along with a request. That algorithm is based, among other
> things, on the domain name and the URL path you are requesting.
> 
> > 2006/03/15 10:55:49:266 EST [DEBUG] header - ->> "Host:
> > mlvv20oa[\r][\n]"
> > 
> 
> If you use a fully qualified hostname instead of just "mlvv20oa",
> you have a better chance that the cookies will be sent back.
> Actually, four cookies are accepted in response to the post,
> as Oleg pointed out:
> 
> > The log clearly shows 4 cookies
> > [DEBUG] HttpMethodBase - -Cookie accepted: "$Version=0;
> > SmsWebSId=6668716B0B1B646D7A71720A006F1468761B0E607E6C7E7A67667668670407
> > 6C7E6064157B70; $Path=/b0be-nta2-bin/"
> > [DEBUG] HttpMethodBase - -Cookie accepted: "$Version=0;
> > SmsWebView=1504111A; $Path=/b0be-nta2-bin/"
> > [DEBUG] HttpMethodBase - -Cookie accepted: "$Version=0;
> > SmsUrlInputParms=0"
> > [DEBUG] HttpMethodBase - -Cookie accepted: "$Version=0; SmsWebSC=1;
> > $Path=/b0be-nta2-bin/"
> 
> But your code doesn't print all cookies, it only prints cookies
> that match the criteria:
> 
> > Cookie[] logoncookies = cookiespec.match(
> > LOGON_SITE, LOGON_PORT, "/", false,
> > client.getState().getCookies());
> 
> And none of the four does. Maybe you've got the wrong cookie spec,
> or there's a typo in the definition of LOGON_SITE, or some other
> minor flaw of that nature. Play around a bit.
> 

I think it is all much simpler. The path attribute is certainly wrong

Cookie[] logoncookies = cookiespec.match(
 LOGON_SITE, LOGON_PORT, "/b0be-nta2-bin/", false,
 client.getState().getCookies());

This most likely will solve the problem

Oleg


> You can also see from the log that the first GET request obtains
> a session cookie, which is not sent back with the following POST.
> Same reason.
> 
> hope that helps,
>   Roland
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
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