0

I'm using the "get an upload session, upload chunks" method. Generally, it's working. I'm using a chunk size of 640 * 1024, which according to the docs is legit.

Occasionally I'll get a response code of 416 (Requested Range Not Satisfiable). The Upload large files with an upload session documentation is not very clear on what to do when I get one:

On failures when the client sent a fragment the server had already received, the server will respond with HTTP 416 Requested Range Not Satisfiable.

I am keeping track in my code of the chunks, which I believe I am doing correctly. Is there another reason I might get a 416? I will say that I was getting crappy upload speeds from my ISP at this time.

If I do get a 416, should I just retry it? Or should I ignore it, and believe the docs, that (for some reason) that chunk has already been received?

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Fred Ross-Perry
  • 385
  • 1
  • 15
  • You shouldn't retry a 416 since it believes it already received that chunk. I would continue and then validate the file is correct once it completes. – Marc LaFleur Mar 31 '20 at 22:50
  • 1
    Thank you. I think I just discovered that Volley (the library I'm using on Android) is retrying my requests. If I keep Volley from doing retries, I get much better results. I will also do as you suggest by ignoring the 416s if I see them. – Fred Ross-Perry Mar 31 '20 at 23:23

0 Answers0