def validate_redirection_target(path):
    if len(path) > REDIRECTION_PATH_LIMIT:
        return False
    parsed_url = urlparse.urlparse(path)
    for attr in ['scheme', 'netloc', 'username', 'password']:
        val = getattr(parsed_url, attr, None)
        if  val is not None and val != '':
            return False
    # Filter new lines for additional protection from Location header
    # split into two headers (should be also prevented by Django).
    return (is_canonical(parsed_url.path) and
            not '\n' in path)
Checks if login can safely redirect to a path.
dataset/ETHPy150Open wrr/wwwhisper/wwwhisper_auth/url_utils.py/validate_redirection_target