diff --git a/lib/github-pages-health-check/domain.rb b/lib/github-pages-health-check/domain.rb index 83097f2..b5a79f1 100644 --- a/lib/github-pages-health-check/domain.rb +++ b/lib/github-pages-health-check/domain.rb @@ -245,13 +245,17 @@ def cname_to_github_user_domain? # Check if the CNAME points to a Domain that points to pages # e.g. CNAME -> Domain -> Pages + # rubocop:disable Metrics/AbcSize def cname_to_domain_to_pages? + return false unless dns? + a_record_to_pages = dns.select { |d| d.type == Dnsruby::Types::A && d.name.to_s == host }.first return false unless a_record_to_pages && cname? && !cname_to_pages_dot_github_dot_com? && @www_cname CURRENT_IP_ADDRESSES.include?(a_record_to_pages.address.to_s.downcase) end + # rubocop:enable Metrics/AbcSize # Is the given domain a CNAME to pages.github.(io|com) # instead of being CNAME'd to the user's subdomain? diff --git a/lib/github-pages-health-check/version.rb b/lib/github-pages-health-check/version.rb index a7c79a5..a2e6a2e 100644 --- a/lib/github-pages-health-check/version.rb +++ b/lib/github-pages-health-check/version.rb @@ -2,6 +2,6 @@ module GitHubPages module HealthCheck - VERSION = "1.18.4" + VERSION = "1.18.5" end end diff --git a/spec/github_pages_health_check/domain_spec.rb b/spec/github_pages_health_check/domain_spec.rb index 2336d00..e0c5cb0 100644 --- a/spec/github_pages_health_check/domain_spec.rb +++ b/spec/github_pages_health_check/domain_spec.rb @@ -671,7 +671,7 @@ end end - context "Protocol redirections" do + context "Protocol redirections", :retry => 3, :retry_wait => 1 do before do @out = [] @@ -724,7 +724,7 @@ def stop @servers.each(&:stop) end - it "it does not follow anything other than http/https by default", :retry => 3 do + it "it does not follow anything other than http/https by default" do Typhoeus.get( "http://localhost:#{@servers[1].port}", GitHubPages::HealthCheck.typhoeus_options @@ -733,7 +733,7 @@ def stop expect(@out).to_not include("HIT #{@servers[0].port}") end - it "it follows ftp if requested (negative test)", :retry => 3 do + it "it follows ftp if requested (negative test)" do Typhoeus.get( "http://localhost:#{@servers[1].port}", GitHubPages::HealthCheck.typhoeus_options.merge(:redir_protocols => %i[http https ftp])