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/python35/lib64/python3.5/site-packages/aiohttp/__pycache__/web_middlewares.cpython-35.pyc


���Zc
�@sxddlZddlmZddlmZdZdd�Zdd�Zd	d
dd
ded
d�Zdd�Z	dS)�N)�HTTPMovedPermanently)�SystemRoute�
middleware�normalize_path_middlewarec�s[|jd|�}|jjj|�IdH}||_t|jt�sQd|fSd|fS)NZrel_urlTF)Zclone�appZrouterZresolveZ_match_info�
isinstance�router)�request�pathZalt_request�
match_info�r�/web_middlewares.py�_check_request_resolves
s	
rcCs
d|_|S)N�)Z__middleware_version__)�frrr
rs	�append_slashT�
merge_slashes�redirect_classcs"t���fdd��}|S)a�
    Middleware that normalizes the path of a request. By normalizing
    it means:

        - Add 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 all enable is 1) merge_slashes, 2) append_slash
    and 3) both merge_slashes and append_slash. If the path resolves with
    at least one of those conditions, it will redirect to the new path.

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

    If merge_slashes is True, merge multiple consecutive slashes in the
    path into one.
    c�s,t|jjt�rg}d|jkrR|jjdd�\}}d|}nd}|j}�r�|jtjdd|���r�|j	j
d�r�|j|d��r��r�|jtjdd|d��xA|D]9}t||�IdH\}}|r��|j	|��q�W||�IdHS)N�?r�z//+�/)rrrrZraw_path�split�append�re�subr
�endswithr)r	�handlerZpaths_to_checkr
ZqueryZresolves)rrrrr
�impl5s(
	
z'normalize_path_middleware.<locals>.impl)r)rrrrr)rrrr
rscst�fdd��}|S)Nc	�s-|jj���||�IdHSWdQRXdS)N)rZset_current_app)r	r)rrr
rUsz&_fix_request_current_app.<locals>.impl)r)rrr)rr
�_fix_request_current_appSsr)rr)
rZaiohttp.web_exceptionsrZaiohttp.web_urldispatcherr�__all__rrrrrrrr
�<module>s3