HTTPCLIENT-1461: fixes performance degradation in gzip encoded content processing introduced by HTTPCLIENT-1432
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1569324 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
34675f33d7
commit
08f88336a1
|
@ -4,6 +4,10 @@ Changes for 4.4-alpha1
|
|||
Changelog:
|
||||
-------------------
|
||||
|
||||
* [HTTPCLIENT-1461] fixed performance degradation in gzip encoded content processing
|
||||
introduced by HTTPCLIENT-1432.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
* [HTTPCLIENT-1457] Incorrect handling of Windows (NT) credentials by
|
||||
SystemDefaultCredentialsProvider.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
|
|
@ -50,30 +50,56 @@ class LazyDecompressingInputStream extends InputStream {
|
|||
this.decompressingEntity = decompressingEntity;
|
||||
}
|
||||
|
||||
private void initWrapper() throws IOException {
|
||||
if (wrapperStream == null) {
|
||||
wrapperStream = decompressingEntity.decorate(wrappedStream);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
initWrapper();
|
||||
return wrapperStream.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(final byte[] b) throws IOException {
|
||||
initWrapper();
|
||||
return wrapperStream.read(b);
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
private void initWrapper() throws IOException {
|
||||
if (wrapperStream == null) {
|
||||
wrapperStream = decompressingEntity.decorate(wrappedStream);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (wrapperStream != null) {
|
||||
wrapperStream.close();
|
||||
try {
|
||||
if (wrapperStream != null) {
|
||||
wrapperStream.close();
|
||||
}
|
||||
} finally {
|
||||
wrappedStream.close();
|
||||
}
|
||||
wrappedStream.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue