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