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

Better Chunk loading handling to avoid HTTP 416 (Range Not Satisfiable) Error #831

Open
t83714 opened this issue Sep 18, 2020 · 3 comments · May be fixed by #832
Open

Better Chunk loading handling to avoid HTTP 416 (Range Not Satisfiable) Error #831

t83714 opened this issue Sep 18, 2020 · 3 comments · May be fixed by #832

Comments

@t83714
Copy link
Contributor

t83714 commented Sep 18, 2020

When request content in chunks, PapaParse may trigger HTTP 416 (Range Not Satisfiable) Error under the following two situation:

  • we always calculate end as: var end = this._start + this._config.chunkSize - 1; see here. This likely always make the last chunk request to request a range that is beyond the actual file size (unless the actual last chunk size is just equal to the this._config.chunkSize.) Many servers will response HTTP 416 error for this.
    • Solution: use Content-Range header to retrieve the actual file size and use actual content size - 1 as the end for the last chunk
  • As we often don't know the actual size of the target file before we request it, it's possible the this._config.chunkSize is configured to a size that is larger than the file size. e.g. the file is only 100 bytes and this._config.chunkSize is configured to 64KB. When this happens, PapaParse will always fail on the first chunk request due to HTTP 416 (Range Not Satisfiable) Error
    • Solution: we should retry (only once) on the first chunk request without Range header on 416 error
@protyze
Copy link

protyze commented Jun 1, 2022

Running into the same issue as well. Would be great to have the PR merged.

@Ali-Javanmardi
Copy link

I have same problem with small file size.
Is there any solution to parse small files without this error?

@RoelRoel
Copy link

It would be very nice if this could be solved.

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

Successfully merging a pull request may close this issue.

4 participants