Your IP : 3.145.105.85


Current Path : /opt/alt/python310/lib64/python3.10/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/wsgiref/__pycache__/handlers.cpython-310.opt-2.pyc

o

6��f�T�@s�	ddlmZmZmZddlmZddlZddlZddlZgd�Z	gd�Z
gd�Zdd	�Zhd
�j
Zdd�Zd
d�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�)�FileWrapper�guess_scheme�
is_hop_by_hop)�Headers�N)�BaseHandler�
SimpleHandler�BaseCGIHandler�
CGIHandler�
IISCGIHandler�read_environ)ZMonZTueZWedZThuZFriZSatZSun)
NZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc
	Cs:t�|�\	}}}}}}}}}	dt||t|||||fS)Nz#%s, %02d %3s %4d %02d:%02d:%02d GMT)�time�gmtime�_weekdayname�
_monthname)
Z	timestampZyearZmonthZdayZhhZmmZssZwd�y�z�r�7/opt/alt/python310/lib64/python3.10/wsgiref/handlers.py�format_date_times�r>
�	PATH_INFOZREMOTE_IDENTZCONTENT_TYPEZREMOTE_USERZREQUEST_METHODZCONTENT_LENGTH�SCRIPT_NAMEZHTTPSZQUERY_STRINGZ	AUTH_TYPEcCs6t|�p|�d�p|�d�p|�d�ot|dd��S)NZHTTP_ZSSL_Z	REDIRECT_�	)�_is_request�
startswith�_needs_transcode)�krrrrs�rcCs�	t��}d}zd�d|�Wntyd}Ynwi}tj��D]S\}}t|�rqtjdkrhtj�	dd��
�}|�d�rF|�d��d�}n+|�d	�rLn%|�d
�r^d|vr^|�d��d�}n|�|d��d�}n	|�||��d�}|||<q"|S)N�surrogateescape�zutf-8�replaceZwin32�SERVER_SOFTWAREzmicrosoft-iis/�
iso-8859-1zapache/zsimplehttp/zpython/3)
�sys�getfilesystemencoding�encode�LookupError�os�environ�itemsr�platform�get�lowerr�decode)�encZescr'r�vZsoftwarerrrr"s2�

	
�
rc@s eZdZ	dZdZdZdZdZdZdZ	e
�ZeZ
eZdZdZdgZdZdZZdZdZd	Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zd:dd�Zdd�Z dd�Z!dd�Z"dd�Z#d d!�Z$d"d#�Z%d$d%�Z&d&d'�Z'd(d)�Z(d*d+�Z)d,d-�Z*d.d/�Z+d0d1�Z,d2d3�Z-d4d5�Z.d6d7�Z/d8d9�Z0dS);r)rrTFz1.0Nz500 Internal Server Error)zContent-Typez
text/plains;A server error occurred.  Please contact the administrator.rc
Csj	z|��||j|j�|_|��WdStttfy!YdSz|��WYdS|�	���N)
�
setup_environr'�start_response�result�finish_response�ConnectionAbortedError�BrokenPipeError�ConnectionResetError�handle_error�close)�selfZapplicationrrr�run�szBaseHandler.runcCs�	|j��}|_|��|��|d<|��|d<|j|d<|j|d<|��|d<|j	|d<|j
|d<|jdur=|j|d<|jrL|j
rN|�d	|j
�dSdSdS)
Nz
wsgi.inputzwsgi.errorszwsgi.versionz
wsgi.run_oncezwsgi.url_schemezwsgi.multithreadzwsgi.multiprocesszwsgi.file_wrapperr )�
os_environ�copyr'�add_cgi_vars�	get_stdin�
get_stderr�wsgi_version�
wsgi_run_once�
get_scheme�wsgi_multithread�wsgi_multiprocess�wsgi_file_wrapper�
origin_server�server_software�
setdefault)r9�envrrrr0�s





�zBaseHandler.setup_environcCs`	z|��r
|��s|jD]}|�|�q
|��Wnt|jd�r)|j���|��dS)Nr8)�result_is_file�sendfiler2�write�finish_content�hasattrr8�r9�datarrrr3�s
�
zBaseHandler.finish_responsecCs	t|j�Sr/)rr'�r9rrrrB�s
zBaseHandler.get_schemec
CsL	zt|j�}Wn
tttfyYdSw|dkr$t|j�|jd<dSdS)Nr�Content-Length)�lenr2�	TypeError�AttributeError�NotImplementedError�str�
bytes_sent�headers)r9Zblocksrrr�set_content_length�s��zBaseHandler.set_content_lengthcCs	d|jvr|��dSdS)NrR)rYrZrQrrr�cleanup_headers�s
�zBaseHandler.cleanup_headerscCsn	|rz|jr|d|d��|d��Wd}nd}w|jdur$td��||_|�|�|_|�|d�}	|jS)Nrr�zHeaders already set!ZStatus)�headers_sent�with_tracebackrY�AssertionError�status�
headers_class�_convert_string_typerL)r9r`rY�exc_info�name�valrrrr1�s�
zBaseHandler.start_responsecCs&	t|�tur	|Std�|t|����)Nz!{0} must be of type str (got {1}))�typerWr_�format�repr)r9�value�titlerrrrb�s�z BaseHandler._convert_string_typecCs�	|jrD|��r>|�d|j|jf�d��d|jvr)|�dtt����d��|j	r@d|jvrB|�d|j	�d��dSdSdSdS|�d|j�d��dS)NzHTTP/%s %s
r!ZDatez
Date: %s
ZServerzServer: %s
zStatus: %s
)
rF�client_is_modern�_write�http_versionr`r$rYrr
rGrQrrr�
send_preambles
��zBaseHandler.send_preamblecCsR	|jstd��|jst|�|_|��n	|jt|�7_|�|�|��dS)Nzwrite() before start_response())r`r_r]rSrX�send_headersrl�_flushrOrrrrLs


zBaseHandler.writecCs	dS)NFrrQrrrrK)szBaseHandler.sendfilecCs(	|js|j�dd�|��dS	dS)NrR�0)r]rYrHrorQrrrrM>s
zBaseHandler.finish_contentc	Cs�	z5t|jd�r"|j��Wd|_|_|_|_d|_d|_dSWd|_|_|_|_d|_d|_dSd|_|_|_|_d|_d|_w)Nr8rF)rNr2r8rYr`r'rXr]rQrrrr8Hs��zBaseHandler.closecCs>	|��d|_|jr|��r|��|�t|j��dSdS)NT)r[r]rFrkrnrl�bytesrYrQrrrroUs�zBaseHandler.send_headerscCs	|j}|duo
t|j|�Sr/)rE�
isinstancer2)r9�wrapperrrrrJ^szBaseHandler.result_is_filecCs	|jd��dkS)NZSERVER_PROTOCOLzHTTP/0.9)r'�upperrQrrrrkdszBaseHandler.client_is_moderncCsN	z"ddlm}|��}||d|d|d|j|�|��Wd}dSd}w)Nr)�print_exceptionrr\)�	tracebackrvr?�traceback_limit�flush)r9rcrv�stderrrrr�
log_exceptionis�
zBaseHandler.log_exceptioncCs8	|�t���|js|�|j|j�|_|��dSdSr/)	r{r"rcr]�error_outputr'r1r2r3rQrrrr7ys�zBaseHandler.handle_errorcCs&	||j|jdd�t���|jgSr/)�error_status�
error_headersr"rc�
error_body)r9r'r1rrrr|�szBaseHandler.error_outputcC�	t�r/�rVrOrrrrl�szBaseHandler._writecCr�r/r�rQrrrrp�szBaseHandler._flushcCr�r/r�rQrrrr>��zBaseHandler.get_stdincCr�r/r�rQrrrr?�r�zBaseHandler.get_stderrcCr�r/r�rQrrrr=�r�zBaseHandler.add_cgi_varsr/)1�__name__�
__module__�__qualname__r@rCrDrArFrmrGrr;rrErrarxr}r~rr`r2r]rYrXr:r0r3rBrZr[r1rbrnrLrKrMr8rorJrkr{r7r|rlrpr>r?r=rrrrr^sX


		rc@sBeZdZ		ddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdS)rTFcCs(||_||_||_||_||_||_dSr/)�stdin�stdoutrz�base_envrCrD)r9r�r�rzr'�multithread�multiprocessrrr�__init__�s
zSimpleHandler.__init__cC�|jSr/)r�rQrrrr>��zSimpleHandler.get_stdincCr�r/)rzrQrrrr?�r�zSimpleHandler.get_stderrcCs|j�|j�dSr/)r'�updater�rQrrrr=�szSimpleHandler.add_cgi_varscCs^|j�|�}|dus|t|�krdSddlm}|dt�	||d�}|s(dS|j�|�}q)Nr)�warnz9SimpleHandler.stdout.write() should not do partial writes)r�rLrS�warningsr��DeprecationWarning)r9rPr2r�rrrrl�s��zSimpleHandler._writecCs|j��|jj|_dSr/)r�ryrprQrrrrp�s
zSimpleHandler._flushN)TF)	r�r�r�r�r>r?r=rlrprrrrr�s
�

rc@seZdZ	dZdS)r	FN)r�r�r�rFrrrrr	�sr	c@�eZdZ	dZiZdd�ZdS)r
Tc	Cs(tj|tjjtjjtjt�ddd�dS)NFT�r�r�)r	r�r"r��bufferr�rzrrQrrrr�s
�zCGIHandler.__init__N�r�r�r�rAr;r�rrrrr
�s
r
c@r�)rTc	Csjt�}|�dd�}|�dd�}|d�|d�r"|t|�d�|d<tj|tjjtj	jtj
|ddd�dS)Nrrr�/FTr�)rr*rrSr	r�r"r�r�r�rz)r9r'�pathZscriptrrrr�2s
�zIISCGIHandler.__init__Nr�rrrrrs
r)�utilrrrrYrr"r&r
�__all__rrr�__contains__rrrrrr	r
rrrrr�<module>s(�<V2

?>