Send Content-Length for raw API archives
Created by: felixfbecker
Fixes #1554
This allows browsers and language servers to show a progress bar while downloading.
According to the docs, cachedFetch()
, which is called by GitServerFetchArchive()
, always serves from the cache. If the cache item is missing, it will fill the cache first, then return a file handle to it. We can stat that file handle and return its size as Content-Length
.
cachedFetch will open a file from the local cache with key. If missing, fetcher will fill the cache first. cachedFetch also performs single-flighting.