whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: check_page optionally return response
Date Wed, 14 Apr 2021 12:47:14 GMT
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 e07ad34  check_page optionally return response
e07ad34 is described below

commit e07ad343e0ea25e130c302480d89eefc6e7e6268
Author: Sebb <sebb@apache.org>
AuthorDate: Wed Apr 14 13:47:05 2021 +0100

    check_page optionally return response
---
 tools/download_check.rb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/download_check.rb b/tools/download_check.rb
index d16f4b4..81aa439 100755
--- a/tools/download_check.rb
+++ b/tools/download_check.rb
@@ -203,8 +203,8 @@ def check_head(path, severity = :E, log=true)
   response
 end
 
-# check page can be read => body or nil
-def check_page(path, severity=:E, log=true)
+# check page can be read => body or response or nil
+def check_page(path, severity=:E, log=true, returnRes=false)
   response = GET(path)
   code = response.code ||  '?'
   unless code == '200'
@@ -213,13 +213,13 @@ def check_page(path, severity=:E, log=true)
   end
   I "Checked GET #{path} - OK (#{code})" if log
   puts "Fetched #{path} - OK (#{code})" if $CLI
-  return response.body
+  return returnRes ? response : response.body
 end
 
 # Check closer/download page
 def check_closer_down(url)
   # N.B. HEAD does not work; it returns success
-  res = check_page(url, :E, false) # nolog
+  res = check_page(url, :E, false, true) # nolog, return response
   return unless res
   ct = res.content_type
   cl = res.content_length

Mime
View raw message