phiresky / sql.js-httpvfs

Hosting read-only SQLite databases on static file hosters like Github Pages
Apache License 2.0
3.47k stars 105 forks source link

Throw an error if server ignores RANGE header #52

Open johtso opened 1 year ago

johtso commented 1 year ago

The HTTP spec dictates that a server may completely ignore the RANGE header if it doesn't support it.

It would be great if a little check was done to make sure the content-length of the response matches the request so we don't end up downloading entire databases.

Specifically I found that Cloudflare usually support partial ranges for cached files, but suddenly stops supporting them above a certain size limit. This left me scratching my head when I saw the seemingly stalled requests. Was only after checking my network activity that I saw it was downloading 700MB of data.