Skip to content

fix(server): Return 200 instead of 204 for object HEAD requests - #577

Merged
jan-auer merged 5 commits into
mainfrom
fix/head-status
Jul 28, 2026
Merged

fix(server): Return 200 instead of 204 for object HEAD requests#577
jan-auer merged 5 commits into
mainfrom
fix/head-status

Conversation

@jan-auer

@jan-auer jan-auer commented Jul 27, 2026

Copy link
Copy Markdown
Member

A HEAD on an existing object now responds with 200 OK and the metadata headers instead of 204 No Content. Callers that branch on the status code no longer have to special-case HEAD against the 200 that GET returns for the same resource.

Additionally, GET responses now return the content-length instead of streaming with chunked transfer encoding.

This aligns with RFC 9110 §9.3.2, which specifies that a HEAD response should carry the same status and header fields as the equivalent GET, minus the body, and with what both S3 HeadObject and the GCS XML API do. It also unblocks exposing the object size on HEAD later: 204 responses are forbidden from carrying Content-Length, so the old status permanently foreclosed the cheapest way for a client to learn an object's size.

Also fixes the S3-compatible backend reporting a size of zero for metadata-only lookups, since it read the decoded body length rather than the Content-Length header.

@codecov

This comment has been minimized.

@jan-auer
jan-auer marked this pull request as ready for review July 27, 2026 11:54
@jan-auer
jan-auer requested a review from a team as a code owner July 27, 2026 11:54
Comment thread objectstore-service/src/backend/s3_compatible.rs
Comment thread objectstore-server/src/endpoints/objects.rs
Comment thread objectstore-server/src/endpoints/objects.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 44bf616. Configure here.

Comment thread objectstore-types/src/metadata.rs
Comment thread objectstore-service/src/backend/s3_compatible.rs
Comment thread objectstore-server/src/endpoints/batch.rs

@lcian lcian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@jan-auer
jan-auer merged commit 725ec28 into main Jul 28, 2026
26 checks passed
@jan-auer
jan-auer deleted the fix/head-status branch July 28, 2026 11:36
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.

2 participants