Follow redirects early to ensure consistency between the manifest and the tarball
Without this change, if the URL is a redirect that changes in between, we can get a manifest that doesn't match the tarball.
This commit is contained in:
parent
ca3d9f8b31
commit
1d0bafb74d
|
@ -89,6 +89,14 @@ sub update {
|
|||
foreach my $name (keys %channels) {
|
||||
my $url = $channels{$name};
|
||||
|
||||
# Check if $url is a redirect. If so, follow it now to ensure
|
||||
# consistency if the redirection is changed between
|
||||
# downloading the manifest and the tarball.
|
||||
my $headers = `$Nix::Config::curl --silent --head '$url'`;
|
||||
die "$0: unable to check `$url'\n" if $? != 0;
|
||||
$headers =~ s/\r//g;
|
||||
$url = $1 if $headers =~ /^Location:\s*(.*)\s*$/m;
|
||||
|
||||
# Pull the channel manifest.
|
||||
system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
|
||||
or die "cannot pull manifest from `$url'\n";
|
||||
|
|
Loading…
Reference in a new issue