403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python313/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python313/Lib/test/__pycache__/test_urllib2_localnet.cpython-313.opt-1.pyc
�

��i�c��J�SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKJr SSK
Jr SSK
Jr SSKJr SSKr\R("SS9 \R*R-\5r\R*R3\SS	5r\R*R3\SS
5r"SS\R8R:5r"S
S\R>5r "SS5r!"SS\R8RD5r#"SS\R8RD5r$"SS\	RJ5r&\RN"SSS9"SS\	RJ55r(Sr)"SS\	RJ\5r*Sr+\,S:Xa\	RZ"5 gg!\a SrGN_f=f) �N)�support)�hashlib_helper)�threading_helper)�ExtraAssertionsT)�module�certdatazkeycert.pemzkeycert2.pemc�$�\rSrSrSrSrSrSrg)�LoopbackHttpServer� zVHTTP server w/ a few modifications that make it useful for
loopback testing purposes.
c��[RRRUUU5 URRS5 g)Ng�������?)�http�server�
HTTPServer�__init__�socket�
settimeout)�self�server_address�RequestHandlerClasss   �/C:\Python313\\Lib\test\test_urllib2_localnet.pyr�LoopbackHttpServer.__init__%s6�������'�'��(6�(;�	=�	
�����s�#�c�b�URR5upURS5 X4$)zHTTPServer method, overridden.g$@)r�acceptr)r�request�client_addresss   r�get_request�LoopbackHttpServer.get_request.s2��#'�+�+�"4�"4�"6���
	���4� ��(�(r�N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__rr�__static_attributes__rrrr
r
 s���$�
)rr
c�*�\rSrSrSrSrSrSrSrg)�LoopbackHttpServerThread�:z2Stoppable thread that runs a loopback http server.c���[RRU5 SUl[R"5UlSUl[SU5UlURRUl
g)NFzHTTP/1.0)z	127.0.0.1r)�	threading�Threadr�_stop_server�Event�ready�protocol_versionr
�httpd�server_port�port�r�request_handlers  rr�!LoopbackHttpServerThread.__init__=sW�����!�!�$�'�!����_�_�&��
�+5��(�'�(8�(7�9��
��J�J�*�*��	rc�f�SUlUR5 URR5 g)z.Stops the webserver if it's currently running.TN)r,�joinr0�server_close�rs r�stop�LoopbackHttpServerThread.stopFs%��!����	�	���
�
���!rc��URR5 UR(d.URR	5 UR(dM-gg�N)r.�setr,r0�handle_requestr9s r�run�LoopbackHttpServerThread.runNs7���
�
�����#�#��J�J�%�%�'��#�#�#r)r,r0r2r.N)	r r!r"r#r$rr:r@r%rrrr'r':s��<�+�"�(rr'c�N�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
Srg
)�DigestAuthHandler�Uz-Handler for performing digest authentication.c�J�SUl/Ul0UlSUlSUlg)Nrz
Test Realm�auth)�_request_num�_nonces�_users�_realm_name�_qopr9s rr�DigestAuthHandler.__init__Xs'�����������'�����	rc��Xlgr=)rK)r�qops  r�set_qop�DigestAuthHandler.set_qop_s���	rc��Xlgr=)rI)r�userss  r�	set_users�DigestAuthHandler.set_usersbs���rc��Xlgr=)rJ)r�realms  r�	set_realm�DigestAuthHandler.set_realmfs�� �rc���U=RS-
sl[R"[UR5R	S55R5nURRU5 U$)N��ascii)rG�hashlib�md5�str�encode�	hexdigestrH�append)r�nonces  r�_generate_nonce�!DigestAuthHandler._generate_nonceisW�����Q������C�� 1� 1�2�9�9�'�B�C�M�M�O�������E�"��rc��URS5nXS-SnURS5n0nUHRnURS5upgUR5nUSS:XaUSS:XaUSSnOUR5nXtU'MT U$)N� rZ�,�=r�"���)�find�split�strip)r�auth_str�first_space_index�parts�	auth_dict�part�name�values        r�_create_auth_dict�#DigestAuthHandler._create_auth_dictos���$�M�M�#�.���a�/�0�1�����s�#���	��D��*�*�S�/�K�D��:�:�<�D��Q�x�3��5��9��#3��a�������
��#�d�O���rc��0nURU5 X%S'X5S'XES'SU-n[R"URS55R	5nSU-n[R"URS55R	5n	XuS'X�S'S	U-n
[R"U
RS55R	5nX�S
:H$)N�password�method�uriz#%(username)s:%(realm)s:%(password)sr[z%(method)s:%(uri)s�HA1�HA2z3%(HA1)s:%(nonce)s:%(nc)s:%(cnonce)s:%(qop)s:%(HA2)s�response)�updater\r]r_r`)rrqrxryrz�
final_dict�HA1_strr{�HA2_strr|�response_strr}s            r�_validate_auth� DigestAuthHandler._validate_auth�s����
����)�$�!)�:��%�8���5��7�*�D���k�k�'�.�.��1�2�<�<�>��&��3���k�k�'�.�.��1�2�<�<�>���5���5��4�6@�A���;�;�|�2�2�7�;�<�F�F�H���Z�0�0�0rc
�$�URSS5 URSS5 URSSUR<SUR<SUR	5<S	35 UR5 URRS
5 g)Ni�zProxy Authentication Required�Content-Type�	text/htmlzProxy-AuthenticatezDigest realm="z", qop="z	",nonce="z", sProxy Authentication Required.F)�
send_response�send_headerrJrKrc�end_headers�wfile�writer3s  r�_return_auth_challenge�(DigestAuthHandler._return_auth_challenge�s}���%�%�c�+J�K��#�#�N�K�@��#�#� ��
�
�t�y�y�$�*>�*>�*@�#B�	C�	�#�#�%����#�#�$E�F�rc��[UR5S:XagSUR;aURU5$UR	URS5nUSUR;aURUSnOURU5$URS5UR;aURU5$URRUS5 SnURUR4H*nURUUURU5(dM(SnM, U(dURU5$g)z�Performs digest authentication on the given HTTP request
handler.  Returns True if authentication was successful, False
otherwise.

If no users have been set, then digest auth is effectively
disabled and this method will always return True.
rTzProxy-Authorization�usernamerbF)�lenrI�headersr�ru�getrH�remove�path�
short_pathr��command)rr4rqrx�auth_validatedr�s      rr?� DigestAuthHandler.handle_request�s1���t�{�{��q� �� ��(?�(?�?��.�.��?�?��.�.��'�'�(=�>��I���$����3��;�;�	�*�(=�?���2�2�?�C�C��=�=��)�T�\�\�9��2�2�?�C�C����#�#�I�g�$6�7�"�N�)�-�-��/I�/I�J���&�&�y�'/�'6�'>�'>�'+�-�-�&*�N�K�"��2�2�?�C�C�r)rHrKrJrGrIN)r r!r"r#r$rrOrSrWrcrur�r�r?r%rrrrCrCUs2��7����!���"1�$
�*rrCc��\rSrSrSrSrSrSr\<S\<3r\	R"\RS55RS5r
SrS	rS
rSrSrS
rg)�BasicAuthHandler��z,Handler for performing basic authentication.�testUser�testPass�Test�:r[c�`�[RRR"U/UQ70UD6 gr=)r
r�BaseHTTPRequestHandlerr)r�args�kwargss   rr�BasicAuthHandler.__init__�s$�����*�*�3�3�D�J�4�J�6�Jrc��gr=r�r�formatr�s   r�log_message�BasicAuthHandler.log_message�s��rc�j�URS5 URSS5 UR5 g)N���Content-typer�)r�r�r�r9s r�do_HEAD�BasicAuthHandler.do_HEAD�s,�����3�������5����rc��URS5 URSSUR-5 URSS5 UR5 g)Ni�zWWW-AuthenticatezBasic realm="%s"r�r�)r�r��REALMr�r9s r�do_AUTHHEAD�BasicAuthHandler.do_AUTHHEAD�sG�����3�����+�-A�D�J�J�-N�O������5����rc��URRSS5(d,UR5 URR	S5 gURRSS5SUR
-:Xa=UR
S5 UR5 URR	S5 gUR5 g)N�
Authorization�sNo Auth header receivedzBasic r�sIt works)r�r�r�r�r��ENCODED_AUTHr�r�r9s r�do_GET�BasicAuthHandler.do_GET�s����|�|�����4�4������J�J���7�8�
�\�\�
�
���%�(0�4�3D�3D�(D�E����s�#������J�J���[�)�
���rrN)r r!r"r#r$�USER�PASSWDr��USER_PASSWD�base64�	b64encoder_�decoder�rr�r�r�r�r%rrrr�r��s^��6��D�
�F��E�!�6�*�K��#�#�K�$6�$6�w�$?�@�G�G��P�L�K�
��
�rr�c�*�\rSrSrSrSrSrSrSrg)�FakeProxyHandler�z�This is a 'fake proxy' that makes it look like the entire
internet has gone down due to a sudden zombie invasion.  It main
utility is in providing us with authentication support for
testing.
c�l�Xl[RRR"U/UQ70UD6 gr=)�digest_auth_handlerr
rr�r)rr�r�r�s    rr�FakeProxyHandler.__init__s,��$7� ����*�*�3�3�D�J�4�J�6�Jrc��gr=rr�s   rr��FakeProxyHandler.log_messages��	
rc��[RRURS5upp4pVX0lUR
R
U5(a�URSS5 URSS5 UR5 URR[SUR-S55 URRS5 gg)	Nr
r��OKr�r�zYou've reached %s!<BR>r[sFOur apologies, but our server is down due to a sudden zombie invasion.)
�urllib�parse�urlparser�r�r�r?r�r�r�r�r��bytes)r�scm�netlocr��params�query�fragments       rr��FakeProxyHandler.do_GETs���7=�|�|�7L�7L��I�I�v�8�4��d�E����#�#�2�2�4�8�8����s�D�)����^�[�9������J�J���U�#;�d�i�i�#G�#*�,�
-��J�J���:�
;�
9r)r�r�N)	r r!r"r#r$rr�r�r%rrrr�r��s���K�
�
;rr�c�V^�\rSrSrSrSrSrSrU4SjrSr	U4Sjr
S	rS
rSr
U=r$)�BasicAuthTestsir�r��	Incorrectr�c�>>�[[U]5 Sn[U5UlURUR5 SURR-UlURR5 URRR5 g)Nc��[U0UD6$r=)r�)r�r�s  r�#http_server_with_basic_auth_handler�ABasicAuthTests.setUp.<locals>.http_server_with_basic_auth_handler$s��#�T�4�V�4�4rzhttp://127.0.0.1:%s)�superr��setUpr'r�
addCleanup�stop_serverr2�
server_url�startr.�wait)rr��	__class__s  �rr��BasicAuthTests.setUp!sp���
�n�d�)�+�	5�.�/R�S�������(�(�)�/�$�+�+�2B�2B�B���������������� rc�F�URR5 SUlgr=�rr:r9s rr��BasicAuthTests.stop_server,�����������rc�*>�[[U]5 gr=)r�r��tearDown)rr�s �rr��BasicAuthTests.tearDown0s���
�n�d�,�.rc�&�[RR5nURURUR
URUR5 [RR[RRU55 UR[RRUR
55 g![RRa! URSUR
-5 gf=f)Nz!Basic auth failed for the url: %s)r�r�HTTPBasicAuthHandler�add_passwordr�r�r�r��install_opener�build_opener�
assertTrue�urlopen�error�	HTTPError�fail)r�ahs  r�test_basic_auth_success�&BasicAuthTests.test_basic_auth_success3s���
�^�^�
0�
0�
2��
����
�
�D�O�O�T�Y�Y����L����%�%�f�n�n�&A�&A�"�&E�F�	M��O�O�F�N�N�2�2�4�?�?�C�D���|�|�%�%�	M��I�I�9�D�O�O�K�L�	M�s�8C�<D�Dc�<�[RR5nURURUR
URUR5 [RR[RRU55 UR[RR5n[RRUR
5 SSS5 WRR5 g!,(df   N)=fr=)r�rr�r�r�r�r��INCORRECT_PASSWDr�r��assertRaisesr�r�r��	exception�close)rr��cms   r�test_basic_auth_httperror�(BasicAuthTests.test_basic_auth_httperror<s���
�^�^�
0�
0�
2��
����
�
�D�O�O�T�Y�Y��@U�@U�V����%�%�f�n�n�&A�&A�"�&E�F�
�
�
�v�|�|�5�5�
6�"��N�N�"�"�4�?�?�3�7�
������7�
6�s�*D
�
D)rr�)r r!r"r#r�r�r�r�r�r�r�r�r�r%�
__classcell__�r�s@rr�r�s7����D�
�F�"���E�	!��/�M��rr�r])�opensslc�V^�\rSrSrSrSrSrSrU4SjrSr	Sr
S	rS
rSr
SrU=r$)
�ProxyAuthTestsiEzhttp://localhost�tester�test123�	TestRealmc�>^�[[T]5 SnTRU[R
R
55 S[R
S'S[R
S'[5TlTRRTRTR05 TRRTR5 U4Sjn[U5TlTRTR 5 TRR#5 TRR$R'5 STRR(-n[*R,R/SU05n[*R,R15Tl[*R,R5UTR25Tlg)Nc�~�[RR5 [RRU5 gr=��os�environ�clearr~��old_environs r�restore_environ�-ProxyAuthTests.setUp.<locals>.restore_environP�$���J�J�����J�J���k�*rr��NO_PROXY�no_proxyc�6>�[TR/UQ70UD6$r=)r�r�)r�r�rs  �r�create_fake_proxy_handler�7ProxyAuthTests.setUp.<locals>.create_fake_proxy_handler[s���#�D�$<�$<�N�t�N�v�N�Nrzhttp://127.0.0.1:%dr
)r�rr�r�rr�copyrCr�rSr�r�rWr�r'rr�r�r.r�r2r�r�ProxyHandler�ProxyDigestAuthHandler�proxy_digest_handlerr��opener)rrr�	proxy_url�handlerr�s`    �rr��ProxyAuthTests.setUpMs@���
�n�d�)�+�	+�	
���������):�;�!#��
�
�:��!#��
�
�:��#4�#6�� �� � �*�*�D�I�I�t�{�{�+C�D�� � �*�*�4�:�:�6�	O�/�/H�I�������(�(�)�������������� �)�D�K�K�,<�,<�<�	��.�.�-�-�v�	�.B�C��$*�N�N�$I�$I�$K��!��n�n�1�1��T�.�.�0��rc�F�URR5 SUlgr=r�r9s rr��ProxyAuthTests.stop_serverhr�rc���URRURURURUR
S-5 URRS5 UR[RR5nURRUR5 SSS5 WRR5 g!,(df   N)=f)N�badrF)rr�r��URLr�r�r�rOr�r�r�r�r�openr�r��rr�s  r�-test_proxy_with_bad_password_raises_httperror�<ProxyAuthTests.test_proxy_with_bad_password_raises_httperrorls����!�!�.�.�t�z�z�4�8�8�/3�y�y�$�+�+�e�:K�	M�� � �(�(��0�
�
�
�v�|�|�5�5�
6�"��K�K���T�X�X�&�7�
������7�
6�s�&C�
C%c�>�URRS5 UR[RR
5nURRUR5 SSS5 WRR5 g!,(df   N)=f�NrF)r�rOr�r�r�r�rr%r$r�r�r&s  r�,test_proxy_with_no_password_raises_httperror�;ProxyAuthTests.test_proxy_with_no_password_raises_httperrortsd��� � �(�(��0�
�
�
�v�|�|�5�5�
6�"��K�K���T�X�X�&�7�
������7�
6�s�&B�
Bc��URRURURURUR
5 URRS5 URRUR5nUR5(aUR5(aMSSS5 g!,(df   g=fr*)rr�r�r$r�r�r�rOrr%�read�r�results  r�test_proxy_qop_auth_works�(ProxyAuthTests.test_proxy_qop_auth_workszs����!�!�.�.�t�z�z�4�8�8�/3�y�y�$�+�+�	G�� � �(�(��0�
�[�[�
�
�d�h�h�
'�6��+�+�-�-���+�+�-�-�(�
'�
'�s�,B>�>
Cc���URRURURURUR
5 URRS5 URRUR5nU UR5(aUR5(aMSSS5 g!,(df   g=f![RRa gf=f)Nzauth-int)rr�r�r$r�r�r�rOrr%r.r�r��URLErrorr/s  r�0test_proxy_qop_auth_int_works_or_throws_urlerror�?ProxyAuthTests.test_proxy_qop_auth_int_works_or_throws_urlerror�s����!�!�.�.�t�z�z�4�8�8�/3�y�y�$�+�+�	G�� � �(�(��4�
	��[�[�%�%�d�h�h�/�F���k�k�m�m���k�k�m�m�����
�|�|�$�$�	�
�		�s�#%C�
,C�
C�C3�2C3)r�rrr)r r!r"r#r$r�r�r�r�r�r'r+r1r5r%rrs@rrrEs:���
�C��D�
�F��E�0�6�����rrc�X^^�"UU4SjS[RR5mT$)Nc�F>�\rSrSrSr/r/rSrSrSr	UU4Sjr
SrSrg	)
�1GetRequestHandler.<locals>.FakeHTTPRequestHandleri�z	TestHTTP/�Pc��UR5nU(a)URRU5nXSnU(aM(ggr=)�	send_headr�r�)r�body�dones   rr��8GetRequestHandler.<locals>.FakeHTTPRequestHandler.do_GET�s5���>�>�#�D���z�z�'�'��-���E�{���$rc��URSnURR[U55nUR	5 UR
R
U5 g)NzContent-Length)r��rfiler.�intr��requestsra)r�content_length�	post_datas   r�do_POST�9GetRequestHandler.<locals>.FakeHTTPRequestHandler.do_POST�sC��!�\�\�*:�;�N��
�
����N�(;�<�I��K�K�M��M�M� � ��+rc�>�URTlURRUR5 TRS5upnUR
U5 UH%upEURXESUR0-5 M' U(a$URSS5 UR5 U$UR5 g)Nrr2r�z
text/plain)
r��headers_receivedrCrar��popr�r�r2r�)r�
response_coder�r=�headerrt�FakeHTTPRequestHandler�	responsess      ��rr<�;GetRequestHandler.<locals>.FakeHTTPRequestHandler.send_head�s����6:�l�l�"�3��M�M� � ����+�+4�=�=��+;�(�M�D����}�-�#*���� � ��&����1C�)C�D�$+��� � ���>�� � �"������rc��gr=r)rr�s  rr��=GetRequestHandler.<locals>.FakeHTTPRequestHandler.log_message�s��rrN)
r r!r"r#�server_versionrCrIr2r�rFr<r�r%)rMrNs��rrMr9�s,���$��������	#�	,�
	�	rrM)r
rr�)rNrMs`@r�GetRequestHandlerrS�s'���#�#����!C�!C�#�L"�!rc�^�\rSrSrSrU4SjrSSjrSrSSjrSSjr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrSrSrSrSrSrU=r$)�TestUrlopeni�a:Tests urllib.request.urlopen using the network.

These tests are not exhaustive.  Assuming that testing using files does a
good job overall of some of the basic interface features.  There are no
tests exercising the optional 'data' and 'proxies' arguments.  No tests
for transparent redirection have been written.
c�*>�[[U]5 UR[R
R5 SnURU[RR55 S[RS'S[RS'g)Nc�~�[RR5 [RRU5 gr=r
rs rr�*TestUrlopen.setUp.<locals>.restore_environ�rr�*rr)
r�rUr�r�r�r�
urlcleanuprrr)rrr�s  �rr��TestUrlopen.setUp�sd���
�k�4�&�(�	
������1�1�2�	+�	
���������):�;�!$��
�
�:��!$��
�
�:�rc��/n[RR"X40UD6nURUR	S55 URUR
55 URURS55 URUR55 UR5 SRU5$!UR5 f=f)Nr�ir)
r�rr��extend�	readlinesra�readliner.r�r7)r�url�datar��l�fs      rr��TestUrlopen.urlopen�s������N�N�"�"�3�7��7��	�
�H�H�Q�[�[��%�&�
�H�H�Q�Z�Z�\�"�
�H�H�Q�V�V�D�\�"�
�H�H�Q�V�V�X��
�G�G�I��x�x��{���
�G�G�I�s�A>C�Cc�F�URR5 SUlgr=r�r9s rr��TestUrlopen.stop_server�r�rc�8�UcS/S4/n[U5n[U5UlURUR5 URR5 URRR5 URRnX2lU$)Nr�s
we don't care)	rSr'rr�r�r�r.r�r2)rrNrr2s    r�start_server�TestUrlopen.start_server�s�����r�#3�4�5�I�#�I�.��.�w�7�������(�(�)�������������� ��{�{�������rc���[[RS5(dURS5 SSKJn UcS/S4/n[
U5nU"U4SU0UD6nURUlU$)N�HTTPSHandlerzssl support requiredr)�make_https_serverr��
we care a bit�
handler_class)�hasattrr�r�skipTest�test.ssl_serversrlrSr2)rrNr�rlrrs      r�start_https_server�TestUrlopen.start_https_server�sg���v�~�~�~�6�6��M�M�0�1�6����r�#3�4�5�I�#�I�.��"�4�I�w�I�&�I���{�{����rc���SnSS/S4S/U4/nURU5nURSUR-5nURXA5 URURSS/5 g)	NsWe got here...i.)�Locationz(http://localhost:%(port)s/somewhere_elser�r��http://localhost:%s/�/z/somewhere_else�rhr�r2�assertEqualrC)r�expected_responserNrras     r�test_redirection�TestUrlopen.test_redirection�s��-��
�K�L�
�
�
�"�'�(�
�	��#�#�I�.���|�|�2�W�\�\�A�B������1�����)�)�C�1B�+C�Drc��SnSnSS/U4/nURU5nURSUR-5nURXQ5 g)Nshello worldsa
hello worl
1
d
0
r�)zTransfer-Encoding�chunkedrv)rhr�r2ry)rrz�
chunked_startr}rras      r�test_chunked�TestUrlopen.test_chunkeds]��*��!�	��;�<�m�L�M���#�#�H�-���|�|�2�W�\�\�A�B������1rc��SnURS/U4/5nURSUR-5 URS5 URWU5 URURS/5 g![R
Ra*nUR5nUR5 SnANsSnAff=f)NsBad bad bad...i�zhttp://localhost:%s/weeblez404 should raise URLErrorz/weeble)rhr�r2r�r�r�r4r.r�ryrC)rrzrrcras     r�test_404�TestUrlopen.test_404s���-���#�#�c�2�/@�%A�$B�C��	3��L�L�5����D�E�

�I�I�1�2�����0�1�����)�)�I�;�7���|�|�$�$�	��6�6�8�D�
�G�G�I�I��	�s�A8�8C� B;�;Cc���SnURS/U4/5nURSUR-5nURX15 URURS/5 g)N�
pycon 2008...r��http://localhost:%s/bizarre�/bizarrerx�rrzrras    r�test_200�TestUrlopen.test_200(sa��,���#�#�c�2�/@�%A�$B�C���|�|�9�G�L�L�H�I������1�����)�)�J�<�8rc���SnURS/U4/5nURSUR-S5nURX15 URURSS/5 g)Nr�r�r�sget=with_feelingr�rxr�s    r�test_200_with_parameters�$TestUrlopen.test_200_with_parameters/sj��,���#�#�c�2�/@�%A�$B�C���|�|�9�G�L�L�H�0�2������1�����)�)�J�8K�+L�Mrc��UR5n[R"[S9nUR	SUR
-US9nUR
US5 g)N��cafilezhttps://localhost:%s/bizarre��contextrm)rr�ssl�create_default_context�CERT_localhostr�r2ry)rrr�ras    r�
test_https�TestUrlopen.test_https7sN���)�)�+���,�,�N�C���|�|�:�W�\�\�I�SZ�|�[������/�0rc�^�[cURS5 [R(dURS5 SmU4Sjn[R"[R5nURU5 UR
U[S9n[R"[S9nURSUR-US9 URTS5 g)	Nzssl module requiredzSNI support required in OpenSSLc�
>�Umgr=r)�ssl_sock�server_name�initial_context�sni_names   �r�cb_sni�*TestUrlopen.test_https_sni.<locals>.cb_sniCs���"�Hr)r��certfiler�zhttps://localhost:%sr��	localhost)r�rp�HAS_SNI�
SSLContext�PROTOCOL_TLS_SERVER�set_servername_callbackrrr�r�r�r2ry)rr�r�rr�s    @r�test_https_sni�TestUrlopen.test_https_sni=s�����;��M�M�/�0��{�{��M�M�;�<���	#��.�.��!8�!8�9���'�'��/��)�)�'�N�)�S���,�,�N�C�����+�g�l�l�:�G��L�����;�/rc�0�UR5n[RRSUR-SS0S9n[RRU5 SSS5 UR
URSS5 g!,(df   N.=f)Nrv�Rangezbytes=20-39�r�)rhr�r�Requestr2r�ryrI�rr�reqs   r�test_sending_headers� TestUrlopen.test_sending_headersMs|���#�#�%���n�n�$�$�%;�g�l�l�%J�.5�}�-E�%�G��
�^�^�
#�
#�C�
(��)�����1�1�'�:�M�J�)�
(�s�B�
Bc��UR5n[RRSUR-SS0S9n[RRU5 SSS5 UR
SURR55 URSURR55 g!,(df   Nc=f)Nrvz
X-SoMe-hEader�foobarr�z
X-Some-Header)
rhr�rr�r2r��assertInrI�keys�assertNotInr�s   r�test_sending_headers_camel�&TestUrlopen.test_sending_headers_camelUs����#�#�%���n�n�$�$�%;�g�l�l�%J�.=�x�-H�%�J��
�^�^�
#�
#�C�
(��)��
�
�o�w�'?�'?�'D�'D�'F�G�����'�*B�*B�*G�*G�*I�J�)�
(�s�B<�<
C
c�$�UR5n[RRSUR-5nSHnURX#5 M UR
UR5S5 SSS5 g!,(df   g=f)N�http://localhost:%s)r.r��info�geturlzcalling 'read' failed)rhr�rr�r2�
assertHasAttrr�r.)rr�open_url�attrs    r�
test_basic�TestUrlopen.test_basic^sh���#�#�%��
�^�^�
#�
#�$9�G�L�L�$H�
I�X�;���"�"�8�2�<��O�O�H�M�M�O�-D�E�J�
I�
I�s�;B�
Bc�j�UR5n[RRSUR-5nU UR5nSSS5 UR
W[RRS5 URUR5S5 g!,(df   NZ=f)Nr�zEobject returned by 'info' is not an instance of email.message.Message�plain)rhr�rr�r2r��assertIsInstance�email�message�Messagery�get_content_subtype)rrr��info_objs    r�	test_info�TestUrlopen.test_infoes����#�#�%���>�>�)�)�!�G�L�L�0�2��
��}�}��H�����h��
�
�(=�(=�B�	C�	
����5�5�7��A��X�s�B$�$
B2c��UR5n[RRSUR-5nU UR5nSSS5 UR
WSUR-5 g!,(df   N.=f)Nr�)rhr�rr�r2r�ry)rrr�r`s    r�test_geturl�TestUrlopen.test_geturlpsd���#�#�%���>�>�)�)�*?�'�,�,�*N�O��
��/�/�#�C������3�g�l�l�B�C��X�s�A8�8
Bc��SnURS/U4/5n[RRSUR-5nUHnURXA5 M g)Nr�r�r�)rhr�rr�r2ry)rrzrra�lines     r�test_iteration�TestUrlopen.test_iterationxsY��,���#�#�c�2�/@�%A�$B�C���~�~�%�%�&;�g�l�l�&J�K���D����T�5�rc
��SSSSS-S-/nSRU5nURS/U4/5n[RR	S	UR
-5n[
U5H:upVURXaUS
U<S[X5<S[U5<35 M< URWS
-[U55 g)NsWe
sgot
shere
s	verylong i �
rr�r�zFetched line number z1 doesn't match expected:
    Expected length was z, got rZ)	r7rhr�rr�r2�	enumerateryr�)r�linesrzrra�indexr�s       r�test_line_iteration�TestUrlopen.test_line_iterations����(�I�|�d�/B�U�/J�K���H�H�U�O���#�#�c�2�/@�%A�$B�C���~�~�%�%�&;�g�l�l�&J�K��$�T�?�K�E����T��<�$�S���%6��D�	�C�
D�+�
	
������C��J�/rc�z�URS/S4S/S4/5n[RR5n[RR	SUR
-5nUR
SUR5 URUSRS55 UR
SUR5 UR
SURS55 URUSRS55 UR
S	UR5 UR
S
URS55 g)Nr�sanyr��1zus-ascii�1zContent-length�
1234567890s
1234567890�10)rhr�rr�r�r2ryrar%r_�
get_header)rrrrs    r�test_issue16464�TestUrlopen.test_issue16464�s���#�#�
�"�f��
�"�f��%
������,�,�.���.�.�(�(�)>����)M�N������w�|�|�,����G�S�Z�Z�
�3�4�����w�|�|�,�����g�0�0�1A�B�C����G�\�0�0��<�=��������5�����w�1�1�2B�C�Dr)rr=)r r!r"r#r$r�r�r�rhrrr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r%rrs@rrUrU�sz����%����	�E�2�
8�9�N�1�0� K�K�F�	B�D�6�
0�E�ErrUc�x�[R"5n[R"[R/UQ76 gr=)r�threading_setup�unittest�addModuleCleanup�threading_cleanup)�thread_infos r�setUpModuler��s*��"�2�2�4�K����.�@�@�O�;�Or�__main__).r�rr��urllib.parser��urllib.request�http.serverr
r*r�r\�testr�test.supportrr�test.support.testcaserr��ImportError�requires_working_socketr��dirname�__file__�herer7r��CERT_fakehostnamerrr
r+r'rCr�r�r��TestCaser��requires_hashdigestrrSrUr�r �mainrrr�<module>r�s��
�	���������'�)�1������t�,�	�w�w���x� �������d�J�
�>���G�G�L�L��z�>�B��
)����/�/�)�4(�y�/�/�(�6v�v�r&�t�{�{�9�9�&�X;�t�{�{�9�9�;�B'�X�&�&�'�T�#�#�E�4�8�J�X�&�&�J�9�J�Z("�V^E�(�#�#�_�^E�@P�
�z���M�M�O���c��
�C��s�F�F"�!F"

Youez - 2016 - github.com/yon3zu
LinuXploit