Skip to content

Container-via-index.html: If-None-Match uses directory ETag, not index.html ETag #317

Description

@melvincarvalho

Follow-up surfaced during #316 review.

Problem

In src/handlers/resource.js handleGet, for containers that have an index.html (including the conneg path that extracts a JSON-LD data-island from it and returns Turtle/JSON-LD), the If-None-Match / 304 check runs earlier against the directory's ETag (stats.etag, derived from directory mtime/size). But the response body for these variants comes from index.html, and the response ETag is indexStats.etag.

Result: a client revalidating with the ETag we actually returned (the index.html one) will always mismatch the directory ETag — the 304 fast-path is missed and the server returns a full 200. Efficiency bug.

Severity

Efficiency, not correctness. Body is still correct; just more bandwidth than necessary. Matters more now that must-revalidate (from #316) causes clients to revalidate on every use.

Suggested fix

Move the If-None-Match check to after the effective ETag is chosen for the selected variant — use indexStats.etag for index.html-backed representations, stats.etag for directory-listing representations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcachingHTTP caching, ETags, Cache-Control

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions