Module: SslAllowCname::MonkeyPatch

Included in:
OpenSSL::SSL::SSLContext
Defined in:
lib/ssl_allow_cname.rb

Class Method Summary collapse

Class Method Details

.verify_allow_cname(hostname, san) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ssl_allow_cname.rb', line 13

def verify_allow_cname(hostname, san)
  Array(@allow_cname).each do |test|
    case test
      when String
        return true if san == test
      when Regexp
        return true if test.match(san)
      when Proc
        result = (test.arity == 1) ? test.call(san)
                                   : test.call(san, hostname)
        return true if result
    end
  end
  return false
end

.verify_hostname(hostname, san) ⇒ Object



8
9
10
11
# File 'lib/ssl_allow_cname.rb', line 8

def verify_hostname(hostname, san)
  return @allow_cname ? verify_allow_cname(hostname, san)
                      : super
end