Skip to content

Two follow-ups to #270/#282: empty-entry Range handling and a client-abort test #290

Closed

Description

@peter-svensson

I have two small follow-ups to #270 and #282 ready. The repo now only accepts PRs from collaborators, so they are on branches in my fork. Each one is a single commit on dev (v9.9.0), so it can be cherry-picked as is.

1. Ignore Range on an empty entry instead of answering 416

Branch: peter-svensson:fix/empty-object-range (diff)

An empty entry has no satisfiable range. What the proxy download route answers depends on the storage driver:

  • filesystem and GCS: clampRange returns nothing for any start on a zero-length object, so the route answers 416 with content-range: bytes */0
  • Azure: bytes=0- gets a plain 200 (the SDK drops the Range header for offset 0 with no count), and any start past 0 gets a 416
  • S3 (RustFS in CI): bytes=0- gets an empty 200

The route now ignores Range when the entry is empty and sends an empty 200 with content-length: 0. RFC 9110 §14.2 allows a server to ignore Range, and the route already does this for unmerged entries.

The new test in tests/range-download.test.ts covers bytes=0- and bytes=5- on an empty merged entry. On dev it fails with sqlite + filesystem (expected 416 to be 200). With the fix it passes on filesystem and azblob locally. I could not run s3 and gcs locally.

2. Test that a client abort destroys the storage stream

Branch: peter-svensson:test/download-client-abort (diff)

This is a test-only change. tests/proxy-backpressure.test.ts covers the backpressure half of #282, but nothing covers the client-abort half.

The new case mounts the real download route in-process and mocks storage.download with a stream that never ends. The client hangs up after the first chunk, and the test asserts that the source is destroyed. Storage.download releases the reader lease on that close.

With sendStream in place of pipeline the test fails (expected false to be true), because sendStream only unpipes. With pipeline it passes.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions