2015年7月27日 星期一

Resume-able HTTP download (continuous downloading)

Required headers in the initial HTTP GET request

Range: (leave value empty to get Accept-Range type and ETag in response headers)

Required headers in the subsequent HTTP GET request

If-Range: [ETag]
Range: [type]=[start]-[end]
  • start from 0
  • end can be optional to retrieve to all
  • type can be bytes and all 

Response status

206 - Partial Content
200 - OK for the whole content in response body

Response headers

Content-Range: [type] [start]-[end]/[max]
  • max is the overall size of the file

Reference

http://stackoverflow.com/questions/8293687/sample-http-range-request-session
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.12
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35

沒有留言:

張貼留言