Return-Path: X-Original-To: apmail-hc-commits-archive@www.apache.org Delivered-To: apmail-hc-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A05D100AB for ; Tue, 18 Feb 2014 14:01:16 +0000 (UTC) Received: (qmail 75956 invoked by uid 500); 18 Feb 2014 14:01:15 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 75922 invoked by uid 500); 18 Feb 2014 14:01:15 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 75911 invoked by uid 99); 18 Feb 2014 14:01:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Feb 2014 14:01:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Feb 2014 14:01:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C8C6823888D7 for ; Tue, 18 Feb 2014 14:00:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1569328 - in /httpcomponents/httpclient/branches/4.3.x: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java Date: Tue, 18 Feb 2014 14:00:53 -0000 To: commits@hc.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140218140053.C8C6823888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: olegk Date: Tue Feb 18 14:00:53 2014 New Revision: 1569328 URL: http://svn.apache.org/r1569328 Log: HTTPCLIENT-1461: fixes performance degradation in gzip encoded content processing introduced by HTTPCLIENT-1432 Modified: httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java Modified: httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt?rev=1569328&r1=1569327&r2=1569328&view=diff ============================================================================== --- httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt (original) +++ httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt Tue Feb 18 14:00:53 2014 @@ -4,6 +4,10 @@ Changes since 4.3.2 Changelog: ------------------- +* [HTTPCLIENT-1461] fixed performance degradation in gzip encoded content processing + introduced by HTTPCLIENT-1432. + Contributed by Oleg Kalnichevski + * [HTTPCLIENT-1457] Incorrect handling of Windows (NT) credentials by SystemDefaultCredentialsProvider. Contributed by Oleg Kalnichevski Modified: httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java?rev=1569328&r1=1569327&r2=1569328&view=diff ============================================================================== --- httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java (original) +++ httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java Tue Feb 18 14:00:53 2014 @@ -50,6 +50,12 @@ class LazyDecompressingInputStream exten this.decompressingEntity = decompressingEntity; } + private void initWrapper() throws IOException { + if (wrapperStream == null) { + wrapperStream = decompressingEntity.decorate(wrappedStream); + } + } + @Override public int read() throws IOException { initWrapper(); @@ -57,23 +63,43 @@ class LazyDecompressingInputStream exten } @Override - public int available() throws IOException { + public int read(final byte[] b) throws IOException { initWrapper(); - return wrapperStream.available(); + return wrapperStream.read(b); } - private void initWrapper() throws IOException { - if (wrapperStream == null) { - wrapperStream = decompressingEntity.decorate(wrappedStream); - } + @Override + public int read(final byte[] b, final int off, final int len) throws IOException { + initWrapper(); + return wrapperStream.read(b, off, len); + } + + @Override + public long skip(final long n) throws IOException { + initWrapper(); + return wrapperStream.skip(n); + } + + @Override + public boolean markSupported() { + return false; + } + + @Override + public int available() throws IOException { + initWrapper(); + return wrapperStream.available(); } @Override public void close() throws IOException { - if (wrapperStream != null) { - wrapperStream.close(); + try { + if (wrapperStream != null) { + wrapperStream.close(); + } + } finally { + wrappedStream.close(); } - wrappedStream.close(); } }