hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: httpclient timeout: https vs. http
Date Tue, 04 Nov 2008 09:45:39 GMT
On Fri, 2008-10-31 at 10:39 -0700, Ben Smith wrote:
> Hi Oleg,
> 
> I used your EasySSLProtocolSocketFactory and tried the following code. Timeout still
wouldn't work. Can you please help?
> 

Ben

I just double-checked. EasySSLProtocolSocketFactory handles connect
timeouts correctly. Make sure you have the latest version of the socket
factory or make sure the code you have makes use of Java 1.4 detached
socket API

Oleg


> Thanks,
> Ben
> 
> EasySSLProtocolSocketFactory factory = new EasySSLProtocolSocketFactory();
> 		HttpClient client = new HttpClient();
> 		client.getHttpConnectionManager().getParams().setConnectionTimeout(100);
> 		
> 		Protocol easyhttps = new Protocol("https", factory, 443);
> 		client.getHostConfiguration().setHost("rtdsl-uat.princetonecom.com", 443, easyhttps);
> 		GetMethod httpget = new GetMethod("/pngRTDS/scanline/xml");
> 		try {
> 			client.executeMethod(httpget);
> 			System.out.println(httpget.getStatusLine());
> 		} finally {
> 			httpget.releaseConnection();
> 		}
> 
> 
> 
> 
> 
> --- On Fri, 10/31/08, Oleg Kalnichevski <olegk@apache.org> wrote:
> 
> > From: Oleg Kalnichevski <olegk@apache.org>
> > Subject: Re: httpclient timeout: https vs. http
> > To: httpclient-users@hc.apache.org
> > Date: Friday, October 31, 2008, 8:23 AM
> > On Thu, 2008-10-30 at 15:54 -0700, Ben Smith wrote:
> > > Hi All,
> > > 
> > > I ran a code from one of your post as below by Oleg
> > with two different urls.
> > > url 1: http://www.au.yahoo.com/
> > > url 2:
> > https://rtdsl-uat.princetonecom.com/pngRTDS/scanline/xml
> > > 
> > > url 1 gave the same result as your post, while url 2
> > always succeeded and output the following even I set timeout
> > to 100 milliseconds. How can I set timeout for this https
> > url? Please help.
> > > 
> > > Thanks,
> > > Ben
> > 
> > Ben,
> > 
> > This is a known limitation of HttpClient 3.x due to Java
> > 1.2.2
> > compatibility requirement. You can solve the problem by
> > proving an
> > implementation of SecureProtocolSocketFactory that can can
> > handle
> > connect timeouts using Java 1.4 API
> > 
> > Oleg
> > 
> > > ---------------------------------------------------
> > > Code (by Oleg):
> > > 
> > > HttpClient client = new HttpClient();
> > >
> > client.getHttpConnectionManager().getParams().setConnectionTimeout(100);
> > > GetMethod httpget = new GetMethod(url);
> > > try {
> > >   client.executeMethod(httpget);
> > >   System.out.println(httpget.getStatusLine());
> > >  
> > System.out.println(httpget.getResponseBodyAsString());
> > > } finally {
> > >   httpget.releaseConnection();
> > > }
> > > 
> > > ---------------------------------------------------
> > > ......elapsed 0 seconds
> > > ......elapsed 5 seconds
> > > HTTP/1.1 200 OK
> > > 
> > > <?xml version="1.0" ?>
> > > <RESPONSE version="1.0">
> > >    ....
> > > </RESPONSE>
> > > 
> > > 
> > >       
> > > 
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail:
> > httpclient-users-help@hc.apache.org
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail:
> > httpclient-users-help@hc.apache.org
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


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


Mime
View raw message