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 Fri, 31 Oct 2008 13:23:21 GMT
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


Mime
View raw message