Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 98730 invoked from network); 4 Nov 2008 09:47:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Nov 2008 09:47:31 -0000 Received: (qmail 98939 invoked by uid 500); 4 Nov 2008 09:47:36 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 98919 invoked by uid 500); 4 Nov 2008 09:47:36 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 98906 invoked by uid 99); 4 Nov 2008 09:47:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2008 01:47:36 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [217.150.250.44] (HELO ok2consulting.nine.ch) (217.150.250.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2008 09:46:17 +0000 Received: by ok2consulting.nine.ch (Postfix, from userid 1002) id 43006198551; Tue, 4 Nov 2008 10:46:55 +0100 (CET) Received: from [10.14.126.64] (unknown [213.55.131.1]) by ok2consulting.nine.ch (Postfix) with ESMTP id 1A68419854F for ; Tue, 4 Nov 2008 10:46:52 +0100 (CET) Subject: Re: httpclient timeout: https vs. http From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: <214231.99310.qm@web38805.mail.mud.yahoo.com> References: <214231.99310.qm@web38805.mail.mud.yahoo.com> Content-Type: text/plain Date: Tue, 04 Nov 2008 10:45:39 +0100 Message-Id: <1225791939.6627.3.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on ok2consulting.nine.ch X-Spam-Level: X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.3 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 wrote: > > > From: Oleg Kalnichevski > > 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 > > > > > > > > > > > > .... > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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