https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/asgiref/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/asgiref/__pycache__/wsgi.cpython-310.pyc
o

�6�a��@sHddlmZddlmZddlmZmZGdd�d�ZGdd�d�ZdS)	�)�BytesIO)�SpooledTemporaryFile)�AsyncToSync�
sync_to_asyncc@s eZdZdZdd�Zdd�ZdS)�
WsgiToAsgizG
    Wraps a WSGI application to make it into an ASGI application.
    cCs
||_dS�N)�wsgi_application��selfr�r�./usr/lib/python3/dist-packages/asgiref/wsgi.py�__init__s
zWsgiToAsgi.__init__c�s�t|j�|||�IdHdS)z�
        ASGI application instantiation point.
        We return a new WsgiToAsgiInstance here with the WSGI app
        and the scope, ready to respond when it is __call__ed.
        N)�WsgiToAsgiInstancer)r
�scope�receive�sendrrr�__call__s�zWsgiToAsgi.__call__N)�__name__�
__module__�__qualname__�__doc__r
rrrrrrsrc@s>eZdZdZdd�Zdd�Zdd�Zd
d	d
�Zedd��Z	dS)rz;
    Per-socket instance of a wrapped WSGI application
    cCs||_d|_d|_dS)NF)r�response_started�response_content_lengthr	rrrr
s
zWsgiToAsgiInstance.__init__c�s��|ddkrtd��||_tdd��<}	|�IdH}|ddkr%td��|�|�d	d
��|�d�s4nq|�d�t|�|_|�|�IdHWd�dS1sRwYdS)
N�type�httpz&WSGI wrapper received a non-HTTP scopei)�max_sizeTzhttp.requestz0WSGI wrapper received a non-HTTP-request message�body��	more_bodyr)	�
ValueErrorrr�write�get�seekr�	sync_send�run_wsgi_app)r
rrrr�messagerrrr"s"�
�

"�zWsgiToAsgiInstance.__call__c
Cs8|d|�dd��d��d�|d�d��d�|d�d�d	|d
d|�dd
�|t�dddd�}d|vrH|dd|d<t|dd�|d<nd|d<d|d<d|vr\|dd|d<|j�dg�D]6\}}|�d�}|dkrsd}n|dkrzd}n
d|���d d!�}|�d�}||vr�||d"|}|||<qc|S)#zM
        Builds a scope and request body into a WSGI environ object.
        �method�	root_path��utf8�latin1�path�query_string�asciizHTTP/%s�http_version)�r�schemerTF)�REQUEST_METHOD�SCRIPT_NAME�	PATH_INFO�QUERY_STRING�SERVER_PROTOCOLzwsgi.versionzwsgi.url_schemez
wsgi.inputzwsgi.errorszwsgi.multithreadzwsgi.multiprocessz
wsgi.run_once�serverr�SERVER_NAMEr/�SERVER_PORT�	localhost�80�client�REMOTE_ADDR�headers�content-length�CONTENT_LENGTHzcontent-type�CONTENT_TYPEzHTTP_%s�-�_�,)r!�encode�decoder�strr�upper�replace)r
rr�environ�name�value�corrected_namerrr�
build_environ5s@

�


z WsgiToAsgiInstance.build_environNc	Cs�|jr|d�|d��t|d�r|durtd��|�dd�\}}t|�}dd�|D�}d|_|D]\}}|��d	kr@t|�|_q1d
||d�|_dS)z/
        WSGI start_response callable.
        r/��response_startNz=You cannot call start_response a second time without exc_info� cSs(g|]\}}|���d�|�d�f�qS)r-)�lowerrD)�.0rJrKrrr�
<listcomp>rs��z5WsgiToAsgiInstance.start_response.<locals>.<listcomp>r>zhttp.response.start)r�statusr=)	r�with_traceback�hasattrr�split�intrrQrO)	r
rT�response_headers�exc_info�status_coderBr=rJrKrrr�start_responsebs(��
��z!WsgiToAsgiInstance.start_responsecCs�|�|j|�}d}|�||j�D]:}|jsd|_|�|j�|jdur4|j|}t|�|kr4|d|�}|�d|dd��|t|�7}||jkrJnq|jsWd|_|�|j�|�ddi�dS)z�
        Called in a subthread to run the WSGI app. We encapsulate like
        this so that the start_response callable is called in the same thread.
        rTNzhttp.response.body)rrrr)	rMrrr\rr#rOr�len)r
rrI�
bytes_sent�output�
bytes_allowedrrrr$�s*


�
�zWsgiToAsgiInstance.run_wsgi_appr)
rrrrr
rrMr\rr$rrrrrs
- rN)	�ior�tempfiler�asgiref.syncrrrrrrrr�<module>s


https://t.me/RX1948 - 2025