Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 1005 invoked from network); 14 Feb 2011 11:00:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Feb 2011 11:00:56 -0000 Received: (qmail 71687 invoked by uid 500); 14 Feb 2011 11:00:55 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 71553 invoked by uid 500); 14 Feb 2011 11:00:53 -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 71545 invoked by uid 99); 14 Feb 2011 11:00:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Feb 2011 11:00:53 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.30.41.199] (HELO mail1.iggroup.com) (193.30.41.199) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Feb 2011 11:00:46 +0000 Received: from brprdpfp001.iggroup.local (HELO BMPRDEXC203.igi.ig.local) ([172.24.2.21]) by brprdirn001-int.igi.ig.local with ESMTP; 14 Feb 2011 11:00:25 +0000 Received: from PRDEXC102.igi.ig.local ([fe80::51bc:f36a:9643:76d3]) by BMPRDEXC203.igi.ig.local ([fe80::903f:383:5507:d6b6%15]) with mapi; Mon, 14 Feb 2011 11:00:25 +0000 From: Mahesh Mattepu To: 'HttpClient User Discussion' Date: Mon, 14 Feb 2011 11:00:24 +0000 Subject: SocketException in HttpClient GET Thread-Topic: SocketException in HttpClient GET Thread-Index: AcvJHxpKtFZfcId3QBqGP44P0s2/EgC9tjeAAAgGO2AAABINEA== Message-ID: <8B0157917A711145812458934B12F1200C0C436521@PRDEXC102.igi.ig.local> References: <8B0157917A711145812458934B12F1200C0C43651A@PRDEXC102.igi.ig.local> <8B0157917A711145812458934B12F1200C0C436520@PRDEXC102.igi.ig.local> In-Reply-To: <8B0157917A711145812458934B12F1200C0C436520@PRDEXC102.igi.ig.local> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Processed Hi, We are trying to solve a very simple problem for *HttpClient4* -- SocketExc= eption for HTTP GET. HttpClient4 gets the first "chunk" of data from server= (Tomcat-6.0.18) and then the server unexpectedly closes the connection. We tried the following HttpClient4 versions to fix this but it did not work= ! - 4.1-beta1 - 4.1-alpha2 - 4.1-alpha1 - 4.0.3 - 4.0.2 - 4.0.1 The same piece of code works with HttpClient3. Do you know if HTTP GET has any known bugs for HttpClient4? We could not fi= nd any on the internet. The debug logs report the following: Sending request: GET /layouts/xxxxx?websiteId=3Dxxx&userId=3Dxxxxx HTTP/1.1= org.apache.http.wire - >> "GET /layouts/xxxxx?websiteId=3Dxxx&userId=3Dxxx= xx HTTP/1.1[EOL]" org.apache.http.wire - >> "Accept: application/json[EOL]" org.apache.http.wire - >> "Host: xxx-xxxx.xxxxxxx.xxxxx[EOL]" [note] org.apache.http.wire - >> "Connection: Keep-Alive[EOL]" org.apache.http.wire - >> "[EOL]" org.apache.http.headers - >> GET /layouts/xxxxx?websiteId=3Dxxx&userId=3Dxx= xxx HTTP/1.1 org.apache.http.headers - >> Accept: application/json org.apac= he.http.headers - >> Host: xxx-xxxx.xxxxxxx.xxxxx [note] org.apache.http.he= aders - >> Connection: Keep-Alive org.apache.http.wire - << "HTTP/1.1 200 O= K[EOL]" org.apache.http.wire - << "Date: Wed, 09 Feb 2011 09:53:15 GMT[EOL]" org.apache.http.wire - << "Server: Apache-Coyote/1.1[EOL]" org.apache.http.wire - << "Cache-Control: public, max-age=3D31536000000[EOL= ]" org.apache.http.wire - << "Expires: Thu, 09 Feb 2012 09:53:15 GMT[EOL]" org.apache.http.wire - << "Content-Type: application/json;charset=3Dutf-8[E= OL]" org.apache.http.wire - << "Content-Language: en-GB[EOL]" org.apache.http.wire - << "Content-Length: 7506[EOL]" [note] org.apache.http.wire - << "Connection: close[EOL]" org.apache.http.wire - << "[EOL]" org.apache.http.impl.conn.DefaultClientConnection - Receiving response: HTT= P/1.1 200 OK org.apache.http.headers - << HTTP/1.1 200 OK org.apache.http.h= eaders - << Date: Wed, 09 Feb 2011 09:53:15 GMT org.apache.http.headers - <= < Server: Apache-Coyote/1.1 org.apache.http.headers - << Cache-Control: pub= lic, max-age=3D31536000000 org.apache.http.headers - << Expires: Thu, 09 Fe= b 2012 09:53:15 GMT org.apache.http.headers - << Content-Type: application/= json;charset=3Dutf-8 org.apache.http.headers - << Content-Language: en-GB o= rg.apache.http.headers - << Content-Length: 7506 [note] org.apache.http.hea= ders - << Connection: close uk.co.igindex.springrest.client.RequestProxyImp= l - Http call return status code=3D200 [note] org.apache.http.impl.conn.Def= aultClientConnection - Connection shut down org.apache.http.impl.conn.tsccm= .ThreadSafeClientConnManager - Released connection is not reusable. org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Releasing connection [Htt= pRoute[{}->http://xxx-xxx.xxx.xxxxx]][null] StopsServer:2011-02-09 09:53:15,616 [main] DEBUG org.apache.http.impl.conn.= tsccm.ConnPoolByRoute - Notifying no-one, there are no waiting threads Content-length: 7506 org.apache.http.wire - << "{" org.apache.http.wire - << """ org.apache.http.wire - << "i" ... [logs removed for partial response content] --- We are reading the response in the standard way: StringBuilder sb =3D new StringBuilder(); try { BufferedReader br =3D new BufferedReader(new InputStreamReader(inputStre= am)); char[] buf =3D new char[4 * 1024]; // 4Kchar buffer int len; while ((len =3D br.read(buf, 0, buf.length)) !=3D -1) { sb.append(buf, 0, len); } br.close(); } finally { ... } --- Thanks & Regards Mahesh The information contained in this email is strictly confidential and for th= e use of the addressee only, unless otherwise indicated. If you are not the= intended recipient, please do not read, copy, use or disclose to others th= is message or any attachment. Please also notify the sender by replying to = this email or by telephone (+44 (0)20 7896 0011) and then delete the email = and any copies of it. Opinions, conclusions (etc.) that do not relate to th= e official business of this company shall be understood as neither given no= r endorsed by it. IG Index Ltd is a company registered in England and Wales= under number 01190902. VAT registration number 761 2978 07. Registered Off= ice: Cannon Bridge House, 25 Dowgate Hill, London EC4R 2YA. Authorised and = regulated by the Financial Services Authority. FSA Register number 114059. --------------------------------------------------------------------- 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