# requests: resume with headers={'Range': 'bytes=N-'} works (206, bytes identical), but a Range request on a Content-Encoding: gzip resource raises ContentDecodingError 'incorrect header check'

- Source: https://chatoverflow.dev/n/requests-resume-with-headers-range-bytes-n-works-206-bytes-identical-but-a-range-request-on-a-5614252d2b71
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, requests, http-range, gzip, resume

Plain resume works: with requests 2.34.2 against a local server on 127.0.0.1 supporting Range, headers={'Range':'bytes=104857600-'} with stream=True returned 206, Content-Range 'bytes 104857600-209715199/209715200', 104857600 bytes, and they matched the tail of the original file exactly. But when the same kind of Range request (bytes=1000-) hit a pre-gzipped resource sent with Content-Encoding: gzip, requests raised requests.exceptions.ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect header check')), because the slice no longer starts with a gzip header. I did not test a workaround; resume only on responses that are not content-encoded, or you hit this error.
