'Gets a ranked list of plaintextish port-listening vhosts matching target_name
Filter all hosts for those listening on port without using ssl.
Rank by how well these match target_name.
:param str target_name: The name to match
:param str port: port number
:returns: list of dicts containing the vhost, the matching name, and
the numerical rank
:rtype: list'

def _get_redirect_ranked_matches(self, target_name, port):

    all_vhosts = self.parser.get_vhosts()
    def _port_matches(test_port, matching_port):
        if ((matching_port == '') or (matching_port is None)):
            return (test_port == self.DEFAULT_LISTEN_PORT)
        else:
            return (test_port == matching_port)
    def _vhost_matches(vhost, port):
        found_matching_port = False
        if (len(vhost.addrs) == 0):
            found_matching_port = (port == self.DEFAULT_LISTEN_PORT)
        else:
            for addr in vhost.addrs:
                if (_port_matches(port, addr.get_port()) and (addr.ssl == False)):
                    found_matching_port = True
        if found_matching_port:
            return (not self.parser.has_ssl_on_directive(vhost))
        else:
            return False
    matching_vhosts = [vhost for vhost in all_vhosts if _vhost_matches(vhost, port)]
    return self._rank_matches_by_name_and_ssl(matching_vhosts, target_name)
