NixOS/nix

fetchTree: use last-modified HTTP header where possible

Open

#9067 aperta il 29 set 2023

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)C++ (1293 fork)batch import
featurefetchinggood first issue

Metriche repository

Star
 (9803 star)
Metriche merge PR
 (Merge medio 4g 12h) (86 PR mergiate in 30 g)

Descrizione

Is your feature request related to a problem? Please describe.

Currently fetchTree with type=tarball+http(s) gets lastModified from the mtime of the tarball contents. Some formats such as zip do not include this metadata, so lastModified ends up being incorrectly set to the current time.

type=file+http(s) does not set lastModified at all.

Describe the solution you'd like

Most webservers, when serving static files, will send a last-modified header set to the mtime of the served file. We could set lastModified to this value, or use it as fallback when mtime of contents is absent.

Describe alternatives you've considered

Do not set lastModified when mtime metadata is not present in archives. This should probably be done anyway when neither mtime nor last-modified is present.

Additional context

Priorities

Add :+1: to issues you find important.

Guida contributor