Return a tuple (request-host, effective request-host name).

    As defined by RFC 2965, except both are lowercased.
431650
def eff_request_host(request):
    
    erhn = req_host = request_host(request)
    if req_host.find(".") == -1 and not IPV4_RE.search(req_host):
        erhn = req_host + ".local"
    return req_host, erhn
232683
def with_host(self, host):
        
        # N.B. doesn't cleanup query/fragment
        if not isinstance(host, str):
            raise TypeError("Invalid host type")
        if not self.is_absolute():
            raise ValueError("host replacement is not allowed " "for relative URLs")
        if not host:
            raise ValueError("host removing is not allowed")
        host = self._encode_host(host)
        val = self._val
        return URL(
            self._val._replace(
                netloc=self._make_netloc(
                    val.username, val.password, host, val.port, encode=False
                )
            ),
            encoded=True,
        )
1321109
def target_to_hostname(target):
    

    if len(target) == 0 or len(target) > 255:
        return None
    if not re.match(r'^[\w.-]+$', target):
        return None
    return [target]
917652
def _tuple_requested(self, namespace_tuple):
        """"""
        if not isinstance(namespace_tuple[0], unicode):
            encoded_db = unicode(namespace_tuple[0])
        else:
            encoded_db = namespace_tuple[0]
        if not isinstance(namespace_tuple[1], unicode):
            encoded_coll = unicode(namespace_tuple[1])
        else:
            encoded_coll = namespace_tuple[1]

        if namespace_tuple is None:
            return False
        elif len(self._requested_namespaces) is 0:
            return True
        for requested_namespace in self._requested_namespaces:
            if  ((((requested_namespace[0]) == u'*') or
                 (encoded_db == requested_namespace[0])) and
                (((requested_namespace[1]) == u'*') or
                 (encoded_coll == requested_namespace[1]))):
                return True
        return False
177988
def get_host(self, domain_part):
        
        if self.map.host_matching:
            if domain_part is None:
                return self.server_name
            return to_unicode(domain_part, "ascii")
        subdomain = domain_part
        if subdomain is None:
            subdomain = self.subdomain
        else:
            subdomain = to_unicode(subdomain, "ascii")
        return (subdomain + u"." if subdomain else u"") + self.server_name
464188
def get_request(self):
        
        if self.hostname_entry:
            self.entries.append(self.hostname_entry)
        request = {}
        for entry in self.entries:
            sans = sorted(list(set(entry['addresses'])))
            request[entry['cn']] = {'sans': sans}
        if self.json_encode:
            return {'cert_requests': json.dumps(request, sort_keys=True)}
        else:
            return {'cert_requests': request}
450290
def get_canonical_host(self):
        
        host = self.host.lower()
        if self.port is not None:
            host = "%s:%s" % (host, self.port)
        return host
755554
def hostname(self):
        """"""
        try:
            return self.data.get('identity').get('host_name')
        except (KeyError, AttributeError):
            return self.device_status_simple('')
343055
def get_host(self, name, default=NoHostError):
        '''
        
        '''

        if name in self.hosts:
            return self.hosts[name]

        if default is NoHostError:
            raise NoHostError('No such host: {0}'.format(name))

        return default
1149004
def _resolve_resource_name(self, name):
        """"""
        if name[:4] == 'http':  # already a url
            return name
        name = name.rstrip('/').lstrip('/')
        return '%s%s/%s' % (self.scheme, self.host, name)
328721
def addr_tuple(s):
    """"""
    if "[" in s:
        # ip v6
        if (s.count("[") != 1) or (s.count("]") != 1):
            raise ValueError("Invalid IPv6 address!")
        end = s.index("]")
        if ":" not in s[end:]:
            raise ValueError("IPv6 address does specify a port to use!")
        host, port = s[1:end], s[end+1:]
        port = int(port)
        return (host, port)
    else:
        host, port = s.split(":")
        port = int(port)
        return (host, port)
531336
def get_site_name(request):
    
    urlparts = request.urlparts
    return ':'.join([urlparts.hostname, str(urlparts.port)])
162722
function getHostType(host) {
  if (net.isIPv4(host)) {
    return ATYP_V4;
  }
  if (net.isIPv6(host)) {
    return ATYP_V6;
  }
  return ATYP_DOMAIN;
}
1316272
def friendly_name(self):
        """"""
        if len(self._client.get('config').get('name')):
            return self._client.get('config').get('name')
        return self._client.get('host').get('name')
475318
def __get_request(self, host, soup):
        

        url = URLHelper.make_absolute(host, self.__trim_grave_accent(soup["action"])) if soup.has_attr("action") else host
        method_original = soup["method"] if soup.has_attr("method") else "get"
        method = "post" if method_original.lower() == "post" else "get"
        data = self.__get_form_data(soup)

        return Request(url, method, data)
899238
def host(self, value):
        
        scheme, host, port = get_hostname_parameters_from_url(value)
        self._host = "%s://%s:%s" % (scheme, host, port)
1307544
def get_host(self, domain_part):
        
        if self.map.host_matching:
            if domain_part is None:
                return self.server_name
            return to_unicode(domain_part, 'ascii')
        subdomain = domain_part
        if subdomain is None:
            subdomain = self.subdomain
        else:
            subdomain = to_unicode(subdomain, 'ascii')
        return (subdomain and subdomain + u'.' or u'') + self.server_name