cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: CB-5762 android: Fix lengthComputable set wrong for gzip downloads
Date Fri, 10 Jan 2014 16:46:11 GMT
Updated Branches:
  refs/heads/dev 613ee821d -> 3c1ff1606


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

Gzip + no Content-Length header should be lengthComputable=false


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/3c1ff160
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/3c1ff160
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/3c1ff160

Branch: refs/heads/dev
Commit: 3c1ff1606447c3d6dadc5a032bbe987ac570188a
Parents: 613ee82
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Jan 10 11:44:55 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Jan 10 11:45:59 2014 -0500

----------------------------------------------------------------------
 src/android/FileTransfer.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/3c1ff160/src/android/FileTransfer.java
----------------------------------------------------------------------
diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java
index f3ab9a0..5d7cbc0 100644
--- a/src/android/FileTransfer.java
+++ b/src/android/FileTransfer.java
@@ -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);
                     }


Mime
View raw message