CB-5762 android: Fix lengthComputable set wrong for gzip downloads

Gzip + no Content-Length header should be lengthComputable=false
This commit is contained in:
Andrew Grieve
2014-01-10 11:44:55 -05:00
parent 613ee821df
commit 3c1ff16064

View File

@@ -760,8 +760,10 @@ public class FileTransfer extends CordovaPlugin {
if (connection.getContentEncoding() == null || connection.getContentEncoding().equalsIgnoreCase("gzip")) {
// Only trust content-length header if we understand
// the encoding -- identity or gzip
progress.setLengthComputable(true);
progress.setTotal(connection.getContentLength());
if (connection.getContentLength() != -1) {
progress.setLengthComputable(true);
progress.setTotal(connection.getContentLength());
}
}
inputStream = getInputStream(connection);
}