You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Stephen Charles Huey <st...@fastmail.fm> on 2004/08/09 03:35:42 UTC

Re: same instance of HttpClient seen as a different session withevery GET

Anytime you're accessing a URL that begins with HTTPS you're using SSL,
right?  I didn't set this up, but I'm pretty sure the URL I'm accessing
is behind SSL, and yes, I'm using the same HttpClient instance and just
creating a new GetMethod every time through my while loop.  


----- Original message -----
From: "Oleg Kalnichevski" <ol...@bluewin.ch>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Date: Sun, 08 Aug 2004 23:26:03 +0200
Subject: Re: same instance of HttpClient seen as a different session
with       every GET

I checked my log info, it struck me that every time my program accessed
> the secure (HTTPS) URL it was page-scraping, a new session appeared to
> be opened on the server instead of the server identifying my HttpClient
> as being the same browser or whatever.

Stephen,

Just to make sure that I understand you right, are you talking about SSL
session or HTTP session? If the latter is the case, does your
application use a session cookie, and if so, do you use the same
HttpState instance for consecutive HTTP GETs?

Oleg


On Sun, 2004-08-08 at 19:29, Stephen Charles Huey wrote:
> I'm trying to use a small command line program with HttpClient to browse
> our website every two minutes, and an instance of HttpClient is a member
> of my program's class OurSiteBrowser.  In the constructor, I set up the
> Credentials to access our site using BASIC authentication like so:
> 
>         Credentials defaultcreds = new UsernamePasswordCredentials(user,
>         pass);
>         hc.getState().setCredentials(null, "www.oursite.com",
>         defaultcreds);
> 
> 
> I have a while(true) loop that I use to GET a certain page on our
> website, and at the end of the loop it always waits 2 minutes.  The 
> session timeouts are set to approximately 2 hours, and I noticed while
> running this overnight that my session count was hovering around 60+ (I
> recently implemented a session listener to get more info than Tomcat was
> giving me about our traffic).  I don't really think anyone would have
> been using this particular website in the middle of the night, and when
> I checked my log info, it struck me that every time my program accessed
> the secure (HTTPS) URL it was page-scraping, a new session appeared to
> be opened on the server instead of the server identifying my HttpClient
> as being the same browser or whatever.  I'm using the httpclient-2.0.jar
> -- shouldn't our website/Tomcat be identifying my HttpClient program as
> the same browser and thus let it use the first session it creates for
> it?  
> 
> Thanks,
> Stephen
> 
> P.S.  I guess we might have some bad design somewhere as well, because
> out of the total memory allocated to the JVM, the free memory kept
> decreasing through the night.  Strange, because during the day, even
> though free memory often decreases a lot, it also climbs back up a lot.  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


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


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


Re: same instance of HttpClient seen as a different session withevery GET

Posted by Oleg Kalnichevski <ol...@bluewin.ch>.
Then I can only assume that SSL session times out, thus forcing the SSL
context to be renegotiated upon each HTTP GET request. The SSL handshake
is out of HttpClient control. You may need to configure SSL session
timeout value on the client and/or server side to work the problem
around. See HttpClient SSL guide for details on how to customize SSL
support on the client side

http://jakarta.apache.org/commons/httpclient/sslguide.html

Hope this helps somewhat

Oleg


On Mon, 2004-08-09 at 03:35, Stephen Charles Huey wrote:
> Anytime you're accessing a URL that begins with HTTPS you're using SSL,
> right?  I didn't set this up, but I'm pretty sure the URL I'm accessing
> is behind SSL, and yes, I'm using the same HttpClient instance and just
> creating a new GetMethod every time through my while loop.  
> 
> 
> ----- Original message -----
> From: "Oleg Kalnichevski" <ol...@bluewin.ch>
> To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
> Date: Sun, 08 Aug 2004 23:26:03 +0200
> Subject: Re: same instance of HttpClient seen as a different session
> with       every GET
> 
> I checked my log info, it struck me that every time my program accessed
> > the secure (HTTPS) URL it was page-scraping, a new session appeared to
> > be opened on the server instead of the server identifying my HttpClient
> > as being the same browser or whatever.
> 
> Stephen,
> 
> Just to make sure that I understand you right, are you talking about SSL
> session or HTTP session? If the latter is the case, does your
> application use a session cookie, and if so, do you use the same
> HttpState instance for consecutive HTTP GETs?
> 
> Oleg
> 
> 
> On Sun, 2004-08-08 at 19:29, Stephen Charles Huey wrote:
> > I'm trying to use a small command line program with HttpClient to browse
> > our website every two minutes, and an instance of HttpClient is a member
> > of my program's class OurSiteBrowser.  In the constructor, I set up the
> > Credentials to access our site using BASIC authentication like so:
> > 
> >         Credentials defaultcreds = new UsernamePasswordCredentials(user,
> >         pass);
> >         hc.getState().setCredentials(null, "www.oursite.com",
> >         defaultcreds);
> > 
> > 
> > I have a while(true) loop that I use to GET a certain page on our
> > website, and at the end of the loop it always waits 2 minutes.  The 
> > session timeouts are set to approximately 2 hours, and I noticed while
> > running this overnight that my session count was hovering around 60+ (I
> > recently implemented a session listener to get more info than Tomcat was
> > giving me about our traffic).  I don't really think anyone would have
> > been using this particular website in the middle of the night, and when
> > I checked my log info, it struck me that every time my program accessed
> > the secure (HTTPS) URL it was page-scraping, a new session appeared to
> > be opened on the server instead of the server identifying my HttpClient
> > as being the same browser or whatever.  I'm using the httpclient-2.0.jar
> > -- shouldn't our website/Tomcat be identifying my HttpClient program as
> > the same browser and thus let it use the first session it creates for
> > it?  
> > 
> > Thanks,
> > Stephen
> > 
> > P.S.  I guess we might have some bad design somewhere as well, because
> > out of the total memory allocated to the JVM, the free memory kept
> > decreasing through the night.  Strange, because during the day, even
> > though free memory often decreases a lot, it also climbs back up a lot.  
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


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