Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_http_cookies.cpython-310.pyc
o

�9jk`�@s�ddlZddlZddlmZmZddlZddlmZddlZddl	Z
ddlmZGdd�dej
�ZGdd�dej
�Zd	d
�ZedkrGe�dSdS)�N)�run_unittest�run_doctest)�cookies)�supportc@s�eZdZdd�Zdd�Ze�d�dd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$S)%�CookieTestsc
Cs�dddd�ddd�dd	d
iddd�d
d	diddd�dddiddd�dddddd�dd�d�d�g}|D]9}t��}|�|d�|�t|�|d �|�|jdd!�|d"�t|d#���D]
\}}|�||j	|�q^q3dS)$Nzchips=ahoy; vienna=finger�ahoy�finger)�chips�viennaz,<SimpleCookie: chips='ahoy' vienna='finger'>z0Set-Cookie: chips=ahoy
Set-Cookie: vienna=finger)�data�dict�repr�outputz%keebler="E=mc2; L=\"Loves\"; fudge=;"�keeblerzE=mc2; L="Loves"; fudge=;z3<SimpleCookie: keebler='E=mc2; L="Loves"; fudge=;'>z1Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=;"z
keebler=E=mc2zE=mc2z<SimpleCookie: keebler='E=mc2'>zSet-Cookie: keebler=E=mc2zkey:term=value:termzkey:termz
value:termz%<SimpleCookie: key:term='value:term'>zSet-Cookie: key:term=value:termza=b; c=[; d=r; f=h�b�[�r�h)�a�c�d�fz'<SimpleCookie: a='b' c='[' d='r' f='h'>�
)zSet-Cookie: a=bzSet-Cookie: c=[zSet-Cookie: d=rzSet-Cookie: f=hrr
)�seprr)
�joinr�SimpleCookie�load�assertEqualr
r�sorted�items�value)�self�cases�case�C�k�v�r'�-/usr/lib/python3.10/test/test_http_cookies.py�
test_basicsF������(��zCookieTests.test_basicc	Cshgd�}|D]+\}}|�|��t��}|�|�|�|dj|�Wd�n1s,wYqdS)N))za="b=\""�b=")za="b=\\"�b=\)za="b=\="zb==)za="b=\n"zb=n)z
a="b=\042"r*)z
a="b=\134"r+)z
a="b=\377"ub=ÿ)z
a="b=\400"zb=400)z	a="b=\42"zb=42)za="b=\\042"zb=\042)za="b=\\134"zb=\134)z
a="b=\\\""�b=\")za="b=\\\042"r,)za="b=\134\""r,)za="b=\134\042"r,r)�subTestrrrrr )r!r"�encoded�decodedr$r'r'r(�test_unquote?s
���zCookieTests.test_unquote�cpuc	Cs�d}dD]K}|�|��<d||d}t��}|�|�|dj}|�|dd�d�|�|dd�d	�|�t|�|d�Wd�n1sJwYqdS)
Ni@B)z\\z\134za="b=z;"r�r+���z\;)r-rrrr r�len)r!�nr.rr$r r'r'r(�test_unquote_largeWs

���zCookieTests.test_unquote_largecC�t��}|�d�|�|djd�|�|ddd�|�|ddd�|�|�dg�d�tjjd	d
dd�}|�|�	�d
|�d��tjjdd
dd�}|�|�	dg�d
|�d��dS)Nz/Customer="WILE_E_COYOTE"; Version=1; Path=/acme�Customer�
WILE_E_COYOTE�version�1�path�/acme�0Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme�/Customer="WILE_E_COYOTE"; Path=/acme; Version=1��utf-8��safe�encoding�q
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = decodeURIComponent("�8");
        // end hiding -->
        </script>
        �$Customer="WILE_E_COYOTE"; Path=/acme�
rrrrr r�urllib�parse�quote�	js_output)r!r$�cookie_encodedr'r'r(�	test_loadds 
�
��zCookieTests.test_loadcCs(t��}d|d<|�|�dg�d�dS)Nzsome,funky;stuff�valz(Set-Cookie: val="some\054funky\073stuff"�rrrr�r!r$r'r'r(�test_extended_encodes
�z CookieTests.test_extended_encodecCs�t�d�}d|dd<|�|���d��t��}|�d�|�|ddd�t��}|�d�|�|ddd	�t�d�}d
|dd<|�|��d�dS)
N�Customer="WILE_E_COYOTE"rr8�expires�GMTz3Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMTzWed, 01 Jan 2010 00:00:00 GMTz1Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMTzWed, 01 Jan 98 00:00:00 GMT�
�max-agez0Set-Cookie: Customer="WILE_E_COYOTE"; Max-Age=10)rr�
assertTruer�endswithrrrQr'r'r(�test_special_attrs�s$

�
�

�zCookieTests.test_special_attrscCs6t�d�}d|dd<d|dd<|�|��d�dS)NrSTr8�secure�httponlyz6Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; SecurerPrQr'r'r(�test_set_secure_httponly_attrs�s

�z*CookieTests.test_set_secure_httponly_attrsc	Cs�gd�}|D]B}|j|d��2t�d�}||dd<|�|��d|�t��}|�d|�|�|dd|�Wd�n1sCwYqdS)N)�Strict�Lax�strict�lax)rOrSr8�samesitez1Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=%sz%Customer="WILL_E_COYOTE"; SameSite=%s)r-rrrrr)r!�samesite_valuesrOr$r'r'r(�test_samesite_attrs�s

����zCookieTests.test_samesite_attrscC�:t��}|�d�|�|dd�|�|dd�dS)Nzeggs=scrambled; Path=/bacon�eggsr\r[)rrr�assertFalserQr'r'r(�)test_secure_httponly_false_if_not_present�s
z5CookieTests.test_secure_httponly_false_if_not_presentcCre)Nz-eggs=scrambled; httponly; secure; Path=/baconrfr\r[)rrrrXrQr'r'r(�$test_secure_httponly_true_if_present�s
z0CookieTests.test_secure_httponly_true_if_presentcCsbt��}|�d�|�|dd�|�|dd�|�|ddd�|�|ddd�dS)Nz5eggs=scrambled; httponly=foo; secure=bar; Path=/baconrfr\r[�foo�bar)rrrrXrrQr'r'r(�'test_secure_httponly_true_if_have_value�s
z3CookieTests.test_secure_httponly_true_if_have_valuecCs&t��}|�d�|�|��d�dS)Nz=eggs  =  scrambled  ;  secure  ;  path  =  bar   ; foo=foo   zASet-Cookie: eggs=scrambled; Path=bar; Secure
Set-Cookie: foo=foo)rrrrrrQr'r'r(�test_extra_spaces�s


�zCookieTests.test_extra_spacescCr7)Nz3Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"r8r9r:r;r<r=r>r?r@rArBrErFrGrH)r!r$�expected_encoded_cookier'r'r(�test_quoted_meta�s 
�
��zCookieTests.test_quoted_metacCs@t��}dD]}|�|�|�t|�i�|�|��d�qdS)N)
z]foo=xz[foo=xz
blah]foo=xz
blah[foo=xzSet-Cookie: foo=barzSet-Cookie: foozfoo=bar; bazzbaz; foo=barzsecure;foo=barzVersion=1;foo=barr@)rrrrrr)r!r$�sr'r'r(�test_invalid_cookies�s
�z CookieTests.test_invalid_cookiesc	Cs�d}d|}t��}|�|�|�|��|�ttjd�D]*}|j|d��t�	tj
||d��}|�|��|�Wd�n1sCwYqdS)Nr?zSet-Cookie: %s���proto)�protocol)rrrrr�range�pickle�HIGHEST_PROTOCOLr-�loads�dumps)r!�rawdata�expected_outputr$rt�C1r'r'r(�test_pickle�s
���zCookieTests.test_picklecCsHd}t��}|�tj��|�|�Wd�dS1swYdS)Nz
a=b; c,d=e)rr�assertRaises�CookieErrorr)r!r{r$r'r'r(�test_illegal_charss
"�zCookieTests.test_illegal_charscCsHt��}d|d<|�t|d�d�d|dd<|�t|d�d�dS)N�©rjzSet-Cookie: foo="\251"u
comment ©�commentz.Set-Cookie: foo="\251"; Comment="comment \251")rrr�str)r!rr'r'r(�test_comment_quoting
s
�z CookieTests.test_comment_quotingN)�__name__�
__module__�__qualname__r)r0r�requires_resourcer6rNrRrZr]rdrhrirlrmrorqr~r�r�r'r'r'r(rs&1


rc@sxeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�MorselTestszTests for the Morsel object.cCsht��}|�|j�|�|j�|�|j�|�|��tjj���|�	�D]\}}|�|d|�q&dS�Nr@)
r�Morsel�assertIsNone�keyr �coded_valuer�keys�	_reservedr)r!�morselr�rOr'r'r(�
test_defaultss�zMorselTests.test_defaultscCszt��}|jD]}|�|�|��d|||<q|jD]}|�||d|�qd��D]}|�tj|j	|d|�q,dS)N�%s_valuezthe holy hand grenade)
rr�r�rX�
isReservedKeyr�splitrr��__setitem__)r!�M�ir'r'r(�test_reserved_keys!s

��zMorselTests.test_reserved_keysc	Cst��}|jD]}|�tj|j|d|d|�qd��D]T}d|d<|�|d|d|�|�|j|�|�|j	d|�|�|j
d|�|�|��d|d|f�tj
jd|d|fd	d
d�}d|f}|�|��|�qd
D]}|�tj|j|d|d|�qtdS)Nr�z(thou cast _the- !holy! ^hand| +*grenade~z/foor<z%s_valz%s_coded_valzSet-Cookie: %s=%s; Path=/fooz%s=%s; Path=/foor@rArBz�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = decodeURIComponent("%s");
        // end hiding -->
        </script>
        )zfoo barzfoo@bar)rr�r�rr��setr�rr�r r�rrIrJrKrL)r!r�r�rn�expected_js_outputr'r'r(�test_setter0s8
������zMorselTests.test_settercCs�t��}|�t��d|_Wd�n1swY|�t��d|_Wd�n1s/wY|�t��d|_Wd�dS1sHwYdSr�)rr�r�AttributeErrorr�r r��r!r�r'r'r(�test_set_propertiesSs��"�zMorselTests.test_set_propertiesc		Cs�d}ddddd�}t��}|�|�|j|�t��}|�|�|j|�|�||k�|�||k�d}|D]3}|�|��$t��}|�|�|j|�|�||k�|�||k�Wd�n1sewYq7t��}|�|�|j|�d|d	<|�||k�|�||k�|�t��d
k�|�t��d
k�|�t��dk�|�t��dk�tt�����}|�t��|k�|�t��|k�t��}|j|�|�|�|�|t	|�k�|�|t	|�k�dS)N)r�r �"value"�/rj�example.com�)r<r��domainr:))r�r �mismatch)r�r�r�)r�r r�rkr�rrr@)
rr��updater�rXrgr-�listrr)	r!�	base_case�attribs�morsel_a�morsel_br"�case_brr�r'r'r(�test_eq\sT�





��



zMorselTests.test_eqcCs�t��}|�ddd�|�ddd��|��}|�|tj�|�||�|�||�t�|�}|�|tj�|�||�|�||�dS)Nrjrk�bazr��r:r�)rr�r�r��copy�assertIsInstance�assertIsNotr)r!r�r�r'r'r(�	test_copy�s�
zMorselTests.test_copycCs�t��}d|d<|�|dd�d|d<|�|dd�d|d<|�|dd�|�tj��d	|d
<Wd�n1s=wY|�d
|�dS)NrrTr��Versionr:r��DOMAINr�r �invalid)rr�rrr��assertNotInr�r'r'r(�test_setitem�s
�zMorselTests.test_setitemcCs�t��}|�ddd��|�|�dd�d�|�|dd�|�|�dd�d�|�|d	d�|�|�d
d�d�|�|dd�|�tj��|�dd�Wd�n1sYwY|�d|�dS)
Nr�r�)r�r:rTr r@r�rrr:r�r�r�)rr�r�r�
setdefaultrr�r�r�r'r'r(�test_setdefault�s��zMorselTests.test_setdefaultcCsPdddd�}t��}|�|�|�|dd�|�|dd�|�|dd�t��}|�t|����|�|dd�|�|dd�|�|dd�t��}|�dd	�|��D��|�|dd�|�|dd�|�|dd�|�tj��|�d
di�Wd�n1s�wY|�d
|�|�t	|j�|�t	|jd�dS)
Nrrr�r�)rTr�r�rTr:r�css�|]	\}}||fVqdS�Nr')�.0r%r&r'r'r(�	<genexpr>�s�z*MorselTests.test_update.<locals>.<genexpr>r�r r)
rr�r�rr�rrr�r��	TypeError)r!r�r�r'r'r(�test_update�s,
�zMorselTests.test_updatec	Cs�t��}|�ddd�|�ddd��ttjd�D]8}|j|d��(t�t�	||��}|�
|tj�|�||�|�t|�t|��Wd�n1sMwYqdS)Nrjrkr�r�r�rrrs)
rr�r�r�rvrwrxr-ryrzr�rr�)r!r�rtr�r'r'r(r~�s����zMorselTests.test_picklec	Cst��}|�t|�d�|�t|�d�|�ddd�|�t|�d�|�t|�d�|�dd	d
dddd
��|�t|�d�|�t|�d�d|d<d|d<|�t|�d�|�t|�d�t��}|�ddd�d|d<|�t|�d�|�t|�d�dS)Nz<Morsel: None=None>zSet-Cookie: None=Noner�rO�	coded_valz<Morsel: key=coded_val>zSet-Cookie: key=coded_valr�rjr�rrr)r<r�r�rWr[r:zV<Morsel: key=coded_val; Comment=foo; Domain=example.com; Max-Age=0; Path=/; Version=1>zXSet-Cookie: key=coded_val; Comment=foo; Domain=example.com; Max-Age=0; Path=/; Version=1Tr[r\zh<Morsel: key=coded_val; Comment=foo; Domain=example.com; HttpOnly; Max-Age=0; Path=/; Secure; Version=1>zjSet-Cookie: key=coded_val; Comment=foo; Domain=example.com; HttpOnly; Max-Age=0; Path=/; Secure; Version=1rTzA<Morsel: key=coded_val; expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+>zCSet-Cookie: key=coded_val; expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+)rr�rr
r�r�r��assertRegexr�r'r'r(�	test_repr�sJ�
�
�
�
�
�
�zMorselTests.test_reprc	CsLt��D�]�}t��}|�tj��d||<Wd�n1s wY|�tj��||d<Wd�n1s:wY|�tj��|�|ddd��Wd�n1sYwY|�tj��|�d|dd��Wd�n1sxwY|�tj��|�dd|d��Wd�n1s�wY|�tj��|�d|�Wd�n1s�wY|�tj��|�|d�Wd�n1s�wY|�tj��|�|dd�Wd�n1s�wY|�tj��|�d|d�Wd�n	1�s
wY|�tj��|�dd|�Wd�n	1�s(wY|�tj��|�	d|i�Wd�n	1�sFwY|�tj��|�	|di�Wd�n	1�sdwY|�tj��|d|iO}Wd�n	1�s�wY|�tj��||diO}Wd�n	1�s�wYqdS)NrOr<�coded)r�r r�r��coded-value)
r�control_characters_c0rr�rr��__setstate__r�r�r�)r!�c0r�r'r'r(�test_control_characterss\
�
���������������z#MorselTests.test_control_charactersc	Cs�t��D]b}t��}|�ddd�||_t��}||d<|�tj��|�	�Wd�n1s1wYt��}|�ddd�||_
t��}||d<|�tj��|�	�Wd�n1sawYqt��D]b}t��}|�ddd�||_t��}||d<|�tj��|��Wd�n1s�wYt��}|�ddd�||_
t��}||d<|�tj��|��Wd�n1s�wYqkdS)Nr�r r��cookie)rr�rr�r��_keyrrr�r�_coded_valuerL)r!r�r�r�r'r'r(�test_control_characters_output=sJ
�
��
�
���z*MorselTests.test_control_characters_outputN)r�r�r��__doc__r�r�r�r�r�r�r�r�r�r~r�r�r�r'r'r'r(r�s	#	4
(,r�cCsttt�tt�dSr�)rrr�rrr'r'r'r(�	test_mainds
r��__main__)�base64r��test.supportrr�unittest�httprrw�urllib.parserI�testr�TestCaserr�r�r�r'r'r'r(�<module>s$Q
�

Youez - 2016 - github.com/yon3zu
LinuXploit