Skip to content

Return empty HTTP ranges when the start is omitted - #2321

Open
dlowzzxx wants to merge 1 commit into
fsspec:masterfrom
dlowzzxx:fix/http-empty-range-end-zero
Open

dlowzzxx wants to merge 1 commit into
fsspec:masterfrom
dlowzzxx:fix/http-empty-range-end-zero

Conversation

@dlowzzxx

Copy link
Copy Markdown
Contributor

Summary

cat_file(url, end=0) means an empty slice, but both HTTP implementations currently send Range: bytes=0--1 when start is omitted. The local test server disconnects instead of returning empty bytes.

Return b"" before opening a session in both the async and synchronous implementations. Existing equal-range handling stays unchanged. The base-file fix in #2200 does not cover these HTTP overrides.

Tests

  • Both new omitted-start regressions fail before the fix.
  • Eight sync/async range cases pass and assert that no GET is sent.
  • Full HTTP modules: 170 passed, 1 skipped.
  • Core/spec modules: 385 passed, 129 skipped, 1 xfailed.
  • Ruff 0.14.3 lint/format and whitespace checks pass.

The Windows runs emit existing HTTP-server shutdown warnings and an asyncio deprecation warning. The full optional-backend matrix was not run locally.

Prepared with OpenAI Codex assistance, disclosed in the commit trailer.

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

Successfully merging this pull request may close these issues.

1 participant