hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nzaghini <nzagh...@gmail.com>
Subject Re: problem with https and cookies based session
Date Wed, 10 Oct 2007 14:57:26 GMT

>There is no difference between plain http or https as far as the cookie
>based state management is concerned. 

I am completely agree with you, but the result of my invocations seems to be
different from the normal/logic/expected behavior..

>Why does it always change?

This is the question, i can't figure out why it change all the time.
To let you better understand the situation i paste here my entire code,
because maybe the problem is so macroscopic that i can't see it being too
close..

I forgot to tell you that using the basic https support everithing works
fine, but i need to work even with self-signed servers, and this is the
solution suggested by HttpClient Jakarta site.

HttpClient client = new HttpClient();
client.getParams().setParameter(HttpMethodParams.USER_AGENT,
        " Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.7)
Gecko/20070914 Firefox/2.0.0.7");

Protocol easyhttps = new Protocol("https", new
EasySSLProtocolSocketFactory(), 443);
Protocol.registerProtocol("https", easyhttps);

GetMethod method = new GetMethod("http://nicola:8080/ssp/");
method.setDoAuthentication(true); // tryed with and without

HttpState state = new HttpState();

client.setState(state); // tryed with and without
int statusCode = client.executeMethod(client.getHostConfiguration(), method,
null); //tryed with state instead of null

Thanks!
nicola


olegk wrote:
> 
> On Mon, 2007-10-08 at 07:05 -0700, nzaghini wrote:
>> Hi,
>> i have a problem with https and cookies based sessioning system.
> 
> There is no difference between plain http or https as far as the cookie
> based state management is concerned.  
> 
>> I've just added the following line of code to my component exploiting
>> httpclient
>> 
>>     Protocol easyhttps = new Protocol("https",
>> EasySSLProtocolSocketFactory(), 443);
>>     Protocol.registerProtocol("https", easyhttps);
>> 
>> All the classes used here comes from the httpclient home site.
>> 
>> What i need, and it works fine without ssl, is to make several request
>> with
>> the same HttpState obejct to let the session go ahead..
>> 
>> So, while i try to invoke the executeMethod several times like this:
>> 
>> int statusCode = client.executeMethod(client.getHostConfiguration(),
>> method,
>> state);
>> int statusCode = client.executeMethod(client.getHostConfiguration(),
>> method,
>> state);
>> int statusCode = client.executeMethod(client.getHostConfiguration(),
>> method,
>> state);
>> 
>> the state obect (instance of HttpState class)  always chage, 
> 
> Why does it always change?
> 
> Oleg
> 
>> so i cannot go
>> ahead in the application session and all the time i'm in the same
>> situation.
>> 
>> Thanks million for your help!
>> nicola
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/problem-with-https-and-cookies-based-session-tf4588385.html#a13137646
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Mime
View raw message