Added two HttpClient instances to distinguish between legacy (no
Accept-Encoding) and modern compressed HTTP transfer behaviors.
- LegacyHttp:
Sends no Accept-Encoding header.
Used when requesting .dll.gz files, ensuring that the server delivers
the file exactly as-is without applying HTTP-level compression.
- Http:
Enables AutomaticDecompression and advertises Accept-Encoding
(gzip, deflate).
When the server supports HTTP content compression, even a regular .dll
file can be transmitted in compressed form and transparently
decompressed by the client.
This separation prevents ambiguities between:
- File-level compression (.dll.gz)
- Transport-level compression (Content-Encoding: gzip/deflate)
and ensures predictable behavior when downloading assemblies depending on
server capabilities.
To prevent partial or corrupt files on download failure, write the decompressed
stream to a temporary file first, and then atomically move it to the final
destination upon success.
In TryDownloadGzipToFile, modify the catch block to log the exception details
before returning false, instead of silently swallowing the error.