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

Backend can't recognize range:0-0(which response 416) resources #55

Closed
xuanu opened this issue May 7, 2018 · 1 comment
Closed

Backend can't recognize range:0-0(which response 416) resources #55

xuanu opened this issue May 7, 2018 · 1 comment

Comments

@xuanu
Copy link

xuanu commented May 7, 2018

一定不能通过网页访问,如果访问一次,再通过okdownlaod下载就可以了。
下载地址:com.liulishuo.okdownload.DownloadTask@cd4e2add@3@http://cdn.qimonjy.cn:80//netstudy/main/aibooks/20180107/201801071145582596914048/c649b25069a241caa6f77423be5754ef.jpg@/storage/emulated/0/qimon/student/cache/common/ppts.com/24/2446C9854484EF08E2F5670A177609B4.jpg

tim 20180507095546

@Jacksgong
Copy link
Collaborator

Jacksgong commented May 7, 2018

  1. 这个和是不是CDN这种类似的资源没有直接关系
  2. 这个问题实际上是你们后端处理的问题,根据rfc7233协定的http协议,当请求头请求的Range是0-0时,仅返回第一个与最后一个字节,可是你们后端直接返回416(Range Not Satisfiable), 这明显不符合HTTP协议;准确上来说,这是你们后端http协议层面的问题
  3. 但是理论上来说返回416的时候,应该不带回有效数据,但是后端却是带回了有效数据,因此这边没有做进一步的HEAD补偿性试探请求,因此到后面直接检查response code的时候就不过了

image


  • 针对为什么OkDownload的试探链接需要采用 range:0-0的原因,请参看这篇文章

  • 试探性连接相关代码: ConnectTrial.java
  • 响应检查相关代码: BreakpointRemoteCheck.java

不过你这种情况的特征也比较明显,那就是对于试探链接,后端返回 416(其实按照协议此时是不可能出现416的,因为我们并没有提供除0-0以外的Range),但是响应头的数据都是有效的,因此,考虑到可用性,我们这边已经在1.0.3-SNAPSHOT特别将这种情况处理为合法,你可以根据wiki引入snapshot版本进行下载此类不符合协议类型的资源了

@Jacksgong Jacksgong changed the title CDN文件下载失败 Download can't recognize range:0-0(which response 416) resources May 7, 2018
@Jacksgong Jacksgong added this to the 1.0.3 milestone May 7, 2018
@Jacksgong Jacksgong changed the title Download can't recognize range:0-0(which response 416) resources Server can't recognize range:0-0(which response 416) resources May 10, 2018
@Jacksgong Jacksgong changed the title Server can't recognize range:0-0(which response 416) resources Backend can't recognize range:0-0(which response 416) resources May 10, 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

2 participants