Sha256: 8a91e8c76485ef70f1d5accf7260769b7803df438fc2a373b68be95e196be945
Contents?: true
Size: 824 Bytes
Versions: 2
Compression:
Stored size: 824 Bytes
Contents
require "ssl_allow_cname/version" require 'openssl' module SslAllowCname module MonkeyPatch module_function def verify_hostname(hostname, san) return @allow_cname ? verify_allow_cname(hostname, san) : super end 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 end end class OpenSSL::SSL::SSLContext attr_accessor :allow_cname prepend SslAllowCname::MonkeyPatch end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ssl_allow_cname-0.1.2 | lib/ssl_allow_cname.rb |
ssl_allow_cname-0.1.1 | lib/ssl_allow_cname.rb |