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 17:40:18 UTC
[whimsy] branch master updated: Simplify code check
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 1e56ea8 Simplify code check
1e56ea8 is described below
commit 1e56ea86214f8321f6b36e30b29cc8848b079854
Author: Sebb <se...@apache.org>
AuthorDate: Fri Nov 12 17:40:11 2021 +0000
Simplify code check
---
tools/download_check.rb | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tools/download_check.rb b/tools/download_check.rb
index 0901bea..98dbba2 100755
--- a/tools/download_check.rb
+++ b/tools/download_check.rb
@@ -171,10 +171,10 @@ def fetch_url(url, method=:head, depth=0, followRedirects=true) # string input
end
end
-# Head an HTTP URL => response
+# Head an HTTP URL => uri, code, response
def HEAD(url)
puts ">> HEAD #{url}" if $VERBOSE
- fetch_url(url, :head)[2]
+ fetch_url(url, :head)
end
# get an HTTP URL => response
@@ -185,12 +185,10 @@ end
# Check page exists => response or nil
def check_head(path, severity = :E, log=true)
- response = HEAD(path)
- code = (response.code || '?') rescue response.to_s
+ _uri, code, response = HEAD(path)
if code == '403' # someone does not like Whimsy?
W "HEAD #{path} - HTTP status: #{code} - retry"
- response = HEAD(path)
- code = (response.code || '?') rescue response.to_s
+ _uri, code, response = HEAD(path)
end
unless code == '200'
test(severity, "HEAD #{path} - HTTP status: #{code}") unless severity.nil?