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

Some HTTPS links try to download the whole file? #102

Open
robertaboukhalil opened this issue Aug 29, 2024 · 0 comments
Open

Some HTTPS links try to download the whole file? #102

robertaboukhalil opened this issue Aug 29, 2024 · 0 comments
Assignees

Comments

@robertaboukhalil
Copy link
Collaborator

robertaboukhalil commented Aug 29, 2024

URL: https://ftp-trace.ncbi.nlm.nih.gov/ReferenceSamples/giab/data_somatic/HG008/Liss_lab/BCM_Revio_20240313/HG008-T_PacBio-HiFi-Revio_20240313_106x_GRCh38-GIABv3.bam

It seems to be downloading the whole bam file (says Pending in network tab for a few mins):

Screenshot 2024-08-29 at 10 12 23 AM


This is caused by the web server not properly returning Accept-Ranges: bytes from browser requests:

await fetch(url, {method:"HEAD"}).then(d => Object.fromEntries(d.headers))
// {content-length: '102324808906', content-type: 'application/x-bam', last-modified: 'Thu, 27 Jun 2024 18:31:13 GMT'}

In those cases, Emscripten will download the whole file (source)

Yet the server does support Range requests:

await fetch(url, {method:"HEAD", headers: { "Range": "bytes=0-10" }})
// ... status: 206, 

And using curl, the server returns the correct headers:

curl -I $URL
HTTP/1.1 200 OK
...
Accept-Ranges: bytes
Content-Length: 102324808906
...

To do: before loading the BAM file, make a HEAD request to check for the header

@robertaboukhalil robertaboukhalil self-assigned this Aug 29, 2024
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

No branches or pull requests

1 participant