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

Support Range requests on files.pythonhosted.org #8968

Closed
dholth opened this issue Jan 6, 2021 · 2 comments
Closed

Support Range requests on files.pythonhosted.org #8968

dholth opened this issue Jan 6, 2021 · 2 comments

Comments

@dholth
Copy link

dholth commented Jan 6, 2021

Describe the bug
Byte Range: requests appear to be broken on files.pythonhosted.org, noticed in pypa/pip#8723 . This was supported earlier last year.

To Reproduce
A 206 response would be expected, but we see

curl -I https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl -i -H "Range: bytes=0-1023"
HTTP/2 200 
last-modified: Sun, 13 Dec 2020 18:09:08 GMT
etag: "6c222a4df97a3311b4e189a59c47dea0"
content-type: application/octet-stream
x-goog-hash: crc32c=+zKrbw==
x-goog-hash: md5=bCIqTfl6MxG04YmlnEfeoA==
server: UploadServer
cache-control: max-age=365000000, immutable, public
accept-ranges: bytes
date: Wed, 06 Jan 2021 15:41:19 GMT
age: 2064730
x-served-by: cache-sea4427-SEA, cache-fty21321-FTY
x-cache: HIT, HIT
x-cache-hits: 4, 19
x-timer: S1609947679.367178,VS0,VE0
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: deny
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-permitted-cross-domain-policies: none
x-robots-header: noindex
content-length: 35046

Additional context
I understand pypi is using these services. This documentation mentions a few configuration quirks that could prevent range requests from working.
https://docs.fastly.com/en/guides/segmented-caching https://cloud.google.com/storage/docs/transcoding#range

@ewdurbin
Copy link
Member

ewdurbin commented Jan 6, 2021

It works for actual GET, but not HEAD. You've issued a HEAD request via the -I parameter of your curl command.

@dholth
Copy link
Author

dholth commented Jan 6, 2021

Thanks and sorry for the misunderstanding. These commands show that we get the expected number of bytes from a couple of range requests.

$ curl https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl -H "Range: bytes=0-4747" | wc
     16      94    4748

$ curl https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl -H "Range: bytes=-4747" | wc

     14      76    4747

@dholth dholth closed this as completed Jan 6, 2021
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

2 participants