For identity Accept-Encoding (#1237)

If the server returns gzip encoding, the size check will fail because getContentLength() could potentially return -1 for gzipped content.
This commit is contained in:
Dat Vong
2018-03-30 07:24:22 -07:00
committed by Artem Egorov
parent ab9d27d72b
commit d34e8d0dfb

View File

@@ -163,6 +163,7 @@ public class CodePushUpdateManager {
try {
URL downloadUrl = new URL(downloadUrlString);
connection = (HttpURLConnection) (downloadUrl.openConnection());
connection.setRequestProperty("Accept-Encoding", "identity");
bin = new BufferedInputStream(connection.getInputStream());
long totalBytes = connection.getContentLength();
@@ -365,4 +366,4 @@ public class CodePushUpdateManager {
public void clearUpdates() {
FileUtils.deleteDirectoryAtPath(getCodePushPath());
}
}
}