Skip to content

Commit dc18480

Browse files
committed
Fixed GZIP decoding for streams that are not yet read up to 2 bytes, android-async-http#830
1 parent 2f4d1d8 commit dc18480

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/src/main/java/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,8 @@ public InflatingEntity(HttpEntity wrapped) {
16081608
public InputStream getContent() throws IOException {
16091609
wrappedStream = wrappedEntity.getContent();
16101610
pushbackStream = new PushbackInputStream(wrappedStream, 2);
1611-
if (isInputStreamGZIPCompressed(pushbackStream)) {
1611+
Header enc = wrappedEntity.getContentEncoding();
1612+
if ((enc != null && "gzip".equalsIgnoreCase(enc.getValue())) || isInputStreamGZIPCompressed(pushbackStream)) {
16121613
gzippedStream = new GZIPInputStream(pushbackStream);
16131614
return gzippedStream;
16141615
} else {

0 commit comments

Comments
 (0)