-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ETag should be a hash #2948
Comments
"ETag should be a hash of the contents (not just (lastModificationTime)-(fileLength))" re precomputing, precomputing when? |
if the hash is to be based on the file contents, what algorithm should be used? |
currently im testing an md5 hash on the contents. |
I dont think this is teastable. |
I think that's mostly up for debate / deferred to the end user implementation. Many people prefer not using MD5, but rather SHA1, or a modern standard like SHA2 (whichever variant). And since hashes vary depending on the user and their infrastructure, I'd say cached hashes should not be mandated to use a specific algorithm. I think it would be nice to support non-cached hashing out of the box, however that might be a two-step process. I'd love us to have an algorithm option in the case of non-cached hashes such as |
can do that tonight I think. |
I am going to give this a try as my first vapor contribution :) |
As discussed on discord, I'll try to compute a hash whenever data is written to the file system and store it in a file attribute. As for the hashing technique, SHA-1, SHA-256 or similar will be used. |
We're using a different approach now. Creating the hash solely when a file is written to the file system using Vapor turned out to be unviable since that would not create any file hashes for manually added files. Instead, the hash is now generated whenever a file is streamed back to the client, provided the hash is not already cached. |
@0xTim any update on this? |
Describe the bug
Currently, ETag for file serving is generated from the modified date and file size. A hash is a stronger alternative, and can be precomputed if available. See #2943.
The text was updated successfully, but these errors were encountered: