Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 77A129226 for ; Wed, 25 Apr 2012 12:53:15 +0000 (UTC) Received: (qmail 58543 invoked by uid 500); 25 Apr 2012 12:53:15 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 58265 invoked by uid 500); 25 Apr 2012 12:53:15 -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 58076 invoked by uid 99); 25 Apr 2012 12:53:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 12:53:13 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [62.225.183.131] (HELO tcmail83.telekom.de) (62.225.183.131) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 12:53:06 +0000 Received: from he113495.emea1.cds.t-internal.com ([10.206.92.152]) by tcmail81.telekom.de with ESMTP/TLS/AES128-SHA; 25 Apr 2012 14:52:45 +0200 Received: from HE111490.emea1.cds.t-internal.com ([169.254.2.41]) by HE113495.emea1.cds.t-internal.com ([::1]) with mapi; Wed, 25 Apr 2012 14:52:45 +0200 From: To: Date: Wed, 25 Apr 2012 14:52:43 +0200 Subject: Consuming compressed content throws exception Thread-Topic: Consuming compressed content throws exception Thread-Index: Ac0i4k5qm+rZtpKxTnmQLfPlKxbk2A== Message-ID: <3B8CC2E826F6B844B471DC3DF590CB45ED2AE7C376@HE111490.emea1.cds.t-internal.com> Accept-Language: en-US, de-DE Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, de-DE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Hi all, when trying to consume deflate content coded responses I get "java.util.zip= .ZipException: invalid stored block lengths" exception. server mock looks like: header is byte array=20 Deflater def =3D new Deflater(Deflater.BEST_COMPRESSION); def.setInput(content); def.finish(); contentLength =3D def.deflate(compressedContent); // concat header and content System.arraycopy(header, 0, response, 0, header.length); System.arraycopy(compressedContent, 0, response, header.length, contentLeng= th); // sending response to socket OutputStream outputStream =3D null; BufferedOutputStream bos =3D null; outputStream =3D socket.getOutputStream(); bos =3D new BufferedOutputStream(outputStream); bos.write(Utils.buildHttpResponseWithCompressedBody(messagedata.response)); bos.flush(); bos.close(); outputStream.close(); ... socket.close(); client side looks like: ... response =3D client.execute(method); entity =3D response.getEntity(); ... DeflateDecompressingEntity dde =3D new DeflateDecompressingEntity(entity); ... bais =3D (ByteArrayInputStream) entity.getContent(); --> java.util.zip.ZipException: invalid stored block lengths at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:= 147) at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStr= eam.java:138) at java.io.FilterInputStream.read(FilterInputStream.java:116) at java.io.PushbackInputStream.read(PushbackInputStream.java:169) at java.io.FilterInputStream.read(FilterInputStream.java:90) at org.apache.http.client.entity.DeflateDecompressingEntity.getDeco= mpressingInputStream(DeflateDecompressingEntity.java:104) at org.apache.http.client.entity.DecompressingEntity.getContent(Dec= ompressingEntity.java:72) ... What could cause this exception? If I use gzipped content (with appropriate classes) I get a "No GZIP format= " exception. When I decompress content directly after compression I get the= right content. I guess there must be a general problem with my setup. Kind regards, Michael= --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org