You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/11/12 21:21:24 UTC

[whimsy] branch master updated: Check for redirected hashes

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 9cc39e2  Check for redirected hashes
9cc39e2 is described below

commit 9cc39e2ffb90413a0f9523c69c104fff1b595754
Author: Sebb <se...@apache.org>
AuthorDate: Fri Nov 12 21:21:17 2021 +0000

    Check for redirected hashes
---
 tools/download_check.rb | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/download_check.rb b/tools/download_check.rb
index 98dbba2..d02bccc 100755
--- a/tools/download_check.rb
+++ b/tools/download_check.rb
@@ -183,19 +183,24 @@ def GET(url, followRedirects=true)
   fetch_url(url, :get, 0, followRedirects)[2]
 end
 
-# Check page exists => response or nil
-def check_head(path, severity = :E, log=true)
-  _uri, code, response = HEAD(path)
+# Check page exists => uri, code, response|nil
+def check_head_3(path, severity = :E, log=true)
+  uri, code, response = HEAD(path)
   if code == '403' # someone does not like Whimsy?
     W "HEAD #{path} - HTTP status: #{code} - retry"
-    _uri, code, response = HEAD(path)
+    uri, code, response = HEAD(path)
   end
   unless code == '200'
     test(severity, "HEAD #{path} - HTTP status: #{code}") unless severity.nil?
-    return nil
+    return uri, code, nil
   end
   I "Checked HEAD #{path} - OK (#{code})" if log
-  response
+  return uri, code, response
+end
+
+# Check page exists => response or nil
+def check_head(path, severity = :E, log=true)
+  check_head_3(path, severity, log)[2]
 end
 
 # check page can be read => body or response or nil
@@ -598,7 +603,8 @@ def _checkDownloadPage(path, tlp, version)
         if $NOFOLLOW
           I "Skipping artifact hash #{h}"
         else
-          check_head(h, :E) # log
+          uri, _code, _response = check_head_3(h, :E) # log
+          W "Redirected hash: #{uri} != #{h}" unless uri.to_s == h
         end
       else
         # will have been reported by check_hash_loc