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/trac/web/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�k�`�&�@s�ddlmZmZddlZddlZddlmZmZddlm	Z	ddl
ZzddlmZWne
y5dZYnwdZdZdd	�ZGd
d�de�ZGdd
�d
e�ZGdd�deed�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�)�ABCMeta�abstractmethodN)�
HTTPServer�BaseHTTPRequestHandler)�ThreadingMixIn)�ForkingMixIniE'iF'cCs|jtjtjttdfvS)zrDetermines whether the exception was caused by a disconnecting client.

    :type e: IOError
    :rtype: bool
    N)�errno�EPIPE�
ECONNRESET�_WSAECONNABORTED�_WSAECONNRESET)�e�r�//usr/lib/python3/dist-packages/trac/web/wsgi.py�is_client_disconnect_exception#s�rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_ErrorsWrappercCs
||_dS�N��logfunc)�selfrrrr�__init__0s
z_ErrorsWrapper.__init__cCsdSrr�rrrr�flush3�z_ErrorsWrapper.flushcCs|�|�dSrr)r�msgrrr�write6sz_ErrorsWrapper.writecCs|D]}|�|�qdSr)r)r�seq�itemrrr�
writelines9s�z_ErrorsWrapper.writelinesN)�__name__�
__module__�__qualname__rrrrrrrrr.s
rc@s.eZdZdZd	dd�Zdd�Zdd�ZeZdS)
�_FileWrapperz'Wrapper for sending a file as response.NcCs0||_||_|jj|_t|d�r|j|_dSdS)N�close)�fileobj�	blocksize�read�hasattrr#)rr$r%rrrrAs

�z_FileWrapper.__init__cCs|Srrrrrr�__iter__Hrz_FileWrapper.__iter__cCs|j�|j�}|st�|Sr)r$r&r%�
StopIteration�r�datarrr�__next__Ksz_FileWrapper.__next__r)rr r!�__doc__rr(r,�nextrrrrr">s
r"c@sTeZdZdZdZdZdZdZeZ	e
je
jfdd�Z
dd�Zdd
d�Zedd
��Zd	S)�WSGIGatewayz1Abstract base class for WSGI servers or gateways.)�rTFcCs�|j|d<d|d<|�dd���dvrd|d<n|�dd���dkr&d|d<||d	<||d
<|j|d<|j|d<|j|d
<|jdurG|j|d<||_g|_g|_	d|_
dS)zInitialize the gateway object.zwsgi.version�httpzwsgi.url_scheme�HTTPS�)�yes�on�1�https�HTTP_X_FORWARDED_PROTOz
wsgi.inputzwsgi.errorszwsgi.multithreadzwsgi.multiprocessz
wsgi.run_onceNzwsgi.file_wrapperF)�wsgi_version�get�lower�wsgi_multithread�wsgi_multiprocess�
wsgi_run_once�wsgi_file_wrapper�environ�headers_set�headers_sent�use_chunked)rr@�stdin�stderrrrrr]s"







zWSGIGateway.__init__c	Cs�||j|j�}z<|jdurt||j�rt|d�r|�|j�n|D]	}|r*|�|�q!|jr1|j	r6|�d�Wt|d�rB|�
�dSdSt|d�rN|�
�ww)z2Start the gateway with the given WSGI application.N�	_sendfile�r#)r@�_start_responser?�
isinstancer'rFr$�_writerBrCr#)r�application�response�chunkrrr�runrs(

��
�
�
�
�zWSGIGateway.runNcCs@|rz|jr
|d�Wd}n
d}w|jrJd��||g|_|jS)z&Callback for starting a HTTP response.r0NzResponse already started)rBrArJ)r�status�headers�exc_inforrrrH�s�
zWSGIGateway._start_responsecCsdS)zcCallback for writing data to the response.

        Concrete subclasses must implement this method.Nrr*rrrrJ�szWSGIGateway._writer)rr r!r-r9r<r=r>r"r?�sysrDrErrNrHrrJrrrrr/Ts
r/)�	metaclassc@s$eZdZdd�Zdd�Zdd�ZdS)�WSGIRequestHandlercCsP|j��|_|jjs|jr|��sd|_dS|jj��}|j	|d<|j
|d<d|jvr5|j�dd�\}}n|jd}}t
j�|d�|d<||d<|��}||jd	krW||d
<|jd	|d<|j�d�|d
<|j�d�}|rr||d<|j��D].\}}|�dd���}|��}||vr�qwd||vr�|d|d|7<qw||d|<qw|S)Nr0�SERVER_PROTOCOL�REQUEST_METHOD�?r3z
iso-8859-1�	PATH_INFO�QUERY_STRINGr�REMOTE_HOST�REMOTE_ADDRzcontent-type�CONTENT_TYPE�content-length�CONTENT_LENGTH�-�_�HTTP_�,)�rfile�readline�raw_requestline�closed�
parse_request�close_connection�serverr@�copy�request_version�command�path�split�urllib�parse�unquote�address_string�client_addressrPr:�items�replace�upper�strip)rr@�	path_info�query_string�host�length�name�valuerrr�
setup_environ�sB��


z WSGIRequestHandler.setup_environc
Cspz|��}Wnty#}zd}t|�rd|_n�WYd}~nd}~ww|r6|j�||�}|�|jj�dSdS)Nr0)r~�IOErrorrrhri�gatewayrNrK)rr@r
r�rrr�handle_one_request�s����z%WSGIRequestHandler.handle_one_requestc
Csrz1zt�|�Wnty}zt|�s�WYd}~nd}~wwWd|_d|_dSWd|_d|_dSd|_d|_w)z/We need to help the garbage collector a little.N)r�finishrr�wfilerc)rr
rrrr��s ����
�
�zWSGIRequestHandler.finishN)rr r!r~r�r�rrrrrT�s-rTc@seZdZdd�Zdd�ZdS)�WSGIServerGatewayc	s(t�||�jt�fdd����|_dS)Ncs��d|�S)Nz%s)�	log_error)�x��handlerrr�<lambda>�sz,WSGIServerGateway.__init__.<locals>.<lambda>)r/rrcrr�)rr�r@rr�rr�s�
zWSGIServerGateway.__init__c
CsL|jsJd��|jjjrdSzz|jsl|j\}}|_tdd�|D��r'd|_n|jddko3|jjdk|_|jr>|�	d�n|�	d�|j�
t|dd	���|D]\}}t|t
�r_t|d
�}|j�||�qQ|j��|jr|jj�dt|�|f�WdS|jj�|�WdSty�}zt|�r�d|j_n�WYd}~dSd}~ww)
NzResponse not startedcss �|]\}}|��dkVqdS)r]N)r;)�.0�n�vrrr�	<genexpr>�s�z+WSGIServerGateway._write.<locals>.<genexpr>FrUzHTTP/1.1)zTransfer-Encoding�chunked)�
Connectionr#�zutf-8s%x
%s
r0)rAr�r�rfrB�anyrCr@�protocol_version�append�
send_response�intrI�bytes�str�send_header�end_headersr�lenrrrh)rr+rOrPr|r}r
rrrrJ�s<

�



 
���zWSGIServerGateway._writeN)rr r!rrJrrrrr��sr�c@seZdZeefdd�ZdS)�
WSGIServercCsTt�|||�||_t|t�|_ttot|t��|_||_	|j
t|j�dd�|_
dS)Nr3)�SERVER_NAME�SERVER_PORT�SCRIPT_NAME)rrrKrIrr<�boolrr=r��server_namer��server_portr@)r�server_addressrKr��request_handlerrrrrs��zWSGIServer.__init__N)rr r!r�rTrrrrrr�s�r�)�abcrrrrR�http.serverrr�socketserverr�urllib.parseror�ImportErrorrrr�objectrr"r/rTr�r�rrrr�<module>s(�FJ,

https://t.me/RX1948 - 2025