MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/web_middlewares.cpython-38.pyc
U

'�7`a�@sddlZddlmZmZmZmZmZmZddlm	Z	m
Z
ddlmZddl
mZddlmZdZerpdd	lmZed
�Zeeeeefd�dd
�Zeed�dd�ZeegeefZeeegeefZddde	d�eeeee
ed�dd�Zded�dd�ZdS)�N)�
TYPE_CHECKING�	Awaitable�Callable�Tuple�Type�TypeVar�)�HTTPPermanentRedirect�	_HTTPMove)�Request)�StreamResponse)�SystemRoute)�
middleware�normalize_path_middleware)�Application�_Func)�request�path�returnc�s@|j|d�}|jj�|�IdH}||_|jdkr8d|fSd|fS)N)Zrel_urlTF)Zclone�appZrouterZresolveZ_match_infoZhttp_exception)rrZalt_request�
match_info�r�J/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/web_middlewares.py�_check_request_resolvess
r)�frcCs
d|_|S)Nr)Z__middleware_version__)rrrrr srTF)�append_slash�remove_slash�
merge_slashes�redirect_class)rrrrrcs:�o�}|std��ttttd�����fdd��}|S)a�
    Middleware factory which produces a middleware that normalizes
    the path of a request. By normalizing it means:

        - Add or remove a trailing slash to the path.
        - Double slashes are replaced by one.

    The middleware returns as soon as it finds a path that resolves
    correctly. The order if both merge and append/remove are enabled is
        1) merge slashes
        2) append/remove slash
        3) both merge slashes and append/remove slash.
    If the path resolves with at least one of those conditions, it will
    redirect to the new path.

    Only one of `append_slash` and `remove_slash` can be enabled. If both
    are `True` the factory will raise an assertion error

    If `append_slash` is `True` the middleware will append a slash when
    needed. If a resource is defined with trailing slash and the request
    comes without it, it will append it automatically.

    If `remove_slash` is `True`, `append_slash` must be `False`. When enabled
    the middleware will remove trailing slashes and redirect if the resource
    is defined

    If merge_slashes is True, merge multiple consecutive slashes in the
    path into one.
    z#Cannot both remove and append slash�r�handlerrc�s0t|jjt��r"g}d|jkr:|j�dd�\}}d|}n
d}|j}�r\|�t�dd|���rz|j	�
d�sz|�|d��r�|j	�
d�r�|�|dd���r��r�|�t�dd|d���r�r�t�dd|�}|�|dd��|D]8}t�dd|�}t||�IdH\}}|r�|j|��q�||�IdHS)N�?r�z//+�/���z^//+)�
isinstancerZrouter
Zraw_path�split�append�re�subr�endswithr)rr Zpaths_to_checkrZqueryZmerged_slashesZresolves�rrrrrr�implQs0

z'normalize_path_middleware.<locals>.impl)�AssertionErrorrr�_Handlerr)rrrrZcorrect_configurationr,rr+rr)s
%
rr)rrcsttttd��fdd��}|S)Nrc
�s2|j����||�IdHW5QR�SQRXdS)N)rZset_current_app)rr �rrrr,tsz&_fix_request_current_app.<locals>.impl)rrr.r)rr,rr/r�_fix_request_current_appssr0)r(�typingrrrrrrZweb_exceptionsr	r
Zweb_requestrZweb_responserZweb_urldispatcherr
�__all__Zweb_apprr�str�boolrrr.Z_Middlewarerr0rrrr�<module>s2 ��J