This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 76c51b2 Allow for downloads redirect of asc and hash
76c51b2 is described below
commit 76c51b2aedf5814a683b6fdc5a54f8cb100b987c
Author: Sebb <[email protected]>
AuthorDate: Mon Mar 2 15:10:56 2020 +0000
Allow for downloads redirect of asc and hash
---
tools/download_check.rb | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/download_check.rb b/tools/download_check.rb
index 53f331b..a5546f5 100755
--- a/tools/download_check.rb
+++ b/tools/download_check.rb
@@ -152,13 +152,19 @@ def GET(url)
end
# Check page exists
-def check_head(path, severity = :E, expectedStatus = "200", log=true)
+def check_head(path, severity = :E, expectedStatus = "200", log=true,
allowRedirect=false)
response = HEAD(path)
code = response.code || '?'
if code == '403' # someone does not like Whimsy?
W "HEAD #{path} - HTTP status: #{code} - retry"
response = HEAD(path)
code = response.code || '?'
+ elsif allowRedirect and code == '302'
+ location = response['location']
+ if location.start_with? 'https://downloads.apache.org/'
+ response = HEAD(location)
+ code = response.code || '?'
+ end
end
if code != expectedStatus
test(severity, "HEAD #{path} - HTTP status: #{code} expected:
#{expectedStatus}") unless severity == nil
@@ -420,7 +426,7 @@ def _checkDownloadPage(path, tlp, version)
if $NOFOLLOW
I "Skipping archive hash #{h}"
else
- check_head(h, :E, "200", true)
+ check_head(h, :E, "200", true, true)
end
else
# will have been reported by check_hash_loc
@@ -480,7 +486,7 @@ def _checkDownloadPage(path, tlp, version)
E "NAK: ct='#{ct}' cl='#{cl}' #{path}"
end
else
- E "Could not find link for #{name} in #{h}"
+ E "Could not find link for '#{name}' in page: '#{h}' (missing or
archived)"
end
end
elsif h =~ %r{\.(md5|sha.*)$}