HTTPCLIENT-1078: Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity) do not close content stream in #writeTo() method
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1091140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
584bc97d49
commit
281d9d5f4d
|
@ -1,5 +1,9 @@
|
|||
Changes since 4.1.1
|
||||
|
||||
* [HTTPCLIENT-1078] Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity)
|
||||
do not close content stream in #writeTo() method.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
* [HTTPCLIENT-1075] Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity)
|
||||
do not correctly handle content streaming.
|
||||
Contributed by James Abley <james.abley at gmail.com>
|
||||
|
|
|
@ -85,15 +85,17 @@ abstract class DecompressingEntity extends HttpEntityWrapper {
|
|||
if (outstream == null) {
|
||||
throw new IllegalArgumentException("Output stream may not be null");
|
||||
}
|
||||
|
||||
InputStream instream = getContent();
|
||||
try {
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
int l;
|
||||
|
||||
int l;
|
||||
|
||||
while ((l = instream.read(buffer)) != -1) {
|
||||
outstream.write(buffer, 0, l);
|
||||
while ((l = instream.read(buffer)) != -1) {
|
||||
outstream.write(buffer, 0, l);
|
||||
}
|
||||
} finally {
|
||||
instream.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue