github-pages-health-check 1.11.1 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e75fd3f401bba51401548e131f1bac799f8f35b76595f067e47c98ff56ef6ab5
4
- data.tar.gz: 86ec618ff3fd49ed8ce0f26cd080bd564406112965d054e88f92162b5d4dbaea
3
+ metadata.gz: 679ba9ffc25dcc84048349056269a107b8b06238593b546e4bc896fa30521d1d
4
+ data.tar.gz: 4ecaddefc7f3d1451fa481faae3b088799077603dc8e3d8793400d7434002a72
5
5
  SHA512:
6
- metadata.gz: 4c48853cbaa8deeaec595122747d60c299665b2dbce7d226d558c9c4f784ddefae3aeccb8321beb4a374b93c9efa6371e96232c7a08868a30b2c1911eac11e64
7
- data.tar.gz: 250d14363458d018f9494c75017f7df1db5bf743348477421674ae934533e30a2b586295668a3776e011dcda1dd1b4adc34a48de30df5146dc61097dae2ca016
6
+ metadata.gz: 89c5a7975632bee55c646c48093d56c319a5bf7ca9503adc2b05526691d053a5c8ac883b1608d83032193bd3da454091c4edc8f6f5401d528dfca8fc7c49b2b6
7
+ data.tar.gz: 0736ad8c4d6bb5ad484d90de791a66c806a79ac9cbeeda9c3923a7e3b7a417b144de200b7952dfe81eb0d609f2676a924cb94fb19edfebdc885e9d1f6745927d
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dnsruby"
4
+ require "addressable/idna"
4
5
  require "addressable/uri"
5
6
  require "ipaddr"
6
7
  require "public_suffix"
@@ -33,7 +33,10 @@ module GitHubPages
33
33
  end
34
34
 
35
35
  def records
36
- @records ||= (get_caa_records(host) | get_caa_records(PublicSuffix.domain(host)))
36
+ unicode_host = Addressable::IDNA.to_unicode(host)
37
+ @records ||= begin
38
+ get_caa_records(host) | get_caa_records(PublicSuffix.domain(unicode_host))
39
+ end
37
40
  end
38
41
 
39
42
  private
@@ -100,7 +100,7 @@ module GitHubPages
100
100
 
101
101
  @host = normalize_host(host)
102
102
  @nameservers = nameservers
103
- @resolver = GitHubPages::HealthCheck::Resolver.new(host,
103
+ @resolver = GitHubPages::HealthCheck::Resolver.new(self.host,
104
104
  :nameservers => nameservers)
105
105
  end
106
106
 
@@ -147,7 +147,8 @@ module GitHubPages
147
147
  # Used as an escape hatch to prevent false positives on DNS checkes
148
148
  def valid_domain?
149
149
  return @valid if defined? @valid
150
- @valid = PublicSuffix.valid?(host, :default_rule => nil)
150
+ unicode_host = Addressable::IDNA.to_unicode(host)
151
+ @valid = PublicSuffix.valid?(unicode_host, :default_rule => nil)
151
152
  end
152
153
 
153
154
  # Is this domain an apex domain, meaning a CNAME would be innapropriate
@@ -160,7 +161,8 @@ module GitHubPages
160
161
  # It's aware of multi-step top-level domain names:
161
162
  # E.g. PublicSuffix.domain("blog.digital.gov.uk") # => "digital.gov.uk"
162
163
  # For apex-level domain names, DNS providers do not support CNAME records.
163
- PublicSuffix.domain(host) == host
164
+ unicode_host = Addressable::IDNA.to_unicode(host)
165
+ PublicSuffix.domain(unicode_host) == unicode_host
164
166
  end
165
167
 
166
168
  # Should the domain use an A record?
@@ -421,8 +423,8 @@ module GitHubPages
421
423
  # Return the hostname.
422
424
  def normalize_host(domain)
423
425
  domain = domain.strip.chomp(".")
424
- host = Addressable::URI.parse(domain).host
425
- host ||= Addressable::URI.parse("http://#{domain}").host
426
+ host = Addressable::URI.parse(domain).normalized_host
427
+ host ||= Addressable::URI.parse("http://#{domain}").normalized_host
426
428
  host unless host.to_s.empty?
427
429
  rescue Addressable::URI::InvalidURIError
428
430
  nil
@@ -32,7 +32,7 @@ module GitHubPages
32
32
  end
33
33
 
34
34
  def query(type)
35
- resolver.query(domain, type).answer
35
+ resolver.query(Addressable::IDNA.to_ascii(domain), type).answer
36
36
  end
37
37
 
38
38
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitHubPages
4
4
  module HealthCheck
5
- VERSION = "1.11.1".freeze
5
+ VERSION = "1.12.0".freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-pages-health-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable