0

My initial response headers - notice the Accept-Ranges header

HTTP/1.1 200 OK
X-Powered-By: Express
Vary: Origin
Access-Control-Allow-Credentials: true
X-RateLimit-Limit: 1
X-RateLimit-Remaining: 0
Date: Thu, 08 Apr 2021 06:14:19 GMT
X-RateLimit-Reset: 1617862461
Accept-Ranges: bytes
Content-Length: 100000000
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="some_file.txt"
Connection: keep-alive
Keep-Alive: timeout=5

I then restart the server and click resume download in chrome, but chrome doesn't send back in Range request headers

I'm following the documentation on Mozilla's website

Am I missing a header or misunderstanding how this works, especially with chrome and other browsers? Is there another way I can manually support resuming downloads by sending the right response and understanding the right request? From a technical perspective, if chrome sends back which range it now needs I will be able to resume the download.

According to this article, chrome should support something like this. I just need to be pointed in the right direction.

Ty!

rubixibuc
  • 7,111
  • 18
  • 59
  • 98
  • 1
    I might be wrong, but I speculate that Chrome needs some way to know that the file it's trying to download at that URL is indeed the same file when it tries to resume. If this is true, the server probably needs to support the ETag header. – Evert Apr 08 '21 at 06:20
  • I'm so close now, ty! But It's not able to resume based on the headers I'm sending back a second time. I'm getting two headers on the resume now Range: bytes=4096- and If-Range: "v1/size=1000000000" I'm sending back a status of 206 and these headers Content-Range: bytes 4096-999999999/1000000000 and Content-Length: 999995904 and then the response body, but if fails to resume Am I still missing something? Ty so much. And if you put it in an answer I will definitely accept – rubixibuc Apr 08 '21 at 14:37
  • I actually just had a null pointer that was breaking it, it's working now! You can put it as an answer – rubixibuc Apr 08 '21 at 15:24

1 Answers1

3

Chrome needs some way to know that the file it's trying to download at that URL is indeed the same file when it tries to resume.

If you add support for an ETag header, this will likely work.

Evert
  • 93,428
  • 18
  • 118
  • 189