Skip to content

Use ETag header to check validity of manifests which do not have hashes#40

Open
0x189D7997 wants to merge 6 commits intoWinPlay02:masterfrom
0x189D7997:feature-etag
Open

Use ETag header to check validity of manifests which do not have hashes#40
0x189D7997 wants to merge 6 commits intoWinPlay02:masterfrom
0x189D7997:feature-etag

Conversation

@0x189D7997
Copy link
Contributor

Related to #8

This applies to Skyrising and OrnitheMC manifests and version details, hosting APIs of which support the etag and If-None-Match HTTP headers.

Instead of re-downloading them each time, store the ETag value in file attributes when manifests are first acquired and add it to the If-None-Match header in subsequent requests. The server will respond with 304 Not Modified if the manifest is not outdated.
If file system does not support extended attributes, store the ETag in an adjacent file.

fabric-loom uses this exact approach when downloading manifests.
Speaking of which I decided to use attribute read/write methods from its AttributeHelper instead of implementing my own because they would be functionally (and code-wise) identical.

@0x189D7997 0x189D7997 marked this pull request as ready for review December 3, 2025 09:55
@0x189D7997
Copy link
Contributor Author

Converting back to draft, got an idea to store 'catalogue' manifests (such as version_manifest_v2.json) in cache and apply same technique to them.

@0x189D7997 0x189D7997 marked this pull request as draft December 10, 2025 05:15
@0x189D7997
Copy link
Contributor Author

got an idea to store 'catalogue' manifests (such as version_manifest_v2.json) in cache and apply same technique to them.

Turns out Mojang root manifest does not support etag. I will have to rely on If-Modified-Since header which it does support. Needs a different implementation so that will be a separate PR.

@0x189D7997 0x189D7997 marked this pull request as ready for review January 1, 2026 20:44
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