Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

"httpio.HTTPIOError: Server does not accept 'Range' headers" when server does accept Range #6

Description

@ewjoachim

For some reason, it seems AmazonS3 may return the "accept-ranges: bytes" header more than once. requests will concatenate the values, resulting in the header value being bytes, bytes, and then:

if response.headers.get('Accept-Ranges', '').lower() != 'bytes':

This test triggers, and we can't open the file.

I'd guess a better test would be "bytes" in response.headers.get(...)

Also, it looks like the Accept-Ranges header is not required:
https://tools.ietf.org/html/rfc7233#section-2.3

An origin server that supports byte-range requests for a given target
resource MAY send Accept-Ranges: bytes to indicate what range units are supported.

Here's an url you can try for reproduction
https://files.pythonhosted.org/packages/44/e8/4ae9ef3d455f4ce5aa22259cb6e40c69b29ef6b02d49c5cdfa265f7fc821/Django-3.0.1.tar.gz

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions