Don't remove Content-Encoding in fetchurl / nix-prefetch-url
Fixes #1568.
This commit is contained in:
@@ -27,6 +27,7 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
||||
the result anyway. */
|
||||
DownloadRequest request(url);
|
||||
request.verifyTLS = false;
|
||||
request.decompress = false;
|
||||
|
||||
/* Note: have to use a fresh downloader here because we're in
|
||||
a forked process. */
|
||||
|
||||
@@ -269,7 +269,8 @@ struct CurlDownloader : public Downloader
|
||||
done = true;
|
||||
|
||||
try {
|
||||
result.data = decodeContent(encoding, ref<std::string>(result.data));
|
||||
if (request.decompress)
|
||||
result.data = decodeContent(encoding, ref<std::string>(result.data));
|
||||
callSuccess(success, failure, const_cast<const DownloadResult &>(result));
|
||||
act.progress(result.data->size(), result.data->size());
|
||||
} catch (...) {
|
||||
|
||||
@@ -17,6 +17,7 @@ struct DownloadRequest
|
||||
size_t tries = 5;
|
||||
unsigned int baseRetryTimeMs = 250;
|
||||
ActivityId parentAct;
|
||||
bool decompress = true;
|
||||
|
||||
DownloadRequest(const std::string & uri)
|
||||
: uri(uri), parentAct(curActivity) { }
|
||||
|
||||
@@ -158,7 +158,9 @@ int main(int argc, char * * argv)
|
||||
auto actualUri = resolveMirrorUri(state, uri);
|
||||
|
||||
/* Download the file. */
|
||||
auto result = getDownloader()->download(DownloadRequest(actualUri));
|
||||
DownloadRequest req(actualUri);
|
||||
req.decompress = false;
|
||||
auto result = getDownloader()->download(req);
|
||||
|
||||
AutoDelete tmpDir(createTempDir(), true);
|
||||
Path tmpFile = (Path) tmpDir + "/tmp";
|
||||
|
||||
Reference in New Issue
Block a user