Skip to content

feat: set Content-Length header in all cache backend Open/Stat responses#328

Merged
alecthomas merged 1 commit into
mainfrom
content-length-headers
Jun 18, 2026
Merged

feat: set Content-Length header in all cache backend Open/Stat responses#328
alecthomas merged 1 commit into
mainfrom
content-length-headers

Conversation

@alecthomas

Copy link
Copy Markdown
Collaborator

All cache backends now consistently return a Content-Length header in
the responses from Open() and Stat(), reporting the actual object size.

  • Disk: from os.Stat / file.Stat
  • Memory: from len(entry.data)
  • S3: from objInfo.Size (Open already did this, now Stat does too)
  • Client: removed Content-Length from transportHeaders filter so the
    remote backend preserves it from server responses

Added a ContentLength conformance test to the cache test suite.

All cache backends now consistently return a Content-Length header in
the responses from Open() and Stat(), reporting the actual object size.

- Disk: from os.Stat / file.Stat
- Memory: from len(entry.data)
- S3: from objInfo.Size (Open already did this, now Stat does too)
- Client: removed Content-Length from transportHeaders filter so the
  remote backend preserves it from server responses

Added a ContentLength conformance test to the cache test suite.
@alecthomas alecthomas requested a review from a team as a code owner June 18, 2026 06:09
@alecthomas alecthomas requested review from stuartwdouglas and removed request for a team June 18, 2026 06:09
@alecthomas alecthomas enabled auto-merge (squash) June 18, 2026 06:10
@alecthomas alecthomas disabled auto-merge June 18, 2026 06:11
@alecthomas alecthomas merged commit 312f2c3 into main Jun 18, 2026
8 checks passed
@alecthomas alecthomas deleted the content-length-headers branch June 18, 2026 06:11
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