def TrustRoot.parse(trust_root)
trust_root = trust_root.dup
unparsed = trust_root.dup
wildcard = (not trust_root.index('://*.').nil?)
trust_root.sub!('*.', '') if wildcard
if not wildcard and @@empty_re.match(trust_root)
proto = trust_root.split(':')[0]
port = proto == 'http' ? 80 : 443
return new(unparsed, proto, true, '', port, '/')
end
parts = TrustRoot._parse_url(trust_root)
return nil if parts.nil?
proto, host, port, path = parts
if path and !path.index('#').nil?
return nil
end
return nil unless ['http', 'https'].member?(proto)
return new(unparsed, proto, wildcard, host, port, path)
end