(host, scheme)
return host
Normalize hosts for comparisons and use with sockets.
Normalize hosts for comparisons and use with sockets.
Normalize hosts for comparisons and use with sockets .
def _normalize_host(host, scheme):
    """
    Normalize hosts for comparisons and use with sockets.
    """

    # httplib doesn't like it when we include brackets in IPv6 addresses
    # Specifically, if we include brackets but also pass the port then
    # httplib crazily doubles up the square brackets on the Host header.
    # Instead, we need to make sure we never pass ``None`` as the port.
    # However, for backward compatibility reasons we can't actually
    # *assert* that.  See http://bugs.python.org/issue28539
    if host.startswith('[') and host.endswith(']'):
        host = host.strip('[]')
    if scheme in NORMALIZABLE_SCHEMES:
        host = normalize_host(host)
    return host
def _normalize_host ( host , scheme ) : # httplib doesn't like it when we include brackets in IPv6 addresses # Specifically, if we include brackets but also pass the port then # httplib crazily doubles up the square brackets on the Host header. # Instead, we need to make sure we never pass ``None`` as the port. # However, for backward compatibility reasons we can't actually # *assert* that.  See http://bugs.python.org/issue28539 if host . startswith ( '[' ) and host . endswith ( ']' ) : host = host . strip ( '[]' ) if scheme in NORMALIZABLE_SCHEMES : host = normalize_host ( host ) return host