Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

下载文件时progress的totalBytes总是-1 #1050

Closed
2862339302 opened this issue Jun 7, 2018 · 7 comments
Closed

下载文件时progress的totalBytes总是-1 #1050

2862339302 opened this issue Jun 7, 2018 · 7 comments
Assignees
Milestone

Comments

@2862339302
Copy link

2862339302 commented Jun 7, 2018

下载文件地址是:https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145366.zip
下载在主进程里。版本是1.7.4。看log里请求是有返回文件大小的,不知道为什么回调时totalBytes变成-1,麻烦看看有没有解决方法,谢谢。

补充:使用火狐浏览器,或HttpURLConnection 是可以正确拿到这个文件大小的。
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
long size = connection.getContentLength();

以下是FileDownloader的log:
V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145366.zip], Path[/storage/emulated/0/download/t100_145366.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@594bd57], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[948619801] has been into the launch pool.
V/FileDownloader.FileDownloadEventPool: setListener event.service.connect.changed
D/FileDownloader.FileDownloadMessenger: notify begin 948619801@com.liulishuo.filedownloader.DownloadTask@6d2152d
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@7b4ea62 by 11
V/FileDownloader.FileDownloadList: add list in all 948619801@com.liulishuo.filedownloader.DownloadTask@6d2152d 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145366.zip) path(/storage/emulated/0/download/t100_145366.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue 948619801 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.DownloadMgrInitialParams: initial FileDownloader manager with the customize connection creator: cn.dreamtobe.filedownloader.OkHttp3Connection$Creator@7e7d729
D/FileDownloader.MessageSnapshotGate: ~~~callback 948619801 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending 948619801@com.liulishuo.filedownloader.DownloadTask@6d2152d
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- 948619801 request header {range=[bytes=0-0], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.MessageSnapshotGate: ~~~callback 948619801 old[1] new[6] 1
D/FileDownloader.FileDownloadMessenger: notify started 948619801@com.liulishuo.filedownloader.DownloadTask@6d2152d
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: ----> 948619801 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], cache-control=[no-cache], connection=[keep-alive], content-length=[0], content-md5=[a3wcSB5xp3pUrwzvHno14w==], content-range=[bytes /2312060], content-type=[application/zip], date=[Thu, 07 Jun 2018 06:29:48 GMT], eagleid=[3c1ce20515283529885596204e], etag=["6B7C1C481E71A77A54AF0CEF1E7A35E3"], last-modified=[Tue, 13 Mar 2018 07:06:19 GMT], server=[Tengine], timing-allow-origin=[], via=[cache8.l2nu17-1[61,416-0,M], cache36.l2nu17-1[62,0], kunlun6.cn36[66,416-1280,M], kunlun5.cn36[68,0]], x-cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[17755995990363745947], x-oss-object-type=[Normal], x-oss-request-id=[5B18D0DC6B3F22911F7845D4], x-oss-server-time=[61], x-oss-storage-class=[Standard], x-swift-cachetime=[0], x-swift-error=[orig response 4XX error], x-swift-savetime=[Thu, 07 Jun 2018 06:29:48 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "6B7C1C481E71A77A54AF0CEF1E7A35E3" for task(948619801)
D/FileDownloader.ConnectTask: <---- 948619801 request header {if-match=["6B7C1C481E71A77A54AF0CEF1E7A35E3"], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> 948619801 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[
], access-control-max-age=[0], connection=[keep-alive], content-length=[2312060], content-md5=[a3wcSB5xp3pUrwzvHno14w==], content-type=[application/zip], date=[Thu, 07 Jun 2018 06:29:48 GMT], eagleid=[3c1ce20515283529886486607e], etag=["6B7C1C481E71A77A54AF0CEF1E7A35E3"], last-modified=[Tue, 13 Mar 2018 07:06:19 GMT], server=[Tengine], timing-allow-origin=[], via=[cache8.l2nu17-1[11,200-0,M], cache36.l2nu17-1[12,0], kunlun6.cn36[15,200-0,M], kunlun5.cn36[17,0]], x-cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[17755995990363745947], x-oss-object-type=[Normal], x-oss-request-id=[5B18D0DCA56E418A1E6B9DBB], x-oss-server-time=[5], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Thu, 07 Jun 2018 06:29:48 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "6B7C1C481E71A77A54AF0CEF1E7A35E3" for task(948619801)
W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header
D/FileDownloader.MessageSnapshotGate: ~~~callback 948619801 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected 948619801@com.liulishuo.filedownloader.DownloadTask@6d2152d
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- 948619801 request header {if-match=["6B7C1C481E71A77A54AF0CEF1E7A35E3"], range=[bytes=0-], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> 948619801 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[
], access-control-max-age=[0], age=[1], connection=[keep-alive], content-length=[2312060], content-md5=[a3wcSB5xp3pUrwzvHno14w==], content-range=[bytes 0-2312059/2312060], content-type=[application/zip], date=[Thu, 07 Jun 2018 06:29:48 GMT], eagleid=[3c1ce20715283529893235346e], etag=["6B7C1C481E71A77A54AF0CEF1E7A35E3"], last-modified=[Tue, 13 Mar 2018 07:06:19 GMT], server=[Tengine], timing-allow-origin=[*], via=[cache8.l2nu17-1[11,200-0,M], cache36.l2nu17-1[12,0], kunlun6.cn36[0,206-0,H], kunlun7.cn36[0,0]], x-cache=[HIT TCP_MEM_HIT dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[17755995990363745947], x-oss-object-type=[Normal], x-oss-request-id=[5B18D0DCA56E418A1E6B9DBB], x-oss-server-time=[5], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Thu, 07 Jun 2018 06:29:48 GMT]}
D/FileDownloader.DownloadRunnable: the connection[-1] for 948619801, is connected range[0, -1) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(-1): range [0, -1), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback 948619801 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress 948619801@com.liulishuo.filedownloader.DownloadTask@6d2152d 4096 -1

@rantianhua rantianhua self-assigned this Jun 8, 2018
@rantianhua
Copy link
Collaborator

你应该是使用 OkHttp 这个网络库,该网络库是支持 SPDY 协议的,所以你日志里面的 request header 和 response header 都是小写。不过 OkHttp 里面获取 header 的方式是不关心大小写的:

 private static String get(String[] namesAndValues, String name) {
    for (int i = namesAndValues.length - 2; i >= 0; i -= 2) {
      if (name.equalsIgnoreCase(namesAndValues[i])) {
        return namesAndValues[i + 1];
      }
    }
    return null;
  }

我自己测试也确实是正常的。所以需要确认一下你是如何引入 OkHttp 的?是自定义的 FileDownloadConnection 还是引用的 filedownloader-okhttp3-connection 这个 library?如果你是自定义的 FileDownloadConnection ,那么你的 getResponseHeaderField(String) 方法是怎么实现的?

@2862339302
Copy link
Author

引用的库:
implementation 'com.squareup.okhttp3:okhttp:3.10.0'   
implementation 'com.liulishuo.filedownloader:library:1.7.4'
implementation 'cn.dreamtobe.filedownloader:filedownloader-okhttp3-connection:1.1.0'

@2862339302
Copy link
Author

经过多次试验,发现totalBytes并不总是-1,下面是同一个下载地址的log。
https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip。有时候正常,有时候是-1 。好像同时下载多个文件(不同的文件)的时候,容易出现-1,并不是特定的下载地址才有这种现象。而且跟用不用okhttp关系不大,用默认的设置也会出现。

totalBytes为正常的log:

V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@6570bd5], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin -1783616310@com.liulishuo.filedownloader.DownloadTask@17812db
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@640f178 by 11
V/FileDownloader.FileDownloadList: add list in all -1783616310@com.liulishuo.filedownloader.DownloadTask@17812db 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip) path(/storage/emulated/0/download/t100_145376.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[11] new[1] 1
D/FileDownloader.ConnectTask: <---- -1783616310 request header {range=[bytes=0-0], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.FileDownloadMessenger: notify pending -1783616310@com.liulishuo.filedownloader.DownloadTask@17812db
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[1] new[6] 1
D/FileDownloader.FileDownloadMessenger: notify started -1783616310@com.liulishuo.filedownloader.DownloadTask@17812db
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], age=[78], connection=[keep-alive], content-length=[1], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes 0-0/2327711], content-type=[application/zip], date=[Mon, 11 Jun 2018 05:49:01 GMT], eagleid=[ca61e70a15286962199364337e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,200-0,H], cache9.l2nu17-1[1,0], kunlun6.cn386[0,206-0,H], kunlun10.cn386[1,0]], x-cache=[HIT TCP_MEM_HIT dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[6] new[2] 1
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.FileDownloadMessenger: notify connected -1783616310@com.liulishuo.filedownloader.DownloadTask@17812db
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- -1783616310 request header {if-match=["EA287B90718A3851F09221549CFD6058"], range=[bytes=0-], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], age=[80], connection=[keep-alive], content-length=[2327711], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes 0-2327710/2327711], content-type=[application/zip], date=[Mon, 11 Jun 2018 05:49:01 GMT], eagleid=[ca61e70615286962212286328e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,200-0,H], cache9.l2nu17-1[1,0], kunlun6.cn386[0,206-0,H], kunlun6.cn386[0,0]], x-cache=[HIT TCP_MEM_HIT dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.DownloadRunnable: the connection[-1] for -1783616310, is connected range[0, -1) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(-1): range [0, -1), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@17812db 4096 2327711

totalBytes为-1的log:

V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@6865e35], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin -1783616310@com.liulishuo.filedownloader.DownloadTask@9e872ca
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@d2e9c3b by 11
V/FileDownloader.FileDownloadList: add list in all -1783616310@com.liulishuo.filedownloader.DownloadTask@9e872ca 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip) path(/storage/emulated/0/download/t100_145376.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending -1783616310@com.liulishuo.filedownloader.DownloadTask@9e872ca
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[1] new[6] 1
D/FileDownloader.FileDownloadMessenger: notify started -1783616310@com.liulishuo.filedownloader.DownloadTask@9e872ca
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- -1783616310 request header {range=[bytes=0-0], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], age=[0], cache-control=[no-cache], connection=[keep-alive], content-length=[0], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes /2327711], content-type=[application/zip], date=[Mon, 11 Jun 2018 05:49:01 GMT], eagleid=[ca61e70915286961416886971e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,416-0,H], cache35.l2nu17-1[1,0], kunlun6.cn386[92,416-1280,M], kunlun9.cn386[94,0]], x-cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[0], x-swift-error=[orig response 4XX error], x-swift-savetime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
D/FileDownloader.ConnectTask: <---- -1783616310 request header {if-match=["EA287B90718A3851F09221549CFD6058"], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[
], access-control-max-age=[0], age=[0], connection=[keep-alive], content-length=[2327711], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-type=[application/zip], date=[Mon, 11 Jun 2018 05:49:01 GMT], eagleid=[ca61e70915286961418287385e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,200-0,H], cache9.l2nu17-1[1,0], kunlun6.cn386[119,200-0,M], kunlun9.cn386[120,0]], x-cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected -1783616310@com.liulishuo.filedownloader.DownloadTask@9e872ca
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- -1783616310 request header {if-match=["EA287B90718A3851F09221549CFD6058"], range=[bytes=0-], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[
], access-control-max-age=[0], age=[5], connection=[keep-alive], content-length=[2327711], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes 0-2327710/2327711], content-type=[application/zip], date=[Mon, 11 Jun 2018 05:49:01 GMT], eagleid=[ca61e70a15286961469601251e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[*], via=[cache28.l2nu17-1[0,200-0,H], cache9.l2nu17-1[1,0], kunlun6.cn386[0,206-0,H], kunlun10.cn386[1,0]], x-cache=[HIT TCP_MEM_HIT dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.DownloadRunnable: the connection[-1] for -1783616310, is connected range[0, -1) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(-1): range [0, -1), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@9e872ca 4096 -1

@2862339302
Copy link
Author

2862339302 commented Jun 11, 2018

使用默认下载设置复现了这个问题,这次没有同时下载多个,直接下载的https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip。(还是上面那个下载地址)

log如下:

V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@30146e1], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
V/FileDownloader.FileDownloadEventPool: setListener event.service.connect.changed
I/FileDownloader.FileDownloadProperties: init properties 0
load properties: http.lenient=FALSE; process.non-separate=TRUE; download.min-progress-step=65536; download.min-progress-time=2000; download.max-network-thread-count=10; file.non-pre-allocation=FALSE; broadcast.completed=FALSE; download.trial-connection-head-method=FALSE
D/FileDownloader.LostServiceConnectedHandler: Waiting for connecting with the downloader service... -1783616310
D/FileDownloader.DownloadTaskHunter: free the task -1783616310, when the status is 10
D/FileDownloader.FileDownloadDatabase: refreshed data count: 0 , delete data count: 0, reset id count: 0. consume 2
V/FileDownloader.FileDownloadEventPool: asyncPublishInNewThread event.service.connect.changed
V/FileDownloader.FileDownloadEventPool: publish event.service.connect.changed
D/FileDownloader.LostServiceConnectedHandler: The downloader service is connected.
V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@30146e1], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@4c75de by 11
V/FileDownloader.FileDownloadList: add list in all -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip) path(/storage/emulated/0/download/t100_145376.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[1] new[6] 1
D/FileDownloader.FileDownloadMessenger: notify started -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- -1783616310 request header {Range=[bytes=0-0], User-Agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {null=[HTTP/1.1 416 Requested Range Not Satisfiable], Accept-Ranges=[bytes], Access-Control-Allow-Methods=[POST,GET,HEDA], Access-Control-Allow-Origin=[], Access-Control-Max-Age=[0], Age=[2295], Cache-Control=[no-cache], Connection=[keep-alive], Content-Length=[0], Content-MD5=[6ih7kHGKOFHwkiFUnP1gWA==], Content-Range=[bytes /2327711], Content-Type=[application/zip], Date=[Mon, 11 Jun 2018 05:49:01 GMT], EagleId=[3b6c8aca15286984366371428e], ETag=["EA287B90718A3851F09221549CFD6058"], Last-Modified=[Tue, 13 Mar 2018 09:48:58 GMT], Server=[Tengine], Timing-Allow-Origin=[], Via=[cache28.l2nu17-1[0,416-0,H], cache41.l2nu17-1[1,0], cache10.cn370[16,416-1280,M], cache2.cn370[17,0]], X-Android-Received-Millis=[1528698436634], X-Android-Response-Source=[NETWORK 416], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1528698436607], X-Cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], X-Swift-CacheTime=[0], X-Swift-Error=[orig response 4XX error], X-Swift-SaveTime=[Mon, 11 Jun 2018 06:27:16 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
D/FileDownloader.ConnectTask: <---- -1783616310 request header {If-Match=["EA287B90718A3851F09221549CFD6058"], User-Agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {null=[HTTP/1.1 200 OK], Accept-Ranges=[bytes], Access-Control-Allow-Methods=[POST,GET,HEDA], Access-Control-Allow-Origin=[
], Access-Control-Max-Age=[0], Age=[0], Connection=[keep-alive], Content-Length=[2327711], Content-MD5=[6ih7kHGKOFHwkiFUnP1gWA==], Content-Type=[application/zip], Date=[Mon, 11 Jun 2018 06:27:17 GMT], EagleId=[3b6c8aca15286984366811498e], ETag=["EA287B90718A3851F09221549CFD6058"], Last-Modified=[Tue, 13 Mar 2018 09:48:58 GMT], Server=[Tengine], Timing-Allow-Origin=[], Via=[cache10.l2et2-2[186,200-0,H], cache44.l2et2-2[1024,0], cache10.cn370[1049,200-0,M], cache2.cn370[1050,0]], X-Android-Received-Millis=[1528698438523], X-Android-Response-Source=[NETWORK 200], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1528698436650], X-Cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E1645875D829B5566ACD0], x-oss-server-time=[10], x-oss-storage-class=[Standard], X-Swift-CacheTime=[3600], X-Swift-SaveTime=[Mon, 11 Jun 2018 06:27:17 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.RemitDatabase: sync cache to db -1783616310
D/FileDownloader.ConnectTask: <---- -1783616310 request header {If-Match=["EA287B90718A3851F09221549CFD6058"], Range=[bytes=0-], User-Agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {null=[HTTP/1.1 206 Partial Content], Accept-Ranges=[bytes], Access-Control-Allow-Methods=[POST,GET,HEDA], Access-Control-Allow-Origin=[
], Access-Control-Max-Age=[0], Age=[1], Connection=[keep-alive], Content-Length=[2327711], Content-MD5=[6ih7kHGKOFHwkiFUnP1gWA==], Content-Range=[bytes 0-2327710/2327711], Content-Type=[application/zip], Date=[Mon, 11 Jun 2018 06:27:17 GMT], EagleId=[3b6c8aca15286984387025357e], ETag=["EA287B90718A3851F09221549CFD6058"], Last-Modified=[Tue, 13 Mar 2018 09:48:58 GMT], Server=[Tengine], Timing-Allow-Origin=[*], Via=[cache10.l2et2-2[186,200-0,H], cache44.l2et2-2[1024,0], cache10.cn370[0,206-0,H], cache2.cn370[1,0]], X-Android-Received-Millis=[1528698438992], X-Android-Response-Source=[NETWORK 206], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1528698438672], X-Cache=[HIT TCP_MEM_HIT dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E1645875D829B5566ACD0], x-oss-server-time=[10], x-oss-storage-class=[Standard], X-Swift-CacheTime=[3600], X-Swift-SaveTime=[Mon, 11 Jun 2018 06:27:17 GMT]}
D/FileDownloader.DownloadRunnable: the connection[-1] for -1783616310, is connected range[0, -1) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(-1): range [0, -1), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119 4096 -1
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@c42f119 20451 -1

再补充个正常log:
V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@f09aae6], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@4a8e47d by 11
V/FileDownloader.FileDownloadList: add list in all -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip) path(/storage/emulated/0/download/t100_145376.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[1] new[6] 1
D/FileDownloader.ConnectTask: <---- -1783616310 request header {Range=[bytes=0-0], User-Agent=[FileDownloader/1.7.4]}
D/FileDownloader.FileDownloadMessenger: notify started -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: ----> -1783616310 response header {null=[HTTP/1.1 206 Partial Content], Accept-Ranges=[bytes], Access-Control-Allow-Methods=[POST,GET,HEDA], Access-Control-Allow-Origin=[], Access-Control-Max-Age=[0], Age=[3042], Connection=[keep-alive], Content-Length=[1], Content-MD5=[6ih7kHGKOFHwkiFUnP1gWA==], Content-Range=[bytes 0-0/2327711], Content-Type=[application/zip], Date=[Mon, 11 Jun 2018 05:49:01 GMT], EagleId=[ca61e70715286991832721651e], ETag=["EA287B90718A3851F09221549CFD6058"], Last-Modified=[Tue, 13 Mar 2018 09:48:58 GMT], Server=[Tengine], Timing-Allow-Origin=[], Via=[cache28.l2nu17-1[0,200-0,H], cache9.l2nu17-1[1,0], kunlun6.cn386[0,206-0,H], kunlun7.cn386[1,0]], X-Android-Received-Millis=[1528699183256], X-Android-Response-Source=[NETWORK 206], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1528699183228], X-Cache=[HIT TCP_MEM_HIT dirn:9:796361604 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], X-Swift-CacheTime=[3600], X-Swift-SaveTime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.DownloadLaunchRunnable: fetch data with multiple connection(count: [2]) for task[-1783616310] totalLength[2327711]
D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[-1783616310] index[0] range[0, 1163854) current offset(0)
D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[-1783616310] index[1] range[1163855, -1) current offset(1163855)
D/FileDownloader.ConnectTask: <---- -1783616310 request header {Range=[bytes=1163855-], User-Agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: <---- -1783616310 request header {Range=[bytes=0-1163854], User-Agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {null=[HTTP/1.1 206 Partial Content], Accept-Ranges=[bytes], Access-Control-Allow-Methods=[POST,GET,HEDA], Access-Control-Allow-Origin=[], Access-Control-Max-Age=[0], Age=[3042], Connection=[keep-alive], Content-Length=[1163855], Content-MD5=[6ih7kHGKOFHwkiFUnP1gWA==], Content-Range=[bytes 0-1163854/2327711], Content-Type=[application/zip], Date=[Mon, 11 Jun 2018 05:49:01 GMT], EagleId=[ca61e70815286991833385517e], ETag=["EA287B90718A3851F09221549CFD6058"], Last-Modified=[Tue, 13 Mar 2018 09:48:58 GMT], Server=[Tengine], Timing-Allow-Origin=[], Via=[cache28.l2nu17-1[0,200-0,H], cache9.l2nu17-1[1,0], kunlun6.cn386[0,206-0,H], kunlun8.cn386[1,0]], X-Android-Received-Millis=[1528699183607], X-Android-Response-Source=[NETWORK 206], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1528699183293], X-Cache=[HIT TCP_MEM_HIT dirn:9:796361604 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B1E0D4D8ED50900374185A3], x-oss-server-time=[6], x-oss-storage-class=[Standard], X-Swift-CacheTime=[3600], X-Swift-SaveTime=[Mon, 11 Jun 2018 05:49:01 GMT]}
D/FileDownloader.DownloadRunnable: the connection[0] for -1783616310, is connected range[0, 1163854) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(0): range [0, 1163854), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4 32710 2327711
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@12d8ad4 69516 2327711
D/FileDownloader.MessageSnapshotGate: updateKeepFlow

@rantianhua
Copy link
Collaborator

rantianhua commented Jun 11, 2018

问题知道了,从你最后给的异常的日志可以看到,第一次请求的时候,request header 为:

Range=[bytes=0-0], User-Agent=[FileDownloader/1.7.4]

对应的 response header 为:

null=[HTTP/1.1 416 Requested Range Not Satisfiable]

但是同样的请求,在你提供的正常的日志里面, response header 为:

null=[HTTP/1.1 206 Partial Content

第一次的请求就是为了获取文件长度,并不下载实际内容,所以 GET 请求里面,Range 为 0-0 ,这是一个正常的请求,而服务器却返回了 416 ,这种情况下,会直接重试第一次请求且去掉了 Range ,然而此时服务器又没有在 response 里面返回 Content-Range 字段,导致没有获取到文件长度。总的来说,这是服务器没有严格按照协议实现的结果,并不是 FileDownloader 的问题。


当然,你也可以尝试通过 FileDownloader 绕过这个问题。有两种方式:

  1. filedownloader.properties 里面配置 download.trial-connection-head-method=true ,此时第一次的请求将会用 HEAD 方法。
  2. 在 1.7.5 里面,为处理 第一次无法获取到的文件大小是-1,导致进度条不显示,点击暂停后,再次开始下载就好了,如何解决 #1027 ,对 416 做了特殊处理,当然这本质也是因为服务器的问题,FileDownloader 只是做了下兼容而已。1.7.5 并没有 release ,你现在可以使用它的 snapshot 版本,具体在 README 里面有介绍。

你可以尝试上面两种方式,且希望你能提供这两种方式的反馈。

@2862339302
Copy link
Author

反馈两种方式的多次测试结果:
1.在 1.7.4 的 filedownloader.properties 里面配置 download.trial-connection-head-method=true
结果失败,log如下。
V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@cfdb576], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@2461c4d by 11
V/FileDownloader.FileDownloadList: add list in all -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip) path(/storage/emulated/0/download/t100_145376.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[1] new[6] 1
D/FileDownloader.ConnectTask: <---- -1783616310 request header {range=[bytes=0-0], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.FileDownloadMessenger: notify started -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], age=[0], cache-control=[no-cache], content-length=[0], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes /2327711], content-type=[application/zip], date=[Thu, 14 Jun 2018 08:35:01 GMT], eagleid=[3b6c8ad015289653019016626e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,416-0,H], cache12.l2nu17-1[0,0], cache10.cn370[73,416-1280,M], cache8.cn370[74,0]], x-cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B2228B5EE045E31743BF484], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[0], x-swift-error=[orig response 4XX error], x-swift-savetime=[Thu, 14 Jun 2018 08:35:01 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
D/FileDownloader.ConnectTask: <---- -1783616310 request header {if-match=["EA287B90718A3851F09221549CFD6058"], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[
], access-control-max-age=[0], age=[1], content-length=[2327711], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-type=[application/zip], date=[Thu, 14 Jun 2018 08:35:01 GMT], eagleid=[3b6c8ad015289653020066785e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,200-0,H], cache45.l2nu17-1[1,0], cache10.cn370[14,200-0,M], cache8.cn370[15,0]], x-cache=[MISS TCP_MISS dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B2228B5EE045E31743BF484], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Thu, 14 Jun 2018 08:35:02 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- -1783616310 request header {if-match=["EA287B90718A3851F09221549CFD6058"], range=[bytes=0-], user-agent=[FileDownloader/1.7.4]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[
], access-control-max-age=[0], age=[1], content-length=[2327711], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes 0-2327710/2327711], content-type=[application/zip], date=[Thu, 14 Jun 2018 08:35:01 GMT], eagleid=[3b6c8ad015289653020506859e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[*], via=[cache28.l2nu17-1[0,200-0,H], cache45.l2nu17-1[1,0], cache10.cn370[0,206-0,H], cache8.cn370[1,0]], x-cache=[HIT TCP_MEM_HIT dirn:-2:-2 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B2228B5EE045E31743BF484], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Thu, 14 Jun 2018 08:35:02 GMT]}
D/FileDownloader.DownloadRunnable: the connection[-1] for -1783616310, is connected range[0, -1) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(-1): range [0, -1), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4 4096 -1
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@7c07fe4 52428 -1

2.使用1.7.5-SNAPSHOT,结果成功,附上log。
V/FileDownloader.DownloadTaskHunter: call start Url[https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip], Path[/storage/emulated/0/download/t100_145376.zip] Listener[com.handwriting.makefont.commlogic.FileDownloadManager$1@26fa837], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[-1783616310] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@2597ac2 by 11
V/FileDownloader.FileDownloadList: add list in all -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d 11 1
D/FileDownloader.FileDownloadManager: request start the task with url(https://devimg.xiezixiansheng.com/users/3/322/handzip/t100_145376.zip) path(/storage/emulated/0/download/t100_145376.zip) isDirectory(FALSE)
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[1] new[6] 1
D/FileDownloader.FileDownloadMessenger: notify started -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.ConnectTask: <---- -1783616310 request header {range=[bytes=0-0], user-agent=[FileDownloader/1.7.5-SNAPSHOT]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], age=[1026], content-length=[1], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes 0-0/2327711], content-type=[application/zip], date=[Thu, 14 Jun 2018 08:35:01 GMT], eagleid=[3b6c8acb15289663278268185e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,200-0,H], cache45.l2nu17-1[1,0], cache10.cn370[0,206-0,H], cache3.cn370[1,0]], x-cache=[HIT TCP_MEM_HIT dirn:8:84608423 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B2228B5EE045E31743BF484], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Thu, 14 Jun 2018 08:35:02 GMT]}
D/FileDownloader.FileDownloadUtils: etag find "EA287B90718A3851F09221549CFD6058" for task(-1783616310)
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.FileDownloadUtils: can't continue -1783616310 file not suit, exists[FALSE], directory[FALSE]
D/FileDownloader.ConnectTask: <---- -1783616310 request header {if-match=["EA287B90718A3851F09221549CFD6058"], range=[bytes=0-], user-agent=[FileDownloader/1.7.5-SNAPSHOT]}
D/FileDownloader.ConnectTask: ----> -1783616310 response header {accept-ranges=[bytes], access-control-allow-methods=[POST,GET,HEDA], access-control-allow-origin=[], access-control-max-age=[0], age=[1026], content-length=[2327711], content-md5=[6ih7kHGKOFHwkiFUnP1gWA==], content-range=[bytes 0-2327710/2327711], content-type=[application/zip], date=[Thu, 14 Jun 2018 08:35:01 GMT], eagleid=[3b6c8acb15289663278728266e], etag=["EA287B90718A3851F09221549CFD6058"], last-modified=[Tue, 13 Mar 2018 09:48:58 GMT], server=[Tengine], timing-allow-origin=[], via=[cache28.l2nu17-1[0,200-0,H], cache45.l2nu17-1[1,0], cache10.cn370[0,206-0,H], cache3.cn370[2,0]], x-cache=[HIT TCP_MEM_HIT dirn:8:84608423 mlen:-1], x-oss-hash-crc64ecma=[2764693949817094816], x-oss-object-type=[Normal], x-oss-request-id=[5B2228B5EE045E31743BF484], x-oss-server-time=[6], x-oss-storage-class=[Standard], x-swift-cachetime=[3600], x-swift-savetime=[Thu, 14 Jun 2018 08:35:02 GMT]}
D/FileDownloader.DownloadRunnable: the connection[-1] for -1783616310, is connected range[0, -1) current offset[0] with code[206]
D/FileDownloader.FetchDataTask: start fetch(-1): range [0, -1), seek to[0]
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress update model's status with progress
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d 4096 2327711
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
I/FileDownloader.DownloadStatusCallback: inspectNeedCallbackToUser need callback to user
I/FileDownloader.DownloadStatusCallback: handleProgress notify user progress status
D/FileDownloader.MessageSnapshotGate: ~~~callback -1783616310 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress -1783616310@com.liulishuo.filedownloader.DownloadTask@fa72b0d 28369 2327711

@rantianhua
Copy link
Collaborator

OK,那等 1.7.5 release 吧

@Jacksgong Jacksgong added this to the 1.7.5 milestone Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants