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:
|
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
|
* [HTTPCLIENT-1457] Incorrect handling of Windows (NT) credentials by
|
||||||
SystemDefaultCredentialsProvider.
|
SystemDefaultCredentialsProvider.
|
||||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||||
|
|
|
@ -50,30 +50,56 @@ class LazyDecompressingInputStream extends InputStream {
|
||||||
this.decompressingEntity = decompressingEntity;
|
this.decompressingEntity = decompressingEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initWrapper() throws IOException {
|
||||||
|
if (wrapperStream == null) {
|
||||||
|
wrapperStream = decompressingEntity.decorate(wrappedStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
initWrapper();
|
initWrapper();
|
||||||
return wrapperStream.read();
|
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
|
@Override
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
initWrapper();
|
initWrapper();
|
||||||
return wrapperStream.available();
|
return wrapperStream.available();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initWrapper() throws IOException {
|
|
||||||
if (wrapperStream == null) {
|
|
||||||
wrapperStream = decompressingEntity.decorate(wrappedStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
try {
|
||||||
if (wrapperStream != null) {
|
if (wrapperStream != null) {
|
||||||
wrapperStream.close();
|
wrapperStream.close();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
wrappedStream.close();
|
wrappedStream.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue