AlkantarClanX12

Your IP : 18.118.149.55


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

o

6��f?��@s^	dZddlmZmZmZddlmZddlZddlZddl	Z
ddlmZddl
mZddlZddlZddlZddlZgd�Zdadad	d
�Zdd�Zd
d�Zdd�Zeadadejdddfdd�Zd1dd�Zdd�Zdd�Z Gdd�d�Z!Gdd�d�Z"ejfd d!�Z#d2d"d#�Z$ejfd$d%�Z%d&d'�Z&d(d)�Z'd*d+�Z(d,d-�Z)d.d/�Z*e+d0kr�e#�dSdS)3z2.6�)�StringIO�BytesIO�
TextIOWrapper)�MappingN)�
FeedParser)�Message)�MiniFieldStorage�FieldStorage�parse�parse_multipart�parse_header�test�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�cGsZ	tjdtdd�tr ts z	ttddd�aWn	tyYnwts%tant	at|�dS)Nz7cgi.log() is deprecated as of 3.10. Use logging instead�)�
stacklevel�a�locale)�encoding)
�warnings�warn�DeprecationWarning�logfile�logfp�open�OSError�nolog�log�dolog�Zallargs�r%�*/opt/alt/python310/lib64/python3.10/cgi.py�initlog9s��r'cGs	t�||d�dS)N�
)r�write)Zfmt�argsr%r%r&r#^sr#cGs	dS�Nr%r$r%r%r&r!bsr!cCs	datrt��datadS)Nr)rr�closer'r"r%r%r%r&�closelogfsr-�&c
CsX	|durtj}t|d�r|j}nd}t|t�r|j}d|vr#d|d<|ddkr�t|d�\}}|dkr<t|||d�S|d	krYt	|d
�}t
rP|t
krPtd��|�|��
|�}	nd}	d
|vrl|	re|	d}	|	|d
}	ntjdd�r�|	ry|	d}	|	tjd}	|	|d
<nd
|vr�|d
}	ntjdd�r�tjd}	nd}	|	|d
<tjj|	||||d�S)Nrzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-data)�	separator�!application/x-www-form-urlencoded�CONTENT_LENGTH�Maximum content length exceededr�QUERY_STRINGr.�)rr3)�sys�stdin�hasattrr�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibr
Zparse_qs)
�fp�environ�keep_blank_values�strict_parsingr3r�ctype�pdictZclength�qsr%r%r&r
ysH



�r
�utf-8�replacecsx	|d�d�}d�|�}t�}|�|�z|d|d<Wn	ty&Ynwt||||ddi|d���fd	d
��D�S)N�boundary�asciiz multipart/form-data; boundary={}zCONTENT-LENGTHzContent-Lengthr/r1)�headersr�errorsrFr3csi|]}|��|��qSr%)�getlist)�.0�k�Zfsr%r&�
<dictcomp>�sz#parse_multipart.<locals>.<dictcomp>)rB�formatrZset_type�KeyErrorr	)rErJrrQr3rNrIrPr%rUr&r�s

�
�rccs��|dd�dkrg|dd�}|�d�}|dkrD|�dd|�|�dd|�drD|�d|d�}|dkrD|�dd|�|�dd|�ds(|dkrLt|�}|d|�}|��V||d�}|dd�dks	dSdS)Nr8�;r�"�\"r)�find�count�len�strip)�s�end�fr%r%r&�_parseparam�s�
((�
�rccCs�	td|�}|��}i}|D]I}|�d�}|dkrX|d|�����}||dd���}t|�dkrT|d|dkrBdkrTnn|dd�}|�dd	��d
d�}|||<q||fS)NrY�=rr8r���rZz\\�\r[)rc�__next__r\r_�lowerr^rM)�line�parts�keyrJ�p�i�name�valuer%r%r&r�s
,�rc@s>eZdZ	dZdZdZdZiZdZiZ	iZ
dd�Zdd�ZdS)rNcCs	||_||_dSr+�rnro��selfrnror%r%r&�__init__s
zMiniFieldStorage.__init__cCs	d|j|jfS)NzMiniFieldStorage(%r, %r)rp�rrr%r%r&�__repr__szMiniFieldStorage.__repr__)
�__name__�
__module__�__qualname__�filename�list�type�file�type_options�disposition�disposition_optionsrPrsrur%r%r%r&r�src@s�eZdZ	dddejdddddddfdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zd:dd�Z
d:dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZd'd(�Zd)d*�Zd+Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS);r	N�rrLrMr.cCsL	d}||_||_|
|_||_d|vr|d��}d|_|dks$|dkrPd|vr-|d}
ntjdd�r:tjd}
nd}
|
�t	�
�d�}
t|
�}|durPdd	i}|dur|i}|d
kr^d	|d<d|vrh|d|d<d|vrq|d|_d|vr{|d|d
<nt|t
tf�s�td��||_|dur�tjj|_nt|t�r�|j|_nt|d�r�t|d�s�td��||_||_|	|_t|t�s�tdt|�j��||_d|_||_di}}d|jvr�t|jd�\}}||_||_ d|_!d|vr�|d|_!d|_"d|vr�|d|_"|j"du|_#d|jv�rt|jd�\}}n|j�s|d
k�r"di}}nd	i}}||_||_$d|v�r>|d�|j|j�|_%nd|_%d}d
|jv�riz	t&|jd
�}Wn
t'�y\Ynwt(�ri|t(k�rit'd��||_)|jdu�rz|dk�rz||_d|_*|_+d|_,|d	k�r�|�-�dS|dd�dk�r�|�.|||�dS|�/�dS)Nr0r/ZHEADr7r8r�surrogateescapezcontent-typer4r1r2r5�content-lengthz?headers must be mapping or an instance of email.message.MessagerA�readlinezfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrnryz
text/plainrNr�rer6�
z
multipart/)0rGrH�max_num_fieldsr3�upper�
qs_on_postr9rC�encoderZgetpreferredencodingrr<rr�	TypeErrorrPr:r=rErr;rrQ�bytesr{rv�
outerboundary�
bytes_read�limitrr~rrnry�_binary_filer}�
innerboundaryr>r@r?�lengthrzr|�done�read_urlencoded�
read_multi�read_single)rrrErPr�rFrGrHr�rrQr�r3�methodrKZcdisprJrIZclenr%r%r&rsBs�+
�
�


�





��
zFieldStorage.__init__cCs&z|j��WdStyYdSwr+)r|r,�AttributeErrorrtr%r%r&�__del__�s
�zFieldStorage.__del__cCs|Sr+r%rtr%r%r&�	__enter__�szFieldStorage.__enter__cGs|j��dSr+)r|r,)rrr*r%r%r&�__exit__�szFieldStorage.__exit__cCs	d|j|j|jfS)NzFieldStorage(%r, %r, %r))rnryrortr%r%r&ru�s�zFieldStorage.__repr__cCst|���Sr+)�iter�keysrtr%r%r&�__iter__��zFieldStorage.__iter__cCsX|dkrt|��|jr|j�d�|j��}|j�d�|S|jdur(|j}|Sd}|S)Nror)r�r|�seekrArzrqr%r%r&�__getattr__�s

��zFieldStorage.__getattr__cCs\	|jdur
td��g}|jD]}|j|kr|�|�q|s"t|��t|�dkr,|dS|S)N�
not indexabler8r)rzr�rn�appendrXr^)rrrk�found�itemr%r%r&�__getitem__s

�zFieldStorage.__getitem__cCs4	||vr||}t|t�rdd�|D�S|jS|S)NcS�g|]}|j�qSr%�ro�rS�xr%r%r&�
<listcomp>�z)FieldStorage.getvalue.<locals>.<listcomp>�r<rzro�rrrk�defaultror%r%r&�getvalues
zFieldStorage.getvaluecCs0	||vr||}t|t�r|djS|jS|S�Nrr�r�r%r%r&�getfirst!s

zFieldStorage.getfirstcCs6	||vr||}t|t�rdd�|D�S|jgSgS)NcSr�r%r�r�r%r%r&r�1r�z(FieldStorage.getlist.<locals>.<listcomp>r�)rrrkror%r%r&rR,s
zFieldStorage.getlistcCs,	|jdur
td��ttdd�|jD���S)Nr�css�|]}|jVqdSr+�rn�rSr�r%r%r&�	<genexpr>;s�z$FieldStorage.keys.<locals>.<genexpr>)rzr��setrtr%r%r&r�7�
zFieldStorage.keyscs,	|jdur
td��t�fdd�|jD��S)Nr�c3s�|]}|j�kVqdSr+r�r��rkr%r&r�As�z,FieldStorage.__contains__.<locals>.<genexpr>)rzr��any)rrrkr%r�r&�__contains__=r�zFieldStorage.__contains__cCs	t|���Sr+)r^r�rtr%r%r&�__len__C�zFieldStorage.__len__cCs|jdur	td��t|j�S)NzCannot be converted to bool.)rzr��boolrtr%r%r&�__bool__Gs

zFieldStorage.__bool__c	Cs�	|j�|j�}t|t�std|jt|�jf��|�|j	|j
�}|jr+|d|j7}tj
j||j|j|j	|j
|j|jd�}dd�|D�|_|��dS)N�%s should return bytes, got %sr.�rrQr�r3cSsg|]	\}}t||��qSr%�r�rSrkror%r%r&r�Ysz0FieldStorage.read_urlencoded.<locals>.<listcomp>)rErAr�r<r�r@r{rvrBrrQr�rDr
�	parse_qslrGrHr�r3rz�
skip_lines)rrrK�queryr%r%r&r�Ls 
�
�zFieldStorage.read_urlencodedcCsL	|j}t|�std|f��g|_|jr4tjj|j|j|j	|j
|j|j|j
d�}|j�dd�|D��|jp9|j}|j��}t|t�sPtd|jt|�jf��|jt|�7_|��d|jkr}|r}|j��}|jt|�7_|��d|jkr}|sd|j}|dur�|t|j�8}	t�}	d}
	|j��}|
|7}
|��s�nq�|
s�n||jt|
�7_|	�|
�|j
|j��|	��}d	|vr�|d	=|jdur�dn|j|j}
||j||||||
|j
|j||j
�}|dur�|d
8}|jr�|t|j�8}|dkr�td��|j|j7_|j�|�|j �s|j|j!k�rdk�rnnnq�|�"�dS)
Nz&Invalid boundary in multipart form: %rr�css�|]
\}}t||�VqdSr+r�r�r%r%r&r�is�z*FieldStorage.read_multi.<locals>.<genexpr>r��--Tr�r�r8rzMax number of fields exceeded)#r��valid_boundaryr@rzr�rDr
r�rGrHrrQr�r3�extend�FieldStorageClass�	__class__rEr�r<r�r{rvr�r^r_rZfeedrBr,r�r�r�r�r�)rrrFrGrHZibr��klassZ
first_liner��parserZhdr_text�datarPr��partr%r%r&r�^s��

��
��
�
��(�$zFieldStorage.read_multicCs6	|jdkr|��|��n|��|j�d�dSr�)r��read_binaryr��
read_linesr|r�rtr%r%r&r��s

zFieldStorage.read_singlei cCs�	|��|_|j}|dkrN|dkrP|j�t||j��}t|t�s,t	d|jt
|�jf��|jt
|�7_|s<d|_dS|j�|�|t
|�}|dksdSdSdS)Nrr�re)�	make_filer|r�rErA�min�bufsizer<r�r@r{rvr�r^r�r))rrZtodor�r%r%r&r��s&

���zFieldStorage.read_binarycCsD	|jrt�|_|_nt�|_|_|jr|��dS|��dSr+)r�rr|�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eofrtr%r%r&r��szFieldStorage.read_linescCsz	|jdur$|j��t|�dkr$|��|_|j��}|j�|�d|_|jr/|j�|�dS|j�|�|j	|j
��dS)Ni�)r��tellr^r�r|r�r)r�rBrrQ)rrrir�r%r%r&Z__write�s


zFieldStorage.__writecCs<		|j�d�}|jt|�7_|sd|_dS|�|�q)Nr8�re)rEr�r�r^r��_FieldStorage__write)rrrir%r%r&r��s
�zFieldStorage.read_lines_to_eofc	CsB	d|j}|d}d}d}d}	|jdur#d|jkr"|kr#dS|j�d�}|jt|�7_|t|�7}|s?d|_dS|dkrI||}d}|�d�rc|rc|��}||krZdS||krcd|_dS|}|�	d	�rud	}|dd
�}d}n$|�	d�r�d}|dd�}d}n|�	d�r�d}|dd�}d}nd}d}|�
||�q)
Nr�r�Trr8r�re�
s
����
F)r�r�rEr�r�r^r��
startswith�rstrip�endswithr�)	rr�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readri�strippedlineZodelimr%r%r&r��sV
�


�z(FieldStorage.read_lines_to_outerboundarycCs�	|jr|jr	dSd|j}|d}d}	|j�d�}|jt|�7_|s+d|_dS|�d�rE|rE|��}||kr<dS||krEd|_dS|�d�}q)Nr�Tr�rer8r�)r�r�rEr�r�r^r�r_)rrr�r�r�rir�r%r%r&r�s*

�zFieldStorage.skip_linescCs$	|jr	t�d�Stjd|jdd�S)Nzwb+zw+r()r�newline)r��tempfileZ
TemporaryFilerrtr%r%r&r�+s
�zFieldStorage.make_filer+) rvrwrx�osrFrsr�r�r�rur�r�r�r�r�rRr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r%r%r%r&r	sD)
�&

E	
2r	cCs�	td�t�tjt_z't�}t�t�t|�t|�t	�dd�}|fdd�}td�|�Wnt
�Ytd�dazt�}t�t�t|�t|�WdSt
�YdS)	NzContent-type: text/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execr%r%r%r&rb^r�ztest.<locals>.fcSs
|�dSr+r%)rbr%r%r&�g`s
ztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�2)�printr9�stdout�stderrr	rrrrrrr?)rF�formrbr�r%r%r&r
Ms6
r
c	Csx|durt��\}}}ddl}t�td�|�||�|�||�}tdt�d�|dd���t�|d�f�~dS)Nrz+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>rre)	r9�exc_info�	tracebackr��	format_tb�format_exception_only�html�escape�join)r{ro�tbr�r�rzr%r%r&rts

��rc	Cs^	t|���}t�td�td�|D]}tdt�|�dt�||��qtd�t�dS)Nz<H3>Shell Environment:</H3>�<DL>�<DT>�<DD>�</DL>)�sortedr�r�r�r�)rFr�rkr%r%r&r�s 
rcCs�	t|���}t�td�|std�td�|D]-}tdt�|�ddd�||}tdt�tt|���d	�td
t�t|���qtd�t�dS)Nz<H3>Form Contents:</H3>z<P>No form fields.r�r��:� )raz<i>z</i>r�r�)r�r�r�r�r��reprr{)r�r�rkror%r%r&r�s
rc
Csn	t�td�zt��}Wnty*}ztdt�t|���WYd}~nd}~wwtt�|��t�dS)Nz#<H3>Current Working Directory:</H3>zOSError:)r�r��getcwdr r�r��str)�pwd�msgr%r%r&r�s ��
rcCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r9rCr%r%r%r&r�s


rcCs	td�dS)Na�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
)r�r%r%r%r&r�r�rcCs(ddl}t|t�rd}nd}|�||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer<r��match)r`rZ_vb_patternr%r%r&r��s

r��__main__)rLrMr.)NNNN),�__version__�iorrrZcollections.abcrr9r�Zurllib.parserDZemail.parserrZ
email.messagerr�rr�r�__all__rrr'r#r!r-r"r?rFr
rrcrrr	r
rrrrrrr�rvr%r%r%r&�<module>sZ%	
�
F:
'/
�