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

文件大小出错 #1011

Closed
TonyXie0320 opened this issue Apr 21, 2018 · 5 comments
Closed

文件大小出错 #1011

TonyXie0320 opened this issue Apr 21, 2018 · 5 comments

Comments

@TonyXie0320
Copy link

1.7.3版本
progress(BaseDownloadTask task, int soFarBytes, int totalBytes)

totalBytes=-1

与实际大小不符合。

切换到1.6.8正常,但是暂停后重新下载会失败。

@rantianhua
Copy link
Collaborator

1.7.0 为了解决 #933 的问题,获取文件总大小的方式做了优化,第一次会发送一个 range 为 0-0 的请求并通过 Content-Range 这个 Response Header 来获取文件大小。通过你的描述,应该是你下载的文件,后端没有按照 rfc 的标准实现 Http 协议,即没有返回 Content-Range 这个 Response Header ,所以 Filedownloader 采用 chunk 的方式下载,此时 totalBytes 就是 -1 。你可以提供 FileDownloader 的日志来验证我的猜想。

@zhiyong926
Copy link

我也遇到这个问题,我的下载文件时用的阿里云的CDN存储的,后端我如何按照rfc标准实现http协议,阿里云CDN提供的下载地址,如何去设置?但是我测试发现,只要我暂停一次,再点下载时,就可以获取到正确的totalBytes,具体我现在升级到1.7.3版本后应该如何设置或调用能显示正常进度?还有我当前使用TasksManagerDemoActivity.java里的多任务下载,就是我若换OkDownload,能平滑过渡过去吗?步骤是?小白看完OkDownload甚是不解,多谢不吝赐教

@zhiyong926
Copy link

@rantianhua
Copy link
Collaborator

rantianhua commented May 13, 2018

@zhiyong926 你说 :"只要我暂停一次,再点下载时,就可以获取到正确的totalBytes" ,希望能提供 FileDownloader 的日志并新开一个 Issue ,以便我分析是否 FileDownloader 有 bug 。关于 FileDownloader 如果平滑地切换到 OkDownload ,我们会计划出一个示例教程。你也可以先多看看 OkDownload 的 wiki

@rantianhua
Copy link
Collaborator

长时间没有回应,这个我先关掉,如果还有问题请按照问题模版重新提 issue 。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants