Get SSL params for the given host.

        :param (str,int) host_and_port: the host/port pair we want SSL params for, default current_host_and_port
770377
def get_ssl(self, host_and_port=None):
        
        if not host_and_port:
            host_and_port = self.current_host_and_port

        return self.__ssl_params.get(host_and_port)
899238
def host(self, value):
        
        scheme, host, port = get_hostname_parameters_from_url(value)
        self._host = "%s://%s:%s" % (scheme, host, port)
1206474
def get_connection(self, *args, **kwargs):
        
        conn = super(SSLHTTPAdapter, self).get_connection(*args, **kwargs)
        if conn.assert_hostname != self.assert_hostname:
            conn.assert_hostname = self.assert_hostname
        return conn
663979
def get_http_connection(self, host, is_secure):
        
        self.clean()
        with self.mutex:
            key = (host, is_secure)
            if key not in self.host_to_pool:
                return None
            return self.host_to_pool[key].get()
480132
def get_server_setting(self, protocol, host='127.0.0.1', port=8000,
                           debug=False, ssl=None, sock=None, workers=1,
                           loop=None, backlog=100, has_log=True):
        ''''''

        if isinstance(ssl, dict):
            # try common aliaseses
            cert = ssl.get('cert') or ssl.get('certificate')
            key = ssl.get('key') or ssl.get('keyfile')
            if cert is None or key is None:
                raise ValueError('SSLContext or certificate and key required.')
            context = create_default_context(purpose=Purpose.CLIENT_AUTH)
            context.load_cert_chain(cert, keyfile=key)
            ssl = context

        server_settings = {
            'protocol': protocol,
            'request_handler': self.request_handler,
            'log': self.log,
            'netlog': self.netlog,
            'host': host,
            'port': port,
            'sock': sock,
            'ssl': ssl,
            'signal': self.signal,
            'debug': debug,
            'request_timeout': self.request_timeout,
            'request_max_size': self.request_max_size,
            'keep_alive': self.keep_alive,
            'loop': loop,
            'backlog': backlog,
            'has_log': has_log
        }
        for event_name, settings_name, reverse in (
                ('before_server_start', 'before_start', False),
                ('after_server_start', 'after_start', False),
                ('before_server_stop', 'before_stop', True),
                ('after_server_stop', 'after_stop', True),
        ):
            listeners = self.listeners[event_name].copy()
            if reverse:
                listeners.reverse()
            # Prepend mach9 to the arguments when listeners are triggered
            listeners = [partial(listener, self.app) for listener in listeners]
            server_settings[settings_name] = listeners

        if debug:
            self.log.setLevel(logging.DEBUG)

        # Serve
        if host and port:
            proto = 'http'
            if ssl is not None:
                proto = 'https'
            self.log.info('Goin\' Fast @ {}://{}:{}'.format(proto, host, port))
        return server_settings
744713
def _getConfiguration(self):
        
        info =configuration.getConfiguration()

        try:            
            # This returns only the parameters needed by each wrapper. E. g., for Tor:
            # {
            #    "host" : "127.0.0.1"
            #    "port" : "9150"
            # }    
            return info[self.name]
            
        except KeyError, e:
            errMsg = "ERROR. WTF! There was not found any configuration for " + self.name + " in the configuration file!"
            raise Exception( errMsg )
177507
def open(self, host, port=0):
        
        self.eof = 0
        if not port:
            port = TELNET_PORT
        self.host = host
        self.port = port
        msg = "getaddrinfo returns an empty list"
        for res in socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM):
            af, socktype, proto, canonname, sa = res
            try:
                self.sock = socket.socket(af, socktype, proto)
                self.sock.settimeout(self.connect_timeout)
                self.sock.connect(sa)
            except socket.error as msg_:
                msg = '{} => telnet://{}:{}'.format(msg_, host, port)
                if self.sock:
                    self.sock.close()
                self.sock = None
                continue
            break
        if not self.sock:
            raise socket.error(msg)
874562
def scheme_host_port_prefix(self, scheme='http', host='host',
                                port=None, prefix=None):
        """"""
        uri = scheme + '://' + host
        if (port and not ((scheme == 'http' and port == 80) or
                          (scheme == 'https' and port == 443))):
            uri += ':' + str(port)
        if (prefix):
            uri += '/' + prefix
        return uri
886830
def _get_hosts(self, host):
        
        try:
            return shlex.split(host)
        except ValueError:
            raise Exception("Unparsable host {}".format(host))
755109
def _get_options(ret=None):
    '''
    
    '''
    defaults = {'host': 'salt',
                'user': 'salt',
                'pass': 'salt',
                'db': 'salt',
                'port': 3306,
                'ssl_ca': None,
                'ssl_cert': None,
                'ssl_key': None}

    attrs = {'host': 'host',
             'user': 'user',
             'pass': 'pass',
             'db': 'db',
             'port': 'port',
             'ssl_ca': 'ssl_ca',
             'ssl_cert': 'ssl_cert',
             'ssl_key': 'ssl_key'}

    _options = salt.returners.get_returner_options(__virtualname__,
                                                   ret,
                                                   attrs,
                                                   __salt__=__salt__,
                                                   __opts__=__opts__,
                                                   defaults=defaults)
    # post processing
    for k, v in six.iteritems(_options):
        if isinstance(v, six.string_types) and v.lower() == 'none':
            # Ensure 'None' is rendered as None
            _options[k] = None
        if k == 'port':
            # Ensure port is an int
            _options[k] = int(v)

    return _options
1107826
def get_host(self, use_x_forwarded=True):
        """"""
        # We try three options, in order of decreasing preference.
        if use_x_forwarded and ('HTTP_X_FORWARDED_HOST' in self.environ):
            host = self.environ['HTTP_X_FORWARDED_HOST']
            port = self.environ.get('HTTP_X_FORWARDED_PORT')
            if port and port != ('443' if self.is_secure else '80'):
                host = '%s:%s' % (host, port)
            return host
        elif 'HTTP_HOST' in self.environ:
            host = self.environ['HTTP_HOST']
        else:
            # Reconstruct the host using the algorithm from PEP 333.
            host = self.environ['SERVER_NAME']
            server_port = str(self.environ['SERVER_PORT'])
            if server_port != ('443' if self.is_secure else '80'):
                host = '%s:%s' % (host, server_port)
        return host
350391
def host_and_port(host_or_port):
    
    if ':' in host_or_port:
        if len(host_or_port) == 1:
            return 'localhost:4200'
        elif host_or_port.startswith(':'):
            return 'localhost' + host_or_port
        return host_or_port
    return host_or_port + ':4200'
783571
def set_default_host(cls, value):
        
        if value is None:
            cls.DEFAULT_HOST = "http://127.0.0.1:80"
        else:
            scheme, host, port = get_hostname_parameters_from_url(value)
            cls.DEFAULT_HOST = "%s://%s:%s" % (scheme, host, port)
1320470
def match_https_hostname(cls, hostname):
        
        items = sorted(
            cls._entries.items(),
            key=lambda matcher_entries: matcher_entries[0].priority,
            reverse=True,
        )
        for matcher, value in items:
            if matcher.info is None:
                pattern_with_port = "https://{0}:".format(hostname)
                pattern_without_port = "https://{0}/".format(hostname)
                hostname_pattern = (
                    hostname_re
                    .match(matcher.regex.pattern)
                    .group(0)
                )
                for pattern in [pattern_with_port, pattern_without_port]:
                    if re.match(hostname_pattern, pattern):
                        return matcher

            elif matcher.info.hostname == hostname:
                return matcher
        return None
1345633
private Map<String, Object> getConnectionInfo() {
        String[] hostnames = (String[]) props.get(HOST_NAMES);
        int[] ports = (int[]) props.get(PORTS);

        String hostname = (hostnames == null || hostnames.length < 1) ? null : hostnames[0];
        String port = (ports == null || ports.length < 1) ? null : String.valueOf(ports[0]);

        return sslHelper.getConnectionInfo(hostname, port);
    }
290436
def addr(self):
        """"""
        port = self.port
        if port:
            port = int(port)
        else:
            port = default_ports.get(self.scheme or 'http')
        return (self.host, port)
888423
def host(self) -> str:
        
        host = cast(Optional[str], None)
        if self.proxy and 'X-Forwarded-Host' in self._headers:
            xhost = cast(Optional[str], self.get('X-Forwarded-Host'))
            if xhost is not None:
                host = xhost.split(",")[0].strip()
        host = host or cast(str, self.get('Host'))
        return host