# File lib/openid/trustroot.rb, line 21
    def TrustRoot.parse(trust_root)
      return nil unless trust_root.instance_of?(String)    

      trust_root = trust_root.dup      
      unparsed = trust_root.dup

      # look for wildcard
      wildcard = (not trust_root.index('://*.').nil?)
      trust_root.sub!('*.', '') if wildcard

      # handle http://*/ case
      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
      
      return nil unless ['http', 'https'].member?(proto)
      return new(unparsed, proto, wildcard, host, port, path)
    end