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 "droidin.net" <dr...@droidin.net> on 2010/07/04 08:42:34 UTC

Cookie problem

I'm trying to mimic OAuth authentication using HttpClient 4. That requires 2
calls - first I do GET to obtain the form and then I do POST to get security
code. GET works just fine - I get the form, no error. If I input GET URL in
the browser (JS disabled) and submit - everything works, however when I do
HttpPost using the same instance of HttpClient I was using to execute GET I
get an error complaining that my cookies are disabled. Indeed if I clear
cookies in the browser after I execute GET and obtain the form I get the
same error.
I was under impression that if I use the same HttpClient for 2 different
calls (GET & POST) it will retain the cookies. Am I wrong? And if yes - what
should I do to pass cookies to the subsequent POST?

Thanks,

Bo Stone
-- 
View this message in context: http://old.nabble.com/Cookie-problem-tp29067577p29067577.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: Cookie problem

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2010-07-03 at 23:42 -0700, droidin.net wrote:
> I'm trying to mimic OAuth authentication using HttpClient 4. That requires 2
> calls - first I do GET to obtain the form and then I do POST to get security
> code. GET works just fine - I get the form, no error. If I input GET URL in
> the browser (JS disabled) and submit - everything works, however when I do
> HttpPost using the same instance of HttpClient I was using to execute GET I
> get an error complaining that my cookies are disabled. Indeed if I clear
> cookies in the browser after I execute GET and obtain the form I get the
> same error.
> I was under impression that if I use the same HttpClient for 2 different
> calls (GET & POST) it will retain the cookies. Am I wrong?

As long as the same cookie store instance is used for logically related
requests they should share the same logical session and cookies.

You can easily see what cookies are received by the client and sent back
to the origin server by turning on the wire / context logging.

Oleg 


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