fluttercommunity / fluttercommunity/flutter_downloader

Partial download dosent work

Open
#456 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
940
Forks
561
Avg merge
1h 18m
Merged PRs (30d)
1

Description

`
W/System.err( 8282): java.net.ProtocolException: unexpected end of stream
W/System.err( 8282): at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:472)
W/System.err( 8282): at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:174)
W/System.err( 8282): at java.io.InputStream.read(InputStream.java:162)
W/System.err( 8282): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.java:338)
W/System.err( 8282): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.java:195)
W/System.err( 8282): at androidx.work.Worker$1.run(Worker.java:85)
W/System.err( 8282): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err( 8282): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err( 8282): at java.lang.Thread.run(Thread.java:818)
`

**conn.setRequestProperty("Range", "bytes=" + downloadedBytes + "-"); doesnt have range end number.**

` private long setupPartialDownloadedDataHeader(HttpURLConnection conn, String filename, String savedDir) {
String saveFilePath = savedDir + File.separator + filename;
File partialFile = new File(saveFilePath);
long downloadedBytes = partialFile.length();
log("Resume download: Range: bytes=" + downloadedBytes + "-");
conn.setRequestProperty("Accept-Encoding", "identity");
conn.setRequestProperty("Range", "bytes=" + downloadedBytes + "-");
conn.setDoInput(true);
return downloadedBytes;
}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.