mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-19 02:41:14 +08:00
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:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user