Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/werkzeug/sansio/__pycache__/utils.cpython-39.pyc
Ðазад
a ^�hD � @ s� d dl ZddlmZ ddlmZ ddlmZ ddlmZ e ej e ed�dd �Zde ej e ej eje ej e f ej ej e e d �dd�Zde e ej e ej e ej e e d �dd�ZdS )� N� )�_encode_idna)� SecurityError)� uri_to_iri)� url_quote)�hostname�trusted_list�returnc C s� | sdS t |t�r|g}ttd�dd�}z|| �}W n tyH Y dS 0 |D ]n}|�d�rn|dd� }d}nd}z||�}W n ty� Y dS 0 ||kr� dS |rN|�d | �rN dS qNdS ) z�Check if a host matches a list of trusted names. :param hostname: The name to check. :param trusted_list: A list of valid names to match. If a name starts with a dot it will match all subdomains. .. versionadded:: 0.9 F)r r c S s d| v r| � dd�d } t| �S )N�:� r )�rsplitr )r � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/werkzeug/sansio/utils.py� _normalize s z#host_is_trusted.<locals>._normalize�.r NT� .)� isinstance�str�bytes�UnicodeError� startswith�endswith)r r r Zhostname_bytes�refZsuffix_matchZ ref_bytesr r r �host_is_trusted s. r )�scheme�host_header�server� trusted_hostsr c C s� d}|dur|}n.|dur@|d }|d dur@|� d|d � �}| dv r`|� d�r`|dd� }n| d v r~|� d �r~|dd� }|dur�t||�s�td|�d ���|S )a$ Return the host for the given parameters. This first checks the ``host_header``. If it's not present, then ``server`` is used. The host will only contain the port if it is different than the standard port for the protocol. Optionally, verify that the host is trusted using :func:`host_is_trusted` and raise a :exc:`~werkzeug.exceptions.SecurityError` if it is not. :param scheme: The protocol the request used, like ``"https"``. :param host_header: The ``Host`` header value. :param server: Address of the server. ``(host, port)``, or ``(path, None)`` for unix sockets. :param trusted_hosts: A list of trusted host names. :return: Host, with port if necessary. :raise ~werkzeug.exceptions.SecurityError: If the host is not trusted. � Nr r r > �ws�httpz:80���> �wss�httpsz:443���zHost z is not trusted.)r r r )r r r r �hostr r r �get_host8 s r&