403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.51
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:/Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python315/Lib/test/__pycache__/test_urllib2.cpython-315.opt-1.pyc
R
>lqj=[c���]PHs]QHGs]QHGs]QHGs]QHGs]QHGs]QHGs]PH$s	]PH(s
]PH,s]PH0s]PH4s
]PH8s]PH<s]PH@s]PHDs]QHDGsGsGsGsGsGsGsGs]QHlGs]PHts]PHxs\O@P	Q	5Q
Q\OB2s"QQ
\OB2s#QQ2s$QQ2s%QQ\&2s'QQ\
OP2s)QQ2s*QQ2s+QQ\
OX2s-QQ2s.QQ2s/Q s0Q!s1Q"Q#\OdOf2s4Q$Q%\OdOj2s6\7\OpQ&2%c Q'Q(\OdOr2s:Q)Q*\OdOj2s;Q+Q,2s<Q-Q.\OB2s=Q/Q0\OB2s>Q1Q2\OB2s?\O�\O�2Q32sBQ4Q5\OB2sCQ6Q7\OB2sD\EQ86Xc\O�2P!P!)9�)�support)�	os_helper)�requires_subprocess)�warnings_helper)�test_urllib)�mock)�Request�OpenerDirector�HTTPBasicAuthHandler�HTTPPasswordMgrWithPriorAuth�_parse_proxy�_proxy_bypass_winreg_override�_proxy_bypass_macosx_sysconf�AbstractDigestAuthHandler)�urlsplit)�modulec�:`�\sQs]'snQsQsQsQsQsUs	P!)�TrivialTestsc
���QFDno-o[QU*U2UQUO2FD>vq4UOUOQU*U8QU8QUO802J@	Jp	P!)�requestzfrom urllib.%s import *�__builtins__z	urllib.%sz is exposed in 'urllib.z' but defined in )r�response�parse�error�robotparser)�exec�items�assertEqual�
__module__)�selfr�context�k�vs&    �&C:\Python315\\Lib\test\test_urllib2.py�test___all__�TrivialTests.test___all__)sg��L�F��G��*�V�3�W�=���'��
�
����� � ����{�V�/C������.�/�(�	M�c�Z�UO[OO2UO	[
[OOQ2[OO[OO2O[OQ2o[OQ6XcQU*oL	QU*o[OO
U29^tt^2oUO2PPP2P!)%fhP!9h)z	bogus url�/�ntz
file:///%sz	file://%s)�
addCleanup�urllibr�
urlcleanup�assertRaises�
ValueError�urlopen�os�path�abspath�__file__�replace�sep�name�read)r�fname�file_url�fs&   r#�test_trivial�TrivialTests.test_trivial4s���	
������1�1�2����*�f�n�n�&<�&<�k�J��������� 7� 7�8�@�@�����M��
�7�7�d�?�#�e�+�H�"�U�*�H�
�^�^�
#�
#�H�
-�
-��
�F�F�H�.�
-�
-�
-�s�>D�D*	�"D*	c��Q,QN1QQQ,1Q,QN1Q,QN1,oSFD4vq#UO[OOU2U2J6	P!)	za,b,czpath"o,l"og"i"cal, examplezpath"o,l"og"i"cal�exampleza, b, "c", "d", "e,f", g, hza="b\"c", d="e\,f", g="h\\i")�a�b�c)r?r@z"c"z"d"z"e,f"�g�h)za="b"c"zd="e,f"zg="h\i")rr+r�parse_http_list)r�tests�string�lists&   r#�test_parse_http_list�!TrivialTests.test_parse_http_listGsb��
�o�&�
)�,?��+K�L�
*�
8�
:�
/�
/�
1�2��"�L�F����V�^�^�;�;�F�C�T�J�"r&c��[OOQ2oUOUO[U22P!)�reason)r+r�URLError�assertInrK�str)r�errs& r#�test_URLError_reasonstr�$TrivialTests.test_URLError_reasonstrRs,���l�l�#�#�H�-���
�
�c�j�j�#�c�(�+r&�)
�__name__r�__qualname__�__firstlineno__r$r;rHrP�__static_attributes__�__classdictcell__��
__classdict__s@r#rr's����	/��&	K�,�,r&rc�:`�\sQs]WsnQsQsQsQsQsUs	P!)�RequestHdrsTestsc���QoUO[UQQ-Q5OQ*Q2UO[UQQ-Q5OQ*Q2P!)a�
The Request.headers dictionary is not a documented interface.  It
should stay that way, because the complete set of headers are only
accessible through the .get_header(), .has_header(), .header_items()
interface.  However, .headers pre-dates those methods, and so real code
will be using the dictionary.

The introduction in 2.4 of those methods was a mistake for the same
reason: code that previously saw all (urllib2 user)-provided headers in
.headers now sees only a subset.

�http://example.com�	Spam-eggs�blah��headersz	spam-EggS)rrra)r�urls& r#�test_request_headers_dict�*RequestHdrsTests.test_request_headers_dictYsi��#�������*5�v�)>�#�#*�7�;�8�9?�	A�	
�����*5�v�)>�#�#*�7�;�8�9?�	Ar&c��Qo[UQQ-Q5oUOUOQ22UOUO	2Q,2UOQQ2UO[
UO	22QQ,2UOUOQ22UOUOQ22UOUOQQ2Q2UOQ2UOUOQ22UOQ	Q
2UOUOQ	22UOQ	2UOUOQ	22P!)
a�
Note the case normalization of header names here, to
.capitalize()-case.  This should be preserved for
backwards-compatibility.  (In the HTTP case, normalization to
.title()-case is done by urllib2 before sending headers to
http.client).

Note that e.g. r.has_header("spam-EggS") is currently False, and
r.get_header("spam-EggS") returns None, but that could be changed in
future.

Method r.remove_header should remove items both from r.headers and
r.unredirected_hdrs dictionaries
r]r^r_r`zFoo-Bar�bazz	Not-there�defaultzUnredirected-spam�Eggs)r^r_)zFoo-barrf)r�
assertTrue�
has_headerr�header_items�
add_header�sorted�assertFalse�assertIsNone�
get_header�
remove_header�add_unredirected_header)rrb�reqs&  r#�test_request_headers_methods�-RequestHdrsTests.test_request_headers_methodsns>��#���c�K��#8�9��������{�3�4�����)�)�+�.C�-D�E����y�%�(������ 0� 0� 2�3�,�.C�D�	F��������4�5����#�.�.��5�6��������Y�?��K����+�&��������4�5��#�#�$7��@�������':�;�<����-�.�������(;�<�=r&c��[OO2oUOoUOoUQQQQ2UQQQQ2UQQQQ2UQQ	Q
Q2UQQQ
Q2UOUQQ2Q-2UOUQQ2Q-2UOUQQ2Q-2UOUQQ2Q-2UOUQQ2Q-2UOUQQ2Q-2UQQQQ2UQQQQ2UQQQQ2UOUQQ2Q.2UOUQQ2Q/2UOUQQ2Q.2UOUQQ2Q.2UOUQQ2Q.2UOUQQ2Q02UQQQQ 2UOUQQ!2Q02UOUQQ2Q12UOUQQ"2Q12UQ#QQ$Q%2UQ#QQ&Q'2UOUQ#Q2Q22UQ(QQ)Q(2UOUQ(Q2Q32UOUQ(Q*2Q02UOUQQ+2Q02UOUQQ,2Q42UOUQQ2Q42UOUQQ	2Q52UOUQQ2Q62P!)7z
Some Realm�http://example.com/�joe�passwordzhttp://example.com/ni�nizhttp://c.example.com:3128�3rAz
d.example.com�4�dze.example.com:3128�5�e�example.comr]zhttp://example.com/spamzhttp://example.com/spam/spamzhttp://example.com/foo�foozhttp://example.com/bar�bar�ninizhttp://example.com/foo/bar�foobar�nibarzhttp://example.com/foo/zhttp://example.com/foo/bazzhttp://example.com/foobarzhttp://example.com/baz/rf�nininizhttp://example.com/bazzhttp://example.com/baz/barr@�firstr_�second�spamr?�1zhttp://a.example.com/z
c.example.comzc.example.com:3128)rxry)r�rz)r�r��NN)rfr�)r�r�)r�r?)r{rA)r|r})r~r�r+r�HTTPPasswordMgr�add_password�find_user_passwordr�r�mgr�add�find_user_passs&   r#�test_password_manager�&RequestHdrsTests.test_password_manager�s`���n�n�,�,�.�������/�/���L�/��
�C��L�1�4��>��L�5�s�C�@��L�/�3��4��L�.��S�9�	
�����m�D�,�	.������6M�N�,�	.������6J�K�,�	.������6K�L�,�	.������(A�C�,�	.�	
�����(F�H�,�	.�	�C�)�5�$�7��C�)�5�&�9��C�-�x��A������-E�F�&�	(������-E�F�(�	*������-F�G�&�	(������-I�J�&�	(������-I�J�&�	(������-H�I�%�	'�	�C�*�E�8�<������-E�F�%�	'������-F�G�*�	,������-I�J�*�	,�
	�C�&���8��C�&��&�9������-B�C�+�	-�
	�C�%�s�C�0������-B�C�#�	%�	
�����-D�E�%�	'�
	
�����o�F�%�	'������6J�K�#�	%�����<�)D�E��	�	
�����o�F�#�	%������6J�K�#�	%r&c���[OO2oUOoUOoUQQQQ2UQQQQ2UQ	Q
QQ2UQ
QQQ2UOUQQ2Q2UOUQQ2Q2UOUQQ2Q2UOUQQ2Q2UOUQQ2Q2UOUQQ2Q2UOUQQ2Q 2UOUQQ2Q 2UOUQQ2Q 2UOUQ	Q2Q2UOUQ	Q
2Q!2UOUQ	Q2Q!2UOUQ
Q2Q"2UOUQ
Q2Q2UOUQ
Q2Q"2UOUQ
Q2Q2P!)#z�
The point to note here is that we can't guess the default port if
there's no scheme.  This applies to both add_password and
find_user_password.
r:zhttp://g.example.com:80�10�jrBzhttp://h.example.com�11r!rCzi.example.com:80�12�l�iz
j.example.com�13�mzg.example.com:100zg.example.com:80z
g.example.comzhttp://g.example.com:100zhttp://g.example.comz
h.example.comzh.example.com:80zhttp://h.example.com:80z
i.example.comzhttp://i.example.com:80zj.example.com:80zhttp://j.example.comzhttp://j.example.com:80r�)r�r�)r�r!)r�r�)r�r�r�r�s&   r#�"test_password_manager_default_port�3RequestHdrsTests.test_password_manager_default_port�s���n�n�,�,�.�������/�/���C�*�D�#�6��C�'��s�3��C�#�T�3�/��C��$��,������-@�A�%�	'������-?�@�$�	&������_�=�%�	'������-G�H�%�	'������-F�G�$�	&������-C�D�$�	&������_�=�{�K������-?�@�+�N������-F�G�$�	&������_�=�|�L������-?�@�+�N������-F�G�$�	&������_�=�{�K������-?�@�%�	'������-C�D�$�	&������-F�G�%�	'r&rR)
rSrrTrUrcrtr�r�rVrWrXs@r#r[r[Ws"����A�*">�HT%�l''�''r&r[c�N`�\sQsQsn,sP\O1QksQsQs	Us
P!)�
MockOpener�c�2�VUtUmUmUmP!�N)rs�data�timeout)rrsr�r�s&&&&r#�open�MockOpener.opens��,/�w�)���$�)�T�\r&c�$�VtUmUmP!r�)�proto�args)rr�r�s&&*r#r�MockOpener.errors�� %���
�D�Ir&)r�r�r�rsr�)rSrrTrU�
addheaders�socket�_GLOBAL_DEFAULT_TIMEOUTr�rrVrWrXs@r#r�r�s$�����J�!�6�+I�+I�?�,�,r&r�c�<`�\sQsQsnQQksQQksQsQsUsP!)�MockFile�c��P!r�rR�r�counts&&r#r7�
MockFile.read���r&c��P!r�rRr�s&&r#�readline�MockFile.readline r�r&c��P!r�rR�rs&r#�close�MockFile.close#r�r&rRr�)	rSrrTrUr7r�r�rVrWrXs@r#r�r�s����
�
�
�
r&r�c�(`�\sQsQsnQsQsUsP!)�MockHeaders�'c�6�[UO22!r�)rG�values)rr6s&&r#�
getheaders�MockHeaders.getheaders(s���D�K�K�M�"�"r&rR)rSrrTrUr�rVrWrXs@r#r�r�'s����#�#r&r�c�8`�\sQsQsnQQksQsQsQsUsP!)�MockResponse�,c��[OOV2VV51vUmUmUmUmP!r�)�io�StringIO�__init__�code�msgrarb)rr�r�rar�rbs&&&&&&r#r��MockResponse.__init__-s/��
�����T�(�6:��6M�3��	�4�8�T�\�4�8r&c��UO!r�r`r�s&r#�info�MockResponse.info1s���|�|�r&c��UO!r��rbr�s&r#�geturl�MockResponse.geturl4����x�x�r&)r�rar�rbr�)	rSrrTrUr�r�r�rVrWrXs@r#r�r�,s����N���r&r�c�.`�\sQsQsnQsQsQsUsP!)�
MockCookieJar�8c��VmP!r�)�ach_req)rrs&&r#�add_cookie_header�MockCookieJar.add_cookie_header9s���r&c�$�V!tUmUmP!r�)�ec_req�ec_r)rrrs&&&r#�extract_cookies�MockCookieJar.extract_cookies<s��!(����T�Yr&)r�r�r�)rSrrTrUr�r�rVrWrXs@r#r�r�8s�����3�3r&r�c�.`�\sQsQsnQsQsQsUsP!)�
FakeMethod�@c�,�VmV0mV mP!r�)�	meth_name�handle�action)rr�r�r�s&&&&r#r��FakeMethod.__init__As��"�����r&c�X�UOUOUO,UN3!r�)r�r�r�)rr�s&*r#�__call__�FakeMethod.__call__Fs ���{�{�4�>�>�4�;�;�>��>�>r&)r�r�r�)rSrrTrUr�r�rVrWrXs@r#r�r�@s�����
?�?r&r�c�:`�\sQsQsnQsQsQsQsQsUs	P!)�MockHTTPResponse�Jc�F�VmV mV0mV@m]�UmP!)��)�fpr��statusrKr�)rr�r�r�rKs&&&&&r#r��MockHTTPResponse.__init__Ks������������	r&c��P!)�rRr�s&r#r7�MockHTTPResponse.readRs��r&c��-!r�rRr�s&r#r��MockHTTPResponse.infoUs���	r&c��UO!r�r�r�s&r#r��MockHTTPResponse.geturlXr�r&)r�r�r�rKr�)
rSrrTrUr�r7r�r�rVrWrXs@r#r�r�Js��������r&r�c�v`�\sQsQsnQs\O1QksQsQQks	QQP
-Qkks
QsQ	sQ
s
UsP!)�
MockHTTPClass�\c�\�]Um,UmPUmP
UmPUm-UmP!�r)�level�req_headersr��raise_on_endheaders�sock�_tunnel_headersr�s&r#r��MockHTTPClass.__init__]s/����
������	�#(�� ���	�!��r&c� �VmV mU!r�)�hostr�)rrr�s&&&r#r��MockHTTPClass.__call__es���	����r&c��VmP!r�)r)rrs&&r#�set_debuglevel�MockHTTPClass.set_debugleveljs���
r&c�t�VmV mU%c	V0mP!UOO2P!r�)�_tunnel_host�_tunnel_portr�clear)rr�portras&&&&r#�
set_tunnel�MockHTTPClass.set_tunnelms)�� �� ���#*� �� � �&�&�(r&�encode_chunkedc�
�VmV mUd(U9OUO2*
tmUOO	2U%cV0mVPmUO%c[2gP!r�)	�method�selectorrr�sortr�rr�OSError)rrrb�bodyrars&&&&&$r#r�MockHTTPClass.requestusa�����
�������
�
��/����������I�,���#�#�#��)�O�$r&c�0�[[2-]�Q2!)r��OK)r�r�r�s&r#�getresponse�MockHTTPClass.getresponse�s����
�B��T�:�:r&c��P!r�rRr�s&r#r��MockHTTPClass.close�r�r&)
rrrr�rrrrrrrrr�r�)rSrrTrUr�r�r�r�rrrr!r�rVrWrXs@r#rr\s@����"�&,�%C�%C��
�)��$��;�
�
r&rc�J`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sUsP!)
�MockHandler���c�*�UOU2P!r�)�_define_methods)r�methodss&&r#r��MockHandler.__init__�s�����W�%r&c��SFDGo[U2]6XcUvq4LSPqC[V4UO2o[UOV52JI	P!)�)�lenr�r��setattr�	__class__)rr+�specr6r��meths&&    r#r*�MockHandler._define_methods�sE���D��4�y�A�~�#���f�#�T�f��d�D�K�K�8�D��D�N�N�D�/�
r&c��UOOOVV412UeP!UQ6XcU!UQ6Xc[]�Q-P2oU!UQ6Xc[	Q2!UOQ2%c[V"O
Q2]*Po[U2o[]�Q-P2oUOOQU]*VVP-2!UQ	6Xc [OOQ
2gP![cKih9h)N�return self�return responser �return requestzhttp://blah/r� �http�raiser_)�parent�calls�appendr�r�
startswith�rfind�intr.rr+rL)r�fn_namer�r��kwds�resr�s&&&*,  r#r��MockHandler.handle�s������� � �$��!<�=��>��
�}�
$��K�
�(�
(��s�D�"�b�1�C��J�
�'�
'��>�*�*�
�
�
�w�
'�
'��,�,�s�+�A�-�.�/�D�
��4�y���s�D�"�b�1�C��;�;�$�$�V�T�!�W�c��R�H�H�
�w�
��,�,�'�'��/�/���	�
��
�s�C:�:	D�D�Dc��P!r�rRr�s&r#r��MockHandler.close�r�r&c�6�Vm,UOmP!r�)r<r=)rr<s&&r#�
add_parent�MockHandler.add_parent�s��������r&c�^�[UQ2%fP	!UOUO6!)�
handler_order)�hasattrrL)r�others&&r#�__lt__�MockHandler.__lt__�s)���u�o�.�.���!�!�E�$7�$7�7�7r&)r<)
rSrrTrUrLr�r*r�r�rIrOrVrWrXs@r#r&r&�s/�����M�&�0��.
��8�8r&r&c��,o]oSFDooQQ[2oUU2oU9OU*
tmUOU2U]*oUOU2UO	U2Jq	U!)a�Create MockHandlers and add them to an OpenerDirector.

meth_spec: list of lists of tuples and strings defining methods to define
on handlers.  eg:

[["http_error", "ftp_open"], ["http_open"]]

defines methods .http_error() and .ftp_open() on one handler, and
.http_open() on another.  These methods just record their arguments and
return None.  Using a tuple instead of a string causes the method to
perform some action (see MockHandler.handle()), eg:

[["http_error"], [("http_open", "return request")]]

defines .http_error() on one handler (which simply returns None), and
.http_open() on another handler, which returns a Request object.

c��\sQsQsQsP!)�6add_ordered_mock_handlers.<locals>.MockHandlerSubclass��rR�rSrrTrUrVrRr&r#�MockHandlerSubclassrS����r&rV)r&rLrIr>�add_handler)�opener�	meth_spec�handlersr��methsrVrCs&&     r#�add_ordered_mock_handlersr]�st��&�H�
�E���	�+�	�
 ��&��	���5� ��	���V����	����������1����Or&c�R�[2oSFDoUOU2J	U!r�)r	rX)�handler_instancesrYrCs*  r#�build_test_openerr`�s'��
�
�F�
�����1����Mr&c�>``�\sQsQsnQU1QkksQsQsUsU9s!)�MockHTTPHandler��c�P:�[[U_UQ5[2UmP!)��
debuglevel)�superrbr�r�httpconn)rrfr1s&&�r#r��MockHTTPHandler.__init__�s���
�o�t�-��-�D�%���
r&c�<�UOUOU2!r���do_openrh�rrss&&r#�	http_open�MockHTTPHandler.http_open�s���|�|�D�M�M�3�/�/r&�rhr�)	rSrrTrUr�rnrVrW�
__classcell__�r1rYs@@r#rbrb�s����(�0�0r&rbc�4`�\sQsQsnQsQsQsQsUsP!)�MockHTTPHandlerRedirect��c�@�VmV mUO2P!r�)r�ra�reset)rr�ras&&&r#r�� MockHTTPHandlerRedirect.__init__�s���	����
�
�r&c�$�]Um,UmP!r)�_count�requestsr�s&r#rw�MockHTTPHandlerRedirect.reset�s�������
r&c��]PHo]PHoUOOUO	U22UO
]6Xc�UO
]*Um[OOUO*oUOUO2oUOOQU[2UOVE2!VmUOQ2o[!]�QUPUO#22!)rr:�

r )�email�copyr{r>�deepcopyrzr:�client�	responsesr��message_from_stringrar<rr�rsr��get_full_url)rrsrr�r6r�s&&    r#rn�!MockHTTPHandlerRedirect.http_opens�����
�
���T�]�]�3�/�0��;�;�!���+�+��/�D�K��;�;�(�(����3�D��+�+�D�L�L�9�C��;�;�$�$���X�Z����D�?�
?��H��+�+�J�7�C���T�3��C�4D�4D�4F�G�Gr&)rzr�rarsr{�	rSrrTrUr�rwrnrVrWrXs@r#rtrt�s�����
�H�Hr&rt�HTTPSConnectionc�>``�\sQsQsnQU1QkksQsQsUsU9s!)�MockHTTPSHandler�c�P:�[[U_VU2[2UmP!r�)rgr�r�rrh)rrfr �check_hostnamer1s&&&&�r#r��MockHTTPSHandler.__init__s����"�D�2�:��W�)�O�D�Mr&c�<�UOUOU2!r�rkrms&&r#�
https_open�MockHTTPSHandler.https_opens���<�<��
�
�s�3�3r&rp)NNN)	rSrrTrUr�r�rVrWrqrrs@@r#r�r�s����	,�	4�	4r&r�c�4`�\sQsQsnQsQsQsQsUsP!)�MockHTTPHandlerCheckAuth�c�"�VmP
UmP!�F�r��has_auth_header)rr�s&&r#r��!MockHTTPHandlerCheckAuth.__init__ s���	�$��r&c��P
UmP!r�)r�r�s&r#rw�MockHTTPHandlerCheckAuth.reset$s
��$��r&c���UOQ2%cP	Um[OOUO
*o[
UO
U[2PUO22!)�
Authorization)	rjr�r:r�r�r�r�r�r�)rrsr6s&& r#rn�"MockHTTPHandlerCheckAuth.http_open'sS���>�>�/�*�*�#'�D� ��{�{�$�$�T�Y�Y�/���D�I�I�t�X�Z��S�=M�=M�=O�P�Pr&r�r�rXs@r#r�r�s����%�%�Q�Qr&r�c�.`�\sQsQsnQsQsQsUsP!)�MockPasswordManager�/c�8�VmV mV0mV@mP!r�)�realmrb�userry)rr��urir�rys&&&&&r#r�� MockPasswordManager.add_password0s���
����	� �
r&c�L�VmV mUOUO1!r�)�target_realm�
target_urlr�ry)rr��authuris&&&r#r��&MockPasswordManager.find_user_password6s ��!��!���y�y�$�-�-�'�'r&)ryr�r�r�rbr�)rSrrTrUr�r�rVrWrXs@r#r�r�/s����!�(�(r&r�c�R`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sQ
sUs
P!)�OpenerDirectorTests�<c��QQ[2oUO[[2OU22P!)c��\sQsQsQsP!)�<OpenerDirectorTests.test_add_non_handler.<locals>.NonHandler�?rRrUrRr&r#�
NonHandlerr�?rWr&r�)�objectr-�	TypeErrorr	rX)rr�s& r#�test_add_non_handler�(OpenerDirectorTests.test_add_non_handler>s/��	��	����)�(�*�6�6�
��	Fr&c���[2oQ,Q,Q,,o[V2UO[UO2]2UO[UO
2]2P!)r��_openr)r	r]rr/�handle_open�handle_error)r�orZs&  r#�test_no_protocol_methods�,OpenerDirectorTests.test_no_protocol_methodsDs^��

���
�H�
�I�
�I�
�	�	"�!�/�����Q�]�]�+�Q�/�����Q�^�^�,�a�0r&c��]QHGo[2oQQ,Q,,o[V#2UO	[
OO22QFD&oUOVOUQ*2J(	P!)r)rLz://example.com/)rlr6)�
proxy_openr6)�redirect_requestr6)�do�proxy�redirect)
�urllib.errorrLr	r]rXr+r�UnknownHandlerr-r�)rrLr�rZ�schemes&    r#�test_badly_named_methods�,OpenerDirectorTests.test_badly_named_methodsUsl��	*����
'�)F�G�
0�1��	�	"�!�/�	�
�
�f�n�n�3�3�5�6�/�F����h����7H�0H�I�0r&c�n�[2o,QNQ,Q,Q,,o[V2o[Q2oUOU2oUO	VS]*2U]*Q1U]*Q1,o[VaO2FD/vqxUvq�q�UO	V�1U2UO	V�12J1	P!)rn�ftp_openrw)rnr��http_error_302�rnr6)r	r]rr�r�zipr=)
rr�rZr[rs�rr=�expected�got�handlerr6r�rCs
&            r#�test_handled� OpenerDirectorTests.test_handledjs������7�
�L�
)�*�
)�*�	�	�-�Q�:���+�,��
�F�F�3�K��	
����Q�K�(��1�+�{�+�h�q�k�;�-G�H�� ����0�M�H�(+�%�G�4����g�_�h�7����T�6�*�1r&c��[2o,oQ,Q1Q,]11FDDvq4QQ[2oUU2oVFmUOU2UO	U2JF	UOQ2UO
UO]*]*U]*2UO
UO]*]*U]*2P!)rnr(c��\sQsQsQsP!)�COpenerDirectorTests.test_handler_order.<locals>.MockHandlerSubclass�rRrUrRr&r#rVr��s��r&rVrwr�)r	r&rLr>rXr�rr=)rr�r[r\rLrVrCs&      r#�test_handler_order�&OpenerDirectorTests.test_handler_order�s��������'C�&D�c�%J�'2�m�Q�%7�%9� �E�
�k�
�$�E�*�A�+�O��O�O�A��
�M�M�!��%9�	
���$�%���������A�����4���������A�����4r&c��[2oQ,Q,,o[V2o[Q2oUO[O
OUOU2UOUOU]*QU1-1,2P!)rnrw)rnr;r�)
r	r]rr-r+rrLr�rr=)rr�rZr[rss&    r#�
test_raise�OpenerDirectorTests.test_raise�sz�����
#�$�
)�*��	�-�Q�:���+�,�����&�,�,�/�/�����=�������H�Q�K��s�f�b�#I�"J�Kr&c��[2oQ,QQ,,QNQ,,o[V2o[Q2oUOU2U]*QU11U]*QU[O
QP-11,o[
VQO2FD<vqgUvq�o
UOV�1UQ*2UOV�]*2J>	P!)rnr�rw�.:Nr.N)rnz	error 302)�http_error_400r;))r�r7�http_error_303�
http_error)	r	r]rr�r�	ALWAYS_EQr�r=r)rr�rZr[rsr=r�r�r��method_namer�s&          r#�test_http_error�#OpenerDirectorTests.test_http_error�s���
���
'�(�
(�+�6�
�� ��	�-�Q�:���+�,��	���s���1�+�{�S�F�3��1�+�/���)�)�3��B�7�9�:��!����0�M�H�)1�&�G�$����g�3�S��W�=����T�q�6�*�1r&c��[2oQQ,QQ,,o[V2o[Q2oUOU2U]*Q1U]*Q1U]*Q1U]*Q1,o[	UO
2FD�vovqxq�U]6cTUO
Vx1VV*2UO
[U	2]2UOU	]*[2JcUO
Vx1VV*2UO
[U	2]2UOU	]*[2U	]*eJ�UOU	]*[2J�	P!)�http_request�
http_responserw)r�r8)r�r7)
r	r]rr��	enumerater=rr/�assertIsInstancer�)rr�rZr[rsr=r�r�r6r�rCs&          r#�test_processors�#OpenerDirectorTests.test_processors�sB�����
/�
1�
3�
/�
1�
3��	�-�Q�:���+�,��	���s���a�[�.�)�H�Q�K��+H�
�a�[�/�*�X�a�[�/�,J�L��/8����.@�*�A�*��t��1�u�� � �'��%�(�;�� � ��T��A�.��%�%�d�1�g�w�7�� � �'��%�(�;�� � ��T��A�.��%�%�d�1�g�w�7���7�&��)�)�$�q�'�<�@�/Ar&rR)rSrrTrUr�r�r�r�r�r�r�r�rVrWrXs@r#r�r�<s7����F�1�"J�*+�45�$L�+�.!A�!Ar&r�c��`�\sQsQsnQs\OQ2Q2sQsQs	Qs
QsQ	s\
2Q
2sQsQsQ
sQsQs\O*\\O0Q2Q2Q2s\O*\\O0Q2Q2Q2sQsQsQsQsQsQs Qs!Qs"Qs#Qs$Qs%Qs&Q s'Q!s(Q"s)Q#s*Q$s+Q%s,\O*\\O0Q2Q2Q&2s-\O*\.O^Q'6HQ(2Q)2s0\O*\1OdQ*6HQ+2Q,2s3Q-s4Q.s5Q/s6Q0s7Q1s8Q2s9Q3s:Q4s;Q5s<Q6s=Q7s>Q8s?Us@P!)9�HandlerTests��c��`�QQ2nU1QkQ[OO2oQoUU2o[2UmQQ[
OPPQQQ	,Q
Q1	QQ[
OQ
PQQQ	,Q
Q1	QQ[
OQPQQQ	,Q
Q1	QQ[
OQPQQQ	,Q
Q1	QQ]PPPQQQ	,PP1	QQ[
OPPQ,QQ1	1FCD�v	qEqgq�q�o[U2o
PU
mUOU
2oUOUOU2UOUOU2UOUO[OU22UOUO U2UOUO"U
2UOUO$O&U2UOUO$O(U	2UO+2oUOUO-Q2U2UO[/UQ*2[1U22UO32CJ�	P!)c�4`�\sQsQsnQsQsQsQsUsP!)�-HandlerTests.test_ftp.<locals>.MockFTPWrapper��c��VmP!r��r��rr�s&&r#r��6HandlerTests.test_ftp.<locals>.MockFTPWrapper.__init__���� �	r&c��VtUmUm[OUO2[UO21!r�)�filename�filetyper�r�r�r/)rr�r�s&&&r#�retrfile�6HandlerTests.test_ftp.<locals>.MockFTPWrapper.retrfile�s0��/7�,��
�t�}��{�{�4�9�9�-�s�4�9�9�~�=�=r&c��P!r�rRr�s&r#r��3HandlerTests.test_ftp.<locals>.MockFTPWrapper.close����r&)r�r�r�)	rSrrTrUr�r�r�rVrWrXs@r#�MockFTPWrapperr��s����
!�
>�
�
r&rc�P:`�\sQsQsnQs\O1U1QkksQsUs	P!)�-HandlerTests.test_ftp.<locals>.NullFTPHandler��c��VmP!r�r�r�s&&r#r��6HandlerTests.test_ftp.<locals>.NullFTPHandler.__init__�r�r&c�:�VtUmUmV4tUmUmVPmRUO
2UmUO!r�)r��passwdrr�dirsr��
ftpwrapper)rr�r	rrr
r�rs&&&&&&&�r#�connect_ftp�9HandlerTests.test_ftp.<locals>.NullFTPHandler.connect_ftp�s>���)-�&��	�4�;�'+�$��	�4�9� �	�"0����";������&r&)r�r
rrr	rr��
rSrrTrUr�r�r�rrVrW)rYrs@�r#�NullFTPHandlerr�s����
!�%+�$B�$B�
'�
'r&rzrheum rhaponicumz ftp://localhost/foo/bar/baz.html�	localhost�Ir�r�zbaz.htmlz	text/htmlz'ftp://parrot@localhost/foo/bar/baz.html�parrotz*ftp://%25parrot@localhost/foo/bar/baz.htmlz%parrotz,ftp://%2542parrot@localhost/foo/bar/baz.htmlz	%42parrotzftp://localhost:80/foo/bar/�Dzftp://localhost/baz.gif;type=a�Azbaz.gifz	image/gif�Content-type�Content-length)r+r�
FTPHandlerr�r<�ftplib�FTP_PORTrr�r�rr�r	rr��
gethostbynamerr
rr�r�r��getrAr/r�)rrr�rCrbrrr�r	�type_r
r��mimetypersr�rars&               @r#�test_ftp�HandlerTests.test_ftp�s5���		�		�
	'�V�^�^�6�6�
	'�"���4� ���<���0�
�&�/�/�2�r�3��U�^�Z��
6�7�
�&�/�/�8�R���U�^�Z��
6�:�
�&�/�/�9�b�#��U�^�Z��
6�<�
�&�/�/�;��C��U�^�Z��
6�+�
�"�b�"�c��U�^�R��
'�.�
�&�/�/�2�r�3�
��K�
)�!O�J�C�t�6�$�(�(�#�,�C��C�K��
�
�3��A����Q�V�V�T�*����Q�X�X�v�.����Q�V�V�V�%9�%9�$�%?�@����Q�V�V�T�*����Q�V�V�T�*����Q�\�\�2�2�H�=����Q�\�\�2�2�E�:��f�f�h�G����W�[�[��8�(�C����S��)9�!:�;�S��Y�G�
�G�G�I�EOr&�networkc���QQ[OO2o[OQ2oUU2o[OOU2OoUQ2UOQ2P![OOc<oSOSOQSO]*02Po=P!Po=hh9h)c�H`�\sQsQsnQs\O1QksQsUs	P!)�4HandlerTests.test_ftp_error.<locals>.ErrorFTPHandler�"c��VmP!r���
_exception)r�	exceptions&&r#r��=HandlerTests.test_ftp_error.<locals>.ErrorFTPHandler.__init__#s��"+�r&c��UOgr�r&)rr�r	rrr
r�s&&&&&&&r#r�@HandlerTests.test_ftp_error.<locals>.ErrorFTPHandler.connect_ftp&s���o�o�%r&r&rrXs@r#�ErrorFTPHandlerr#"s����
,�%+�$B�$B�
&�
&r&r,z.500 OOPS: cannot change directory:/nonexistentzftp://www.pythontest.net/zDid not raise ftplib exceptionzftp error: )
r+rrr�
error_perm�build_openerr��failrrLrrKr�)rr,r(rCr/�raiseds&     r#�test_ftp_error�HandlerTests.test_ftp_error s���	&�f�n�n�7�7�	&��%�%�<�>�	��I�&���.�.�-�-�a�0�5�5��	8��/�0�

�I�I�6�7��	�|�|�$�$�	@����V�]�]�*�9�>�>�!�+<�*=�>�
@�
@��	@�s�-B�C"�&C"�'0C�C"c	�v
�]PHo[OO2o[	29p2m[OoQo[OO[OOU2P	Q5o[U2oUO%c[OQ2gUUO!QQ5O#2UO![$O&Q2Q5O#2,o[$O&[$O(22o	U	%c0UO-UO!U	Q5O#22SFCDNo
[/UQ2oUO1U2UO32UO5[7U
22oUO92o
UO;2oUO#2oUO32[O<U2oUO>OAUOBP	Q5o[ODU2UOGV�2UOGUQ*Q	2UOGUQ
*Q2UOGUQ*U2UOGV�2CJQ	UO!Q
Q5O#2QQQ[$O&Q28Q[OH28QU80Q[OH28QU801FD�o
[/UQ2oUO1U2UO32UOK[OLONUO4[7U
22[ODU2J�	[OO2o[	29p2mQFDzvo
o[7U
2oUO5U2UOQUORU2UOGUOTQ2UOGUOTQ6HU2J|	P![$O*cPo	CKVh9hSO32h9hSO32h9h[ODS2h9hSO32h9h[ODS2h9h[OLONcSOWS2K�h9h)rs
hello, world
)�
add_schemeznon-local working directoryr)�netloc�wb)�usegmtrz
text/plainrr�z
Last-modifiedzlocalhost:80zfile:///file_does_not_exist.txtz)file://not-a-local-host.com//dir/file.txtzfile://z:80r(z'file://somerandomhost.ontheinternet.com�ftp))zfile://ftp.example.com//foo.txtF)z file://ftp.example.com///foo.txtF)zfile://ftp.example.com/foo.txtF)z"file://somehost//foo/something.txtF)z#file://localhost//foo/something.txtF),�email.utilsr+r�FileHandlerr�r<r�TESTFN�pathname2urlr0r1r2rr5�unittest�SkipTest�_replacer�r�r�gethostname�gaierrorr>r��writer��	file_openrr7r��stat�utils�
formatdate�st_mtime�remover�getcwdr-rrL�assertIsrs�typern)rrrCr�r;�towrite�canonurl�parsed�urls�	localaddrrbr:r�r�ra�respurl�stats�modifiedr8rss&                   r#�	test_file�HandlerTests.test_file6s�����N�N�&�&�(��!�|�#��H��!�!��#���>�>�.�.�r�w�w���v�/F�SW�.�X���(�#���=�=�=��#�#�$A�B�B���O�O�;�O�/�6�6�8��O�O�6�#7�#7��#D�O�E�L�L�N���
	��,�,�V�-?�-?�-A�B�I���K�K����y��9�@�@�B�C��C��V�T�"�A�
"���G�G�G�$��G�G�I��K�K����-����6�6�8�D��f�f�h�G��h�h�j�G��G�G�I������� �;�;�1�1�%�.�.��1�N���	�	�&�!����T�+����W�^�4�l�C����W�%5�6��=����W�_�5�x�@����W�/�/�4
�O�O�>�O�2�9�9�;�-�7�#)�#7�#7��#D�#%�9�9�;��
8��Y�Y�[�&�
"�
�C�

"����&����G�G�G�$��G�G�I��!�!�&�,�,�"7�"7�"#�+�+�w�s�|�=��	�	�&�!�'�*
�N�N�&�&�(��!�|�#��H��H�C���#�,�C�
2����C� ��
�
�a�e�e�S�)�� � ����5�1����S�X�X��.��4���y���	��I�	���G�G�I���G�G�I���	�	�&�!��*�G�G�I��
�	�	�&�!��*�<�<�(�(�
&�� � ��%�
&�s��
)Q2�R�*R:�>0R%�.A
R:�;S*�S�AS*�T�2R
�R
�R
�R"�"R:�%R7�7R:�:S�S'�'S*�*T�T8�#T8�7T8c�2�[OO2o[29p!mQoQFCD�vqE[V5QQ-2oPUmUOQQ2[2oUOVv2oUOUOUOUOUOUO]�6HQ1UO2o	U	O U	O"UO%UO2U2UO%UO&Q2UO%UO(]2UO%UO*U2UO%UO,Q2UO%UO.,QN2UO%UO0U2CJ�	P	WmUO5[O6O8UOUW2[QQ2oUO5[:UO<U2Q,UmQFCD�o[QU2o[A]�Q-P2oUO=U2o
Ue:UOCQ	UOD2UOCQ
UOD2LFUO%UODQ	*Q2UO%UODQ
*Q2UO%UODQ
*Q2UO%UODQ*Q2UOQ	Q2UOQ
Q2UOQ
Q2UOQQ2UO=U2o
UO%UODQ	*Q2UO%UODQ
*Q2UO%UODQ
*Q2UO%UODQ*Q2CJ�	P!)rw�Foor��Spam�eggsr r�r(�badpostrr�0�!application/x-www-form-urlencoded�Hostr�rf))�GETN)�POSTsblah�rXrY))�
Connectionr�)rWr�r`)r&N)#r+r�AbstractHTTPHandlerr�r<rr�rrrrlr7r�r�r�r�r�r�__contains__rrrrrrr�rr-rrLr��do_request_r�r��assertNotIn�unredirected_hdrs)rrCr�rbrr�rsr:r��hdrs�newreqs&          r#�	test_http�HandlerTests.test_http�sG���N�N�.�.�0��!�|�#��H�#��>�L�F��#�e�U�^�4�C��C�K��'�'���7� �?�D��	�	�$�$�A�
�F�F�A�J�J�
�F�F�A�H�H�
�F�F�A�E�E�S�L�$�&��6�6�8�D��H�H�d�'�'����Q�X�X�Z��-����T�Y�Y�
�6����T�Z�Z��+����T�[�[�&�1����T�]�]�C�0����T�-�-�@�
A�
���T�Y�Y��-�-?�2$(�� ����&�,�,�/�/����D�#�F��+�I�6�����)�Q�]�]�C�8�)�)����D��/��6�C��S�$��B�/�A��]�]�3�'�F��|�� � �!1�3�3H�3H�I�� � ���1F�1F�G�� � ��!6�!6�7G�!H�#�N�� � ��!6�!6�~�!F�@�B�
���S�2�2�6�:�M�J����S�2�2�6�:�F�C�
�'�'�(8�%�@��'�'���>��'�'���6��'�'���6��]�]�3�'�F����S�2�2�3C�D�e�L����S�2�2�>�B�E�J����S�2�2�6�:�E�B����S�2�2�6�:�E�B�1r&c�:�,QNo[OO2o[2UmSFD�vq4o[QV4-Q5oPUmUOV52[2oUOVv2[UO2oUOV�*U2UOUOUO22U2UO[UO22UO2*U2J�	P!)�Content-Typerwr`))rlzapplication/jsonr\)�Content-Length�99r[)r]zoverride.example.comzinternal.example.com)r�zBearer user-tokenzBasic stale=)�Cookieza=1zb=2)�
User-Agentz	MyApp/1.0zPython-urllib/test)r+rrbr�r<rr�rrrrl�dictrrrp�
capitalizerk)	r�casesrC�key�regular�unredirectedrsr:�sent_headerss	&        r#�test_http_header_priority�&HandlerTests.test_http_header_priority�s���
��
�N�N�.�.�0���<���*/�&�C�,��/�#��H�C��C�K��'�'��:� �?�D�
�I�I�d� ��� 0� 0�1�L����\�.��8����S�^�^�C�N�N�,<�=�w�G����T�#�"2�"2�"4�5�c�n�n�6F�G��Q�+0r&c	�d�[OO2o[29p!m[
OQP
Q5oUOoUO2UO[OU2[UQ29^tt^2o[QU-2oUOU2oUOQ2oUO!UQ2UO#UO%Q22PPP2[UQ29^tt^2o[QUQ]-2oUOU2oUO!['UOQ22]2UO#UO%Q22PPP2P!)%fhK�9h)%fhP!9h)zw+b)�mode�delete�rbrw�Transfer-encoding�chunkedrrm)r+rrbr�r<�tempfile�NamedTemporaryFiler6r�r*r0�unlinkr�rrdrprrnrjrA)	rrCr��file_obj�	file_pathr:rsrh�tes	&        r#�test_http_body_file� HandlerTests.test_http_body_file�sQ��
�N�N�.�.�0��!�|�#��H��.�.�E�%�H���M�M�	���������	�	�9�-�
�)�T�
"�
"�a��/��B�7�C��]�]�3�'�F��"�"�#6�7�B����R��+����V�.�.�/?�@�A�#��)�T�
"�
"�a��/��5E�r�4J�K�C��]�]�3�'�F����S��!2�!2�3C�!D�E�r�J����V�.�.�/B�C�D�	#�
"�#�
"��#�
"�
"�s&�A"F�A+F�F	�F	�F/	�'F/	c�B�[OO2o[29p!m[
O2o[QU-2oUOU2oUOUOQ2Q2UOUOQ22Q]-o[QV62oUOU2oUO[UOQ22]2UOUOQ22UO2P!)rwr~rrrm)r+rrbr�r<r��BytesIOrrdrrprnrjrAr�)rrCr�r�rsrhras&      r#�test_http_body_fileobj�#HandlerTests.test_http_body_fileobj
s���
�N�N�.�.�0��!�|�#��H��:�:�<���+�X�r�:�����s�#������*�*�+>�?��K�����*�*�+;�<�=�#�R�(���+�X�?�����s�#������V�.�.�/?�@�A�2�F�����*�*�+>�?�@����r&c�v�[OO2o[29p!m[
OQQ,o-Q]-1FD�o[OU[OQ59^tt^2o[QUOU2oUOU2oU%fDUOUOQ2P2UOUOQ2Q2L*UO[UOQ22]2PPP2J�	P!)%fhJ�9h)z-c�passrm)�stdoutrwrr~r)r+rrbr�r<�sys�
executable�
subprocess�Popen�PIPErr�rdrrprA)rrCr��cmdra�procrsrhs&       r#�test_http_body_pipe� HandlerTests.test_http_body_pipe$s���
�N�N�.�.�0��!�|�#��H��~�~�t�W�-���,�b�1�1�G��!�!�#�j�o�o�>�>�$��3�T�[�[�'�J�����s�+����$�$�V�%6�%6�7G�%H�$�O��$�$�V�%6�%6�7J�%K�%.�0��$�$�S��):�):�;K�)L�%M�%'�)�?�>�2�>�>�>�s�;0D'	�,A-D'	�'D8
�0D8
c	��[OO2o[29p!mQo-Q]-1FD�o[QU2U2oUO
U2oU%fEUOUOQ2P2UOUOQ2Q2JrUO[UOQ22]2J�	P!)c3� �Qw�	P!3h)sonerRrRr&r#�
iterable_body�;HandlerTests.test_http_body_iterable.<locals>.iterable_bodyBs
����L�s�	rmrwrr~r)
r+rrbr�r<rrdrrprA)rrCr�r�rarsrhs&      r#�test_http_body_iterable�$HandlerTests.test_http_body_iterable;s���
�N�N�.�.�0��!�|�#��H�	��,�b�1�1�G��/���'�J�C��]�]�3�'�F��� � ��!2�!2�3C�!D�d�K�� � ��!2�!2�3F�!G�!*�,�� � ��V�%6�%6�7G�%H�!I�2�N�2r&c��[OO2o[2UmUO[
QQ22oUOUOQ2Q2UOUOQ22P!)rwr~rrrR)r+rrbr�r<rdrrrprnrj)rrCrss&  r#�test_http_body_empty_seq�%HandlerTests.test_http_body_empty_seqOse���N�N�.�.�0���<����m�m�G�$9�2�>�?��������(;�<�i�H�������(8�9�:r&c	�@�[OO2o[29p!m[
O
Q,QN2o-Q]-1FDJo[
QV42oUOU2oUO[UOQ22]2JL	P!)rrmrwr)�r.��)r+rrbr�r<�arrayrrdrrArp)rrCr��iterable_arrayrarsrhs&      r#�test_http_body_array�!HandlerTests.test_http_body_arrayWs���
�N�N�.�.�0��!�|�#��H����S��3���,�b�1�1�G��/��I�C��]�]�3�'�F����S��!2�!2�3C�!D�E�b�I�2r&c�h�[OO[OO
Q]29^tt^2[
2o[2oUOU2UOQ2UOUO]2PPP2P!)%fhP!9h)rf�http://www.example.com)r�patchr�r:r��HTTPConnectionr	rbrXr�r�_debuglevel�rr�rCs&  r#�#test_http_handler_global_debuglevel�0HandlerTests.test_http_handler_global_debugleveldsr��
�Z�Z�
�
�t�{�{�9�9�<��
K�
K�� �A��!�A�
�M�M�!��
�F�F�+�,����Q�]�]�A�.�L�
K�
K�
K���AB � B1	�)B1	c��[2o[]Q5oUOU2UOQ2UO	UO
]2P!)�rer�)r	rbrXr�rr�r�s&  r#�"test_http_handler_local_debuglevel�/HandlerTests.test_http_handler_local_debuglevellsA������q�)��	�
�
�a��	���'�(��������*r&r�z)HTTPSConnection required for HTTPS tests.c�h�[OO[OO
Q]29^tt^2[
2o[2oUOU2UOQ2UOUO]2PPP2P!)%fhP!9h)rf�https://www.example.com)rr�r�r:r�r�r	r�rXr�rr�r�s&  r#�$test_https_handler_global_debuglevel�1HandlerTests.test_https_handler_global_debuglevelssr��
�Z�Z�
�
�t�{�{�:�:�L�!�
L�
L�� �A� �"�A�
�M�M�!��
�F�F�,�-����Q�]�]�A�.�M�
L�
L�
L�r�c��[2o[]Q5oUOU2UOQ2UO	UO
]2P!)r�rer�)r	r�rXr�rr�r�s&  r#�#test_https_handler_local_debuglevel�0HandlerTests.test_https_handler_local_debuglevel|sA�������*��	�
�
�a��	���(�)��������*r&c��[OO2o[2UmQo,QNoSFD�o[VB2oUO
U2oUOUOQ*Q2UOQP2UO
U2oUOUOQ*Q2J�	P!)r&r]r�zsomeproxy:3128)z#http://example.com/foo/bar/baz.htmlz$http://example.com//foo/bar/baz.htmlz$http://example.com/foo//bar/baz.htmlz$http://example.com/foo/bar//baz.html)
r+rrbr�r<rrdrrf�	set_proxy)rrCr��ds_urls�ds_url�ds_req�	np_ds_req�p_ds_reqs&       r#�test_http_doubleslash�"HandlerTests.test_http_doubleslash�s���
�N�N�.�.�0���<��������F��V�*�F��
�
�f�-�I����Y�8�8��@�-�P�
���-�t�4��}�}�V�,�H����X�7�7��?��O�r&c�v�,QNo[Q2oSFD�oV2m[U2oUOUO	2U2SOUO
9%fPUO
2UO[UO	22OUO2J�	P!)�http://example.com?foo=bar#bazr])r�z)http://example.com?foo=bar&spam=eggs#bashr])r�full_urlrrr��fragment�query)rrOr�rbrNs&    r#�test_full_url_setter�!HandlerTests.test_full_url_setter�s���
��
�(�)���C��J��c�]�F����Q�^�^�-�s�3�
���Q�Z�Z�-�-�2�v���?����X�a�n�n�&6�7�=�=�v�|�|�L�r&c���[Q2oU;UOUO2UOUO2UO	UO
P2P!)r�)rr�ror�rr)rr�s& r#�test_full_url_deleter�"HandlerTests.test_full_url_deleter�sJ���,�-��
�J����!�*�*�%����!�*�*�%�������R�(r&c��[OO2o[2UmQo[U2oUO
U2oUOUOQ2UOUOQ2Qo[U2oUO
U2oUOUOQ2UOUOP2P!)zhttp://www.python.org?getspam�www.python.orgz	/?getspam�http://www.python.org)
r+rrbr�r<rrdrrr)rrC�	weird_urlrsrh�url_without_paths&     r#�test_fixpath_in_weirdurls�&HandlerTests.test_fixpath_in_weirdurls�s���
�N�N�.�.�0���<���3�	��i� �����s�#��������&6�7�������+�6�2���&�'�����s�#��������&6�7�������"�-r&c���[OO2o[29p!mQo[U2o[
]�Q-PU2oUOVE2oUOVV2UOUQ2[
]�Q-PU2oUOVE2oUOVV2UOUQ2[
]�Q-PU2oUOVE2oUOVV2UOUQ2[
QQ-PU2oUOUOVE22UOUOQ2UOUOVEQQ-12P!)rwr r��AcceptedzPartial content�zBad gatewayr:)r+r�HTTPErrorProcessorr�r<rr�r�rJ�assertNotHasAttrrorr�r�)rrCr�rbrsr��newrs&      r#�test_errors�HandlerTests.test_errors�s=���N�N�-�-�/��!�|�#��H�#���c�l����d�B��C�0�����s�&���
�
�a�����a��)���j�"�b�#�6�����s�&���
�
�a�����a��)���/��R��=�����s�&���
�
�a�����a��)���m�R��S�9�����!�/�/�#�1�2�������&�)�������#�#�}�b�!A�Br&c�^�[2o[OOU2o[	2Um[
Q2o[]�Q-P2oUOU2oUOUOU2UOUOU2UOUOQ2UOUO2UOV42oUOUO U2UOUO"U2UOVF2P!)rwr r�)r�r+r�HTTPCookieProcessorr�r<rr�r�rJr�r�origin_req_hostrn�unverifiabler�r�r�)r�cjrCrsr�rhr�s&      r#�test_cookies�HandlerTests.test_cookies�s���
�_���N�N�.�.�r�2���<����+�,����d�B��+������$���
�
�b�j�j�#�&��
�
�b�j�j�&�)�����,�,�m�<�����)�)�*����s�&���
�
�b�i�i��%��
�
�b�g�g�q�!��
�
�a�r&c�\�QoQo[OO2o[29pCmQFCD�oQFCD�o[UQU*2o[
V2o[OUm	UOQQ2Ud%UOQ[[U222UOQQ2UU[2UQ[Q	U-22UO+UO,O/2U2UO+UO,O12Q
2UO,O8T
t,tFDp�O;2MJ	oo
UO=QU2UO=QU2UO+UO,O8Q*Q2UO=QUO,O82UO=QUO,O>2CJ�	CJ�	[
U2o[OUm	U1Q
ko[
UQQ5o]o
[OUm	UV8Q2U
]*o
J[O O"c?o	SO%SQ2SO'S2S	O)2Po	=	CK�Po	=	hh9h[2c*SO5SO,O62CK�h9htto
h[O O"cOo	SO+S
[OOO@2S	O)2Po	=	LPo	=	hh9h[
SQQ5o]o
[OSm	SX8QS
*2S
]*o
J[O O"cPo	SO+S
[OOOB2S	O)2Po	=	P!Po	=	hh9h)�http://example.com/a.html�http://example.com/b.htmlz
http_error_%s�Nonsensezviking=withholdrmrXr��Blah�locationr^zcontent-lengthzcontent-typec
�X�UOU[2QQ[QU-22P!)r�r�r�)r�r�r�)rCrsrbs&&&r#r��,HandlerTests.test_redirect.<locals>.redirect's'��
���S�(�*�c�6�(�*�c�):�;�
=r&r�)r�rwzhttp://example.com/%d)�-r��/�3�4)Nz
blah
blah
)r�r�)"r+r�HTTPRedirectHandlerr�r<�getattrrr�r�r�rlrNr/rrr�r�r�	HTTPErrorrM�assertIsNotNoner�rrsr��
get_method�AttributeErrorrnr�ra�lowerrerf�max_repeats�max_redirections)r�from_url�to_urlrCr�r�r�rrsrO�xrar�r�s&             r#�
test_redirect�HandlerTests.test_redirect�s;��.��,���N�N�.�.�0��!�|�#��H�,�D�,�� ��O�d�$:�;���h�-��$�<�<������z�+<�=��#��N�N�#3�S��T��^�D��+�+�F�F�;� ��3��
�D�&�&�
�F�';�<�>�� � ����!3�!3�!5�v�>�1��$�$�Q�U�U�%5�%5�%7��?�/0�e�e�m�m�<�m��7�7�9�m��<�� � �!1�7�;�� � ���9�� � ������z�!:�!2�4�� � �������7�� � �����)@�)@�A�?-�,�F�h����4�4���!'�	=��h�
�>�����4�4���	����!6�7���	���O�|�|�-�-� ��M�M�$�
�3��(�(��.��I�I�K�K��	 ��&�1��$�$�Q�U�U�Z�Z�0�1��
=��6�|�|�%�%�	����U�F�N�N�$F�$F�$R�$R�S��I�I�K�K��	���h�
�>�����4�4���	����!8�5�!@�A���	����|�|�%�%�	����U�#�^�^�?�?�P�P�
R��I�I�K�K��	�sz�I0�*K�
L�L�0K
�K
�3K�K
�	L�&L�L�M9�*M9�+AM4�4M9�!N=�=P+�P+�AP&�&P+c���Qo,QNo,QNoQo[OO2o[29pem[U2o[OUmSFD�oUQ*U*o	UO[OO29^tt^2o
UOU[2QQ[QU	-22PPP2W
OO!2J�	SFDeoUQ*U*oUOU[2QQ[QU-22UO#UO$O'2U2Jg	P!)%fhK�9h)	r�zexample.com/b.htmlz://r�zSecurity Loopholer��That's fine)r:�httpsr8)�file�imap�ldap)r+rr�r�r<rr�r�r�r-rr�r�r�r�r(r�rrsr�)rr��
valid_schemes�invalid_schemes�schemeless_urlrCr�rsr��invalid_url�cm�	valid_urls&           r#�test_invalid_redirect�"HandlerTests.test_invalid_redirectGs#��.��.�
�0��-���N�N�.�.�0��!�|�#��H��h����4�4���%�F� �5�.�>�9�K��"�"�6�<�<�#9�#9�:�:�b�� � ����S�*=���[� 9�:�<�;�
�L�L��� �
&�$�F�����7�I�
���S�(�*�c�=��Z��3�4�
6����Q�U�U�/�/�1�9�=�	$�
;�:�s�#)E 	� E0
�)E0
c
��QoQo[OO2o[29pCm[U2o[OUm[OOV2oUOU[2QQ[QU-22UOUOO!2U2P!)r�z/b.htmlr�rr�)r+rr�r�r<rr�r�r�r�urljoinr�r�r�rrsr�)rr��relative_urlrCr�rsrs&      r#�test_relative_redirect�#HandlerTests.test_relative_redirect_s���.�� ���N�N�.�.�0��!�|�#��H��h����4�4����L�L�(�(��?�	�	����h�j�#�}���Y�/�0�	2�������+�+�-�y�9r&c��]QHGo]QH
GoU2oUUQQ2[	QQ2o[
OO2o[
OO2o[
OOU2o[VEVg2oUOQ2UOUOOQ22P!)r)�	CookieJar)�interact_netscapezhttp://www.example.com/z	spam=eggsr�z%Location: http://www.cracker.com/

ro)�http.cookiejarr�test.test_http_cookiejarrrtr+r�HTTPDefaultErrorHandlerr�r�r`r�rnrsrj)	rrrr��hh�hdeh�hrh�cpr�s	&        r#�test_cookie_redirect�!HandlerTests.test_cookie_redirectls���,�>�
�[���"�7��E�
$�S�*U�
V���~�~�5�5�7���n�n�0�0�2��
�^�^�
/�
/��
3���b��0��	���(�)�������*�*�8�4�5r&c�@�Qo[QQU*2o[OO2o[OO	2o[V#U2oUO
Q2oUOUO2UO22P!)z(http://www.example.com/index.html#OK

r�z
Location: r�)
rtr+rrr�r`r�rr��strip)r�redirected_urlrrrr�r�s&      r#�test_redirect_fragment�#HandlerTests.test_redirect_fragment{sv��G��
$�S�,��*G�
H���~�~�5�5�7���n�n�0�0�2���b��,��
�V�V�,�
-���������n�&:�&:�&<�=r&c�```�RO[OO2[O
OnQo[OU2[O
mRO[[O
QR2[Q2nUUU1QkoU[O
Om[OOQ2oROUO2Q2P!)s(HTTP/1.1 302 Found
Location: ?query

r�c�:�ROU[R22ROVU,UN3-U@QUOmP!)sHTTP/1.1 200 OK

Hello!)r�nextrr1�fakedata)�connrrb�pos�kw�
real_classrrOs&&&*,���r#r�3HandlerTests.test_redirect_no_path.<locals>.request�s=������S�$�t�*�-����t�S�=�3�=�"�=�&F�D�N�N�#r&zhttp://python.org/pathzhttp://python.org/path?query)z/pathz/path?query)r*r+rr,r:r�r�r�fakehttpr0�iterr/rr�)r�	response1rr�r+rOsf   @@r#�test_redirect_no_path�"HandlerTests.test_redirect_no_path�s����	
������1�1�2��[�[�/�/�
�E�	�%0�%9�%9�)�%D����"��������.>�
�K��,�-��	G�
.5����"�"�*�
�^�^�
#�
#�$<�
=���������&D�Er&c	��QQ[OO2oU2o[OOU2oQoSFD�vqVUO	[U229^tt^2[OQU*Q*2UmUOQ2oQU*Q*oUOo	UOV�2PPP2J�	P!)%fhJ�9h)c�(`�\sQsQsnQsQsUsP!)�4HandlerTests.test_redirect_encoding.<locals>.Handleri�c��UOUOU2oUOOUm[O
Q2UmU!)s)HTTP/1.1 200 OK
Content-Length: 3

123)rl�
connection�buf�last_bufrr-)rrs�results&& r#rn�>HandlerTests.test_redirect_encoding.<locals>.Handler.http_open�sE�����d�o�o�s�;�� $��� 3� 3��
�"-�"6�"6��#����
r&)r6r8)rSrrTrUrnrVrWrXs@r#�Handlerr4�s����

�

r&r;s!HTTP/1.1 302 Redirect
Location: s

rwsGET � ))s/på-dansk/s/p%C3%A5-dansk/)�/spaced%20path/r=)s
/spaced path/r=)s/?på-dansks/?p%C3%A5-dansk)r+r�HTTPHandlerr.�subTest�reprrr-r6r�r8�assertStartsWith)
rr;r�rYrEr�r9rr�rs
&         r#�test_redirect_encoding�#HandlerTests.test_redirect_encoding�s���	�f�n�n�0�0�	��)�����,�,�W�5��
��#(��X����d�8�n�-�-�%0�%9�%9�"�$,�-�0��&��"�
"�;�;�'<�=��"�V�+�d�2��!�*�*���%�%�g�8�.�-�#(�-�-�-�s�7A(C-	�-C>
�6C>
c���QoQo[OO2o[UQQ5o[	2oUOVEQQ-U2oUO
UO2Q2P!)r�r��HEAD�rr��Found)r+rr�rr�r�rr�)rr�r�rCrsr��new_reqs&      r#�test_redirect_head_request�'HandlerTests.test_redirect_head_request�sb��.��,���N�N�.�.�0���h�v�.��
�Z���$�$�S�c�7�B��G������+�+�-�v�6r&c�
�Qo[UQ5[UQ51FD�o[2o[OO	U2oUOU2Q,,o[
V52o[Q2oUOUOQ2UOU2UOUOU2SOU]*Q1,UOTt,tFDp�Q*MJ
	to2J�	P!ttoh)�proxy.example.com:3128�r:)�HTTPrnzhttp://acme.example.com/zacme.example.com�rr.N)rnr7)rqr	r+r�ProxyHandlerrXr]rrrr�r=)	r�ur}r��phrZr[rs�tups	&        r#�
test_proxy�HandlerTests.test_proxy�s���$���1��t��|�+�A�� �A����,�,�Q�/�B�
�M�M�"��1�2��I�1��>�H��4�5�C����S�X�X�'9�:�
�F�F�3�K����S�X�X�q�)����x��{�K�8�9�23�'�'�:�'�3�#�h�h�'�:�
<�,��;s� Dc�2�UO[O22oQUQ$[2o[O
O
[QQ52oUOU2[Q2oUOUOQ2UOU2UOUOQ2[Q2oUOUOQ2UOU2UOUOQ2P!)z
python.org�no_proxy�proxy.example.comrMzhttp://www.perl.org/�www.perl.orgr�r��
�enterContextr�EnvironmentVarGuardr	r+rrPrqrXrrrr��r�envr�rRrss&    r#�test_proxy_no_proxy� HandlerTests.test_proxy_no_proxy�s������	� =� =� ?�@��&��J�����
�^�^�
(�
(��3F�)G�
H��	�
�
�b���,�-��������>�2�	���s��������#6�7��-�.��������#3�4�	���s��������#3�4r&c��UO[O22oQUQ$[2o[O
O
[QQ52oUOU2[Q2oUOUOQ2UOU2UOUOQ2P!)�*rWrXrMr�r�rZr]s&    r#�test_proxy_no_proxy_all�$HandlerTests.test_proxy_no_proxy_all�s������	� =� =� ?�@����J�����
�^�^�
(�
(��3F�)G�
H��	�
�
�b���-�.��������#3�4�	���s��������#3�4r&c	���[2o[OO[	QQ52oUOU2Q,,o[
V2o[Q2oUOUOQ2UOU2UOUOQ2SOU]*Q1,UOTt,tFDpfQ*MJ
	to2P!ttoh)rL�rr��https://www.example.com/�www.example.comrO)r�r7)r	r+rrPrqrXr]rrrr�r=)rr�rRrZr[rsrSs&      r#�test_proxy_https�HandlerTests.test_proxy_https�s������
�^�^�
(�
(��4L�)M�
N��	�
�
�b��
.�/�
�	�-�Q�:���0�1��������#4�5�	���s��������#;�<����8�A�;��5�6�./�g�g�6�g�s�c�(�(�g�6�	8��6s�C(
c��[2o[OO[	QQ52oUOU2[
2oUOU2[Q2oUOQQ2UOQQ2UOUOQ2UOUO2UOU2UOQ	UOO 2UO#Q
UOO 2UO%UO2UOUOQ2UOUO'Q2Q2P!)rLrfrg�Proxy-Authorization�FooBarrp�Grailrh�Proxy-authorization)rlrm)rprn)r	r+rrPrqrXr�rrlrrrorr�rerhrrMr�rp)rr�rR�
https_handlerrss&    r#�$test_proxy_https_proxy_authorization�1HandlerTests.test_proxy_https_proxy_authorizations#�����
�^�^�
(�
(��4L�)M�
N��	�
�
�b��(�*�
�	�
�
�m�$��0�1�����,�h�7����|�W�-�������#4�5����#�*�*�+�	���s��	
���:�&�/�/�;�;�	=��
�
�-�#�,�,�8�8�	:����S�-�-�.�������#;�<�������(=�>��Ir&r)zonly relevant for Windowsc��Qo[oQFD"oUOUV12QU*2J$	QFD"oUOUV12QU*2J$	QoUOUQU2QW*2UOUQU2QU*2Q	FD"oUOUV12QU*2J$	P!)
z*www.example.com;*.example.net; 192.168.0.1z expected bypass of %s to be truer��example.net�!expected bypass of %s to be Falsezexample.com; <local>z.expect <local> to bypass intranet address '%s')rhzwww.example.netz192.168.0.1)r�zwww.example.orgrtz192.168.0.2)�testr)r
rirn)r�proxy_override�proxy_bypassrs&   r#�test_winreg_proxy_bypass�%HandlerTests.test_winreg_proxy_bypasss���E��4��I�D��O�O�L��>�>��E�
G�J�$�D����\�$�?�@�4�G�
I�$�0������]�N�C�:�T�A�	C�����m�^�D�<�t�C�	E�)�D��O�O�L��>�L�"�#�
$�*r&�darwinzonly relevant for OSXc��QP
Q,Q	N-oQ
FD%oUO[V!2QU*2J'	QFD%oUO[V!2QU*2J'	QP	Q,-oUO[QU22QP
QQQ,-oQoUO[V!2QU*2QoUO[V!2QU*2P!)�exclude_simple�
exceptionsz expected bypass of %s to be Truerurvz10.0.0.0/40z172.19.10.0/24z172.19.10.5z10.0.1.5)�foo.barz	*.bar.com�	127.0.0.1z10.10z10.0/16)rzwww.bar.comr�z	10.10.0.1z10.0.0.1)zabc.foo.barzbar.comz	127.0.0.2z	10.11.0.1�notinbypass)rirrn)r�bypassrs&  r#�test_osx_proxy_bypass�"HandlerTests.test_osx_proxy_bypass0s���
�e��&�
��!�D��O�O�8��F�>��E�
G�!�
�D����9�$�G�@�4�G�
I��#�D�,��;�����4�V�V�D�E�
�e��M�+;�=�
�������4�T�B�:�T�A�	C������5�d�C�;�d�B�	Dr&c��UOV!Q59^tt^2[2o[2o[OOU2oQO
U2Q*o[QU2oUOU2UOU2UOV5QV'UQQ2PPP2P!)%fhP!9h))r�raz
r~�r��!http://acme.example.com/protected)
r?r	r�r+rr
�joinrtrX�_test_basic_auth)rrar�rY�password_manager�auth_handlerr�http_handlers&&&     r#�check_basic_auth�HandlerTests.check_basic_authRs���
�\�\��\�
7�
7�#�%�F�2�4��!�>�>�>�>�?O�P�L��;�;�w�'�*�4�D�2�3��=�L����|�,����|�,��!�!�&��"'�7G�"E�"E�
G�8�
7�
7�
7�s�BB6�6C	�?C	c
��QoQoQUQ0oQUQ0oQoQUQ0oQUQ0QUQ0QUQ0UQ	U0UQ	U0UQ	U0UQ	U0UQ	U01FDoQ
U0,oUOV�2J	[OQ[129^tt^2QU0,oUOV�2PPP2V4,V6,Vc,1FD)o	S	T
t,tFDo
Q
U
0MJ
	oo
UOV�2J+	P!)%fhKH9htto
h)
zrealm2@example.comz
Basic realm="�"zOtherscheme xxxzDigest realm="zn", qop="auth, auth-int", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", opaque="5ccc069c403ebaf9f0171e9517f40e41"z
Basic realm='�'z", charset="UTF-8"z, zWWW-Authenticate: zBasic Auth Realm was unquotedzWWW-Authenticate: Basic realm=)r�r�check_warnings�UserWarning)rr��realm2�basic�basic2�other_no_realm�digest�	realm_strra�
challenges�	challenges&          r#�test_basic_auth�HandlerTests.test_basic_auth`s���$��%����w�a�(�� ����*��*��"�6�(�+>�?���E�7�!�$��E�7�!�$��E�7�"4�5��g�R��x� ��g�R��'�(���b���(��g�R��x� ��h�b��� �
�I�,�I�;�7�8�G��!�!�'�1�!
�&�
+�
+�-L�%0�-2�3�3�7��w�?�@�G��!�!�'�1�3���
��
�O�
�J�)3�4�(2�9�,�I�;�7�(2�
�4��!�!�'�1�
�3�3��4s�C$�;C7�$C4	�-C4	c
�|�[2o[OO[	QQ52oUOU2[
2o[OOU2oQo[QQU*2oUOU2UOU2UOVQVVUQQ2P!)rLrM�
ACME Networks�z(Proxy-Authenticate: Basic realm="%s"

roz&http://acme.example.com:3128/protected)
r	r+rrPrqrXr��ProxyBasicAuthHandlerrtr�)rrYrRr�r�r�r�s&      r#�test_proxy_basic_auth�"HandlerTests.test_proxy_basic_auth�s����!��
�^�^�
(�
(��3K�)L�
M�����2��.�0���~�~�;�;�<L�M����.��?�%�G�I�����<�(����<�(����f�4I�#�3C�F�6�	 r&c
��QQ[2oQQ[OO2oQQ[OO2oU2o[2oUU2oUU2oQo[
QQU*2o	UOU2UOU2UOU	2UOVGQ	V�UQ
Q
2UOUOQQ,]*2P!)
c�.`�\sQsQsnQsQsQsUsP!)�QHandlerTests.test_basic_and_digest_auth_handlers.<locals>.RecordingOpenerDirectori�c�B�[OU2,UmP!r�)r	r��recordedr�s&r#r��ZHandlerTests.test_basic_and_digest_auth_handlers.<locals>.RecordingOpenerDirector.__init__�s���'�'��-� "��
r&c�>�UOOU2P!r�)r�r>)rr�s&&r#�record�XHandlerTests.test_basic_and_digest_auth_handlers.<locals>.RecordingOpenerDirector.record�s���
�
�$�$�T�*r&)r�)rSrrTrUr�r�rVrWrXs@r#�RecordingOpenerDirectorr��s����
#�
+�
+r&r�c�(`�\sQsQsnQsQsUsP!)�OHandlerTests.test_basic_and_digest_auth_handlers.<locals>.TestDigestAuthHandleri�c��UOOQ2[OOO
U,UN3-U@P!)r�)r<r�r+r�HTTPDigestAuthHandler�http_error_401�rr�rCs&*,r#r��^HandlerTests.test_basic_and_digest_auth_handlers.<locals>.TestDigestAuthHandler.http_error_401�sA�����"�"�8�,����4�4�C�C�D�L�>B�L�FJ�Lr&rR�rSrrTrUr�rVrWrXs@r#�TestDigestAuthHandlerr��s����
L�
Lr&r�c�(`�\sQsQsnQsQsUsP!)�NHandlerTests.test_basic_and_digest_auth_handlers.<locals>.TestBasicAuthHandleri�c��UOOQ2[OOO
U,UN3-U@P!)r�)r<r�r+rr
r�r�s&*,r#r��]HandlerTests.test_basic_and_digest_auth_handlers.<locals>.TestBasicAuthHandler.http_error_401�sA�����"�"�7�+����3�3�B�B�4�K�=A�K�EI�Kr&rRr�rXs@r#�TestBasicAuthHandlerr��s����
K�
Kr&r�r�r��&WWW-Authenticate: Basic realm="%s"

r�r�r�r�)r	r+rr�r
r�rtrXr�rr�)
rr�r�r�rYr��digest_handler�
basic_handlerr�r�s
&         r#�#test_basic_and_digest_auth_handlers�0HandlerTests.test_basic_and_digest_auth_handlers�s���	+�n�	+�	L�F�N�N�$H�$H�	L�	K�6�>�>�#F�#F�	K�)�*��.�0��.�/?�@��,�-=�>�
���.��=��E�G�����=�)����>�*����<�(�	
���f�_�#�3C�A�A�	 �	
������8�W�*=�a�*?�@r&c��[2o[OOP2o[	QQ2oUOU2UOU2UO
[UOQ2P!)Nr�zWWW-Authenticate: Kerberos

r�)	r	r+rr�rtrXr-r.r�)rrY�digest_auth_handlerr�s&   r#�$test_unsupported_auth_digest_handler�1HandlerTests.test_unsupported_auth_digest_handler�sc���!��$�n�n�B�B�4�H��.��5�7�����.�/����<�(����*�f�k�k�3K�Lr&c��[2o[OOP2o[	QQ2oUOU2UOU2UO
[UOQ2P!)Nr�zWWW-Authenticate: NTLM

r�)	r	r+rr
rtrXr-r.r�)rrY�basic_auth_handlerr�s&   r#�#test_unsupported_auth_basic_handler�0HandlerTests.test_unsupported_auth_basic_handler�sc���!��#�^�^�@�@��F��.��1�3�����-�.����<�(����*�f�k�k�3K�Lr&c	��]PHo	QQq�UOVGV�2UOVFO2UOVvO2UOV�O
2UOV�O2UOU2UOUOU2UOUOU2UO[UO2]2UOUO]*OU22[U
8QU80Q2oQU	OU2O!2O#2*o
UOUO]*O%U2U
2UOUO]*O&U*U
2P9UmUmUO)2UOU2UO[UO2]2UOUO]*OU22P!)r�wile�coyote�:�asciizBasic )�base64r�rr�rbr�ryr�r�r�r/r{rnrj�bytes�encodebytesr �decoderprfrw)rrYr��auth_headerr�r�r��request_url�
protected_urlr�r�ry�userpass�auth_hdr_values&&&&&&&&&     r#r��HandlerTests._test_basic_auth�s���	���h�	�!�!�%�d�E����� 6� 6�7�����&:�&:�;�����4�4�5�����#<�#<�=����K� �	
���)�6�6��>����)�4�4�m�D�	
����\�2�2�3�Q�7�����.�.�q�1�<�<�[�I�J��D�(�3�W�=��"����x�(�.�.�0�7�7�9�:������.�.�q�1�<�<�[�I�'�	)�����.�.�q�1�C�C�K�P�'�	)�=A�@��� 0� 9��������K� �����\�2�2�3�Q�7�����.�.�q�1�<�<�[�I�Jr&c��QQq!Qo[]�2o[2o[U2oUOPV1UP	Q5UO	UOU22UO	UOUQ*22UO
UOUQ*22[2oUOU2UOU2UOU2UO	UO2P!)r�r�r�)�is_authenticatedz/nested�plain)r�rr
r�rir�rnr	rXr�r�)rr�ryr�r��pwd_manager�auth_prior_handlerrYs&       r#�test_basic_prior_auth_auto_send�,HandlerTests.test_basic_prior_auth_auto_send	s��� ��h�9��/��4��2�4��1�+�>���'�'��+�X��	(�	F�	
����4�4�[�A�B�����4�4�[�9�5L�M�N�����5�5�k�G�6K�L�M��!�����-�.����<�(����K� �	
����4�4�5r&c��QQq!QoQo[2o[U2oUOVCV2UOU2oUO	U2[2oUO
U2[QQP*2o	UO
U	2UOU2UOU2oUOU2[]�2o	UO	U	O2[2oUO
U2UO
U	2UOU2UOU	O2P!)r�r�r��ACMEr�r�)rr
r�r�rnr	rXrtr�rir�r�)
rr�ryr�r�r�r��is_authrYr�s
&         r#�.test_basic_prior_auth_send_after_first_success�;HandlerTests.test_basic_prior_auth_send_after_first_success$s�� ��h�9����2�4��1�+�>���'�'��D�K��.�.�{�;������!��!�����-�.�.��=��D�F�����<�(����K� ��.�.�{�;������ �/��4������5�5�6��!�����-�.����<�(�	���K� �	
����4�4�5r&c	���QFD�vqQOU2o[OUO2U*2o[O
O
2o[Q2oPUmUOVF29^tt^2oUO2PPP2UOUOOQOU22J�	P!)%fhKK9h)z=Test the connection is cleaned up when the response is closedzHTTP/1.1 200 OK
{}

�
http://dummy/zConnection not closed with {!r}))zConnection: close�data)zTransfer-Encoding: chunkeds4
data
0

)zContent-Length: 4r�)�formatrr-�encoder+rrbrr�rlr7ri�fakesock�closed)r�transferr��headerr(r�rs�resps&       r#�test_http_closed�HandlerTests.test_http_closedLs���!
��X�
5�;�;�H�E�F��'�'��
�
��$�(>�?�D��n�n�8�8�:�G��/�*�C��C�K�����+�+�t��	�	��,��O�O�D�M�M�0�0�1�8�8��B�
D�!
�,�+�s�C#	�#C3
�,C3
c��[OQ2o[OO	2o[Q2oPUmUO[OO29^tt^2UOV2PPP2UOUOOQ2P!)%fhK89h)z;Test the connection is cleaned up after an invalid responser&r�zConnection not closed)rr-r+rrbrr�r-r:r��
BadStatusLinerlrir�r�)rr(r�rss&   r#�test_invalid_closed� HandlerTests.test_invalid_closed]s����#�#�C�(���.�.�4�4�6���o�&�����
�
�
�t�{�{�8�8�
9�
9��O�O�D�&�:�����
�
�,�,�.E�F�:�
9�s�9B;�;C	�C	rR)ArSrrTrUrr�requires_resourcer1rTrirxr�r�rr�r�r�r�r�r�r=�
skipUnlessrMr:r�r�r�r�r�r�r�r�r�r�rrrr"r0rBrIrTr_rcrirqr0r6ryr��platformr�r�r�r�r�r�r�r�r�r�r�r�rVrWrXs@r#r�r��s����>�@
���y�)�8�*�8�*]5�~@C�DR�:E�2�.��)��)�,O�(;�J�/�+��������.?�@�Bm�n�/�o�/��������.?�@�Bm�n�+�o�+�P�6M�.)�.�&C�2�"K�Z>�0:�
6�>�F�(!9�F7�<�$
5�	5�8� �������.?�@�Bm�n�J�o�J�.������D��*E�F�$�G�$�.�������1�3J�K�D�L�D�BG�+2�Z �"0A�dM�M�#K�J6�6&6�PD�"G�Gr&r�c�@`�\sQsQsnQsQsQsQsQsQs	Us
P!)�	MiscTestsihc��`�SO[9PIc5U1QkUO2D%fJP	2P!	P
2P!U1QkUO222P!)c3�N:�SF �DoUOR6Hw�	J	P!3hr�)r1)�.0rC�
handler_classs& �r#�	<genexpr>�/MiscTests.opener_has_handler.<locals>.<genexpr>ks��%4���%4���K�K�=�8�%4�s�%)ri�anyr[)rrYr�s&&fr#�opener_has_handler�MiscTests.opener_has_handlerjsL��������6�%+�_�_�6���	7��	7��6�%+�_�_�6�6�	7r&c��QQ[OO2oQQ[OO2oQQ[OO2o[OOoUV#2oUOVR2UOVS2UV#22oUOVR2UOVS2UU2oUOVQ2U2oUOU[OO2U[OO2oUOU[OO2U[OO22oUOU[OO2QQ[OO2oUV2oUOVQ2UOVV2P!)c��\sQsQsQsP!)�2MiscTests.test_build_opener.<locals>.MyHTTPHandleriorRrUrRr&r#�
MyHTTPHandlerrorWr&rc�(`�\sQsQsnQsQsUsP!)�/MiscTests.test_build_opener.<locals>.FooHandlerirc��P!r�rRr�s&r#�foo_open�8MiscTests.test_build_opener.<locals>.FooHandler.foo_opensrr&rR)rSrrTrUr	rVrWrXs@r#�
FooHandlerrr�����
�
r&rc�(`�\sQsQsnQsQsUsP!)�/MiscTests.test_build_opener.<locals>.BarHandlerivc��P!r�rRr�s&r#�bar_open�8MiscTests.test_build_opener.<locals>.BarHandler.bar_openwrr&rR)rSrrTrUrrVrWrXs@r#�
BarHandlerrvrr&rc��\sQsQsQsP!)�7MiscTests.test_build_opener.<locals>.MyOtherHTTPHandleri�rRrUrRr&r#�MyOtherHTTPHandlerr�rWr&r)r+rr>�BaseHandlerr.r)rrrrr.r�rs&      r#�test_build_opener�MiscTests.test_build_openerns���	�F�N�N�6�6�	�	����3�3�	�	����3�3�	��~�~�2�2����0������.�����.�
��Z�\�2������.�����.�
��'������1�
�N������6�>�>�#=�#=�>�����3�3�4������6�>�>�#=�#=�>�����3�3�5�6������6�>�>�#=�#=�>�	����!;�!;�	�
��;������1�����6r&c��QoP9o9q4Qo[OOV#VU2oUOUQ2UO	UO
Q2UOUQ2UO	UOQ2QUO8QUO80oUO	[U2U2QUO8QUO8Q0oUO	[U2U2UO2P!)	z}
Issue 13211 reveals that HTTPError didn't implement the URLError
interface even though HTTPError is a subclass of URLError.
zsomething bad happenedzContent-Length: 42rKrazHTTP Error z: z<HTTPError �>)r+rr��
assertHasAttrrrKrar�r�rNr@r�)rr�rbr�r�rgrO�expected_errmsgs&       r#�test_HTTPError_interface�"MiscTests.test_HTTPError_interface�s���
'������d�#���l�l�$�$�S��2�>�����3��)�������%=�>����3�	�*�������&:�;�14���3�7�7�C������S��?�3�25�(�(�C�G�G�D������c��O�4��	�	�r&c��[OOQQQPP2oUO[	UQQ2Q2UOUOO2[2UO2P!)rb�zMETHOD NOT ALLOWED�	__notes__rR)
r+rr�rr�r�r�r7r�r�)rr�s& r#�
test_gh_98778�MiscTests.test_gh_98778�s[���L�L�"�"�5�#�/C�T�4�P�������K��4�b�9����a�d�d�i�i�k�5�1�	���	r&c��,QNoSFD vq#UO[U2U2J"	UO[[Q21P!)rXzfile:/ftp.example.com)�rX)NNNrX�rL)NNNrLr%r&)zjoe:password@proxy.example.com)NrxryrX)z#joe:password@proxy.example.com:3128)NrxryrL)zhttp://proxy.example.com/)r:NNrX)zhttp://proxy.example.com:3128/)r:NNrL)z&http://joe:password@proxy.example.com/�r:rxryrX)z*http://joe:password@proxy.example.com:3128)r:rxryrL)z1ftp://joe:password@proxy.example.com/rubbish:3128)r8rxryrX)z%http://joe:password@proxy.example.comr')z&http://user/name:password@localhost:22)r:�	user/namery�localhost:22)z&http://username:pass/word@localhost:22)r:�username�	pass/wordr))z'http://user/name:pass/word@localhost:22)r:r(r+r))rrr-r.)r�parse_proxy_test_cases�tcr�s&   r#�test_parse_proxy�MiscTests.test_parse_proxy�sF��$"
��N3�L�B����\�"�-�x�8�3�	
���*�l�4K�L�Mr&rR)rSrrTrUrrrr"r.rVrWrXs@r#r�r�hs&����7�*7�X�&�+N�+Nr&r�zEconservative skip due to OpenSSL FIPS mode possible algorithm nerfingc�^`�\sQsQsnQs\Q2s\Q2s\Q2sQs	Qs
UsP!)�TestDigestAuthAlgorithmsi�c�&�[2UmP!r�)rr�r�s&r#�setUp�TestDigestAuthAlgorithms.setUp�s��0�2��r&c��UOOQ2vqUOUQ2Q2UOUQQ2Q2P!)�MD5r�� acbd18db4cc2f85cedef654fccc4a4d8r�� 4e99e8c12de7e01535248d2bac85e732�r��get_algorithm_implsr�r�H�KDs&  r#�test_md5_algorithm�+TestDigestAuthAlgorithms.test_md5_algorithm�sE�����0�0��7�������5��#E�F�����E�5�)�+M�Nr&c��UOOQ2vqUOUQ2Q2UOUQQ2Q2P!)�SHAr��(0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33r��(54dcbe67d21d5eb39493d46d89ae1f412d3bd6der9r;s&  r#�test_sha_algorithm�+TestDigestAuthAlgorithms.test_sha_algorithm�sE�����0�0��7�������5��#M�N�����E�5�)�+U�Vr&c��UOOQ2vqUOUQ2Q2UOUQQ2Q2P!)zSHA-256r��@2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7aer��@a765a8beaa9d561d4c5cbed29d8f4e30870297fdfa9cb7d6e9848a95fec9f937r9r;s&  r#�test_sha256_algorithm�.TestDigestAuthAlgorithms.test_sha256_algorithm�sE�����0�0��;�������5��#e�f�����E�5�)�+m�nr&c��UO[29^tt^2oUOOQ2PPP2UO	[WO2Q2P!)%fhK79h)�invalidz5Unsupported digest authentication algorithm 'invalid')r-r.r�r:rrNr()r�excs& r#�test_invalid_algorithm�/TestDigestAuthAlgorithms.test_invalid_algorithm�sR��
�
�
�z�
*�
*�c��L�L�,�,�Y�7�+������
�
��C�	
�+�
*�s�A*�*A:	�3A:	)r�)rSrrTrUr3�skip_libssl_fips_moder>rDrIrNrVrWrXs@r#r1r1�sV����3��O��O�
�W��W�
�o��o�

�
r&r1c�`�\sQsQsnQQ\2sQsQsQsQs	Qs
Q	sQ
sQs
QsQ
sQsQsQsQsQsUsP!)�RequestTestsic��\sQsQsQsQsP!)�RequestTests.PutRequesti�PUTrR)rSrrTrUrrVrRr&r#�
PutRequestrTs���r&rVc���[Q2Um[QQQQ-Q5Um[QQQ5UmUO	Q2UmUO	QQQ5UmP!)�http://www.python.org/~jeremy/r�zX-Testrvr`rErFr_)rr�post�headrV�put�
force_postr�s&r#r3�RequestTests.setUp
sf���;�<����<�"�%-�v�$6�8��	��<�V�L��	��?�?�#C�D����/�/�*J��*���r&c��UOQUOO22UOQUOO22UOQUOO22UOQUO
O22UOQUOO22P!)r_r^rErU)rrYr�rrZr[r\r�s&r#�test_method�RequestTests.test_methods����������!5�!5�!7�8�������� 3� 3� 5�6��������!5�!5�!7�8�������� 3� 3� 5�6��������!;�!;�!=�>r&c�f�UOUOO2UOQUOO	22QUOmUOUOO2UOQUOO	22P!)r^r�r_)rnrr�rr�rir�s&r#�	test_data�RequestTests.test_datasq����������'�������� 3� 3� 5�6�����
�������
�
�&��������!4�!4�!6�7r&c�T�UOQUOO2UOOQ]*2UO	]*UOOQ*2QUOmUOQUOO2P!)rr�)rerrfrrrr�r�s&r#�.test_setting_data_should_remove_content_length�;RequestTests.test_setting_data_should_remove_content_length%sx�����)�4�8�8�+E�+E�F����(�(�)9�2�>�����T�X�X�7�7�8H�I�J�����
����)�4�8�8�+E�+E�Fr&c�l�UOQUOO2QUOmUOO	Q]2UO]UOOQ*2UO;UOQUOO2P!)rr�)rerrfr�rrrr�s&r#�/test_deleting_data_should_remove_content_length�<RequestTests.test_deleting_data_should_remove_content_length-s������)�4�8�8�+E�+E�F�����
����(�(�)9�1�=�����D�H�H�6�6�7G�H�I��H�H�M����)�4�8�8�+E�+E�Fr&c�\�UOQUOO22P!)rX)rrr�r�s&r#�test_get_full_url�RequestTests.test_get_full_url5s#�����9����.�.�0�	2r&c��UOQUOO2[Q2oUOQUO2P!)z	/~jeremy/zhttp://www.python.org/r()rrrrrms& r#�
test_selector�RequestTests.test_selector9s;������d�h�h�&7�&7�8��.�/������c�l�l�+r&c�T�UOQUOO2P!rM)rrrKr�s&r#�
test_get_type�RequestTests.test_get_type>s�����������/r&c�T�UOQUOO2P!)r�)rrrr�s&r#�
test_get_host�RequestTests.test_get_hostAs�����)�4�8�8�=�=�9r&c�V�[Q2oUOQUO2P!)zhttp://www.%70ython.org/r��rrrrms& r#�test_get_host_unquote�"RequestTests.test_get_host_unquoteDs"���0�1�����)�3�8�8�4r&c�|�UOUOO22UOOQQ2UO	UOO22UOQUOO2UOQUOO2P!)rYr:r�)rnr�	has_proxyr�rirr�rr�s&r#rT�RequestTests.test_proxyHs}��������+�+�-�.������>�6�2�������*�*�,�-����)�4�8�8�+C�+C�D����������7r&c�V�[Q2oUOQUO2P!)z<URL:http://www.python.org>r�rwrms& r#�test_wrapped_url�RequestTests.test_wrapped_urlOs"���3�4�����)�3�8�8�4r&c��[Q2oUOQUO2[Q2oUOQUO2Qo[U2oUOUO2U2P!)�-http://www.python.org/?qs=query#fragment=truez
/?qs=queryzhttp://www.python.org/#fun=truer(�.http://docs.python.org/library/urllib2.html#OK)rrrr�)rrsrbs&  r#�test_url_fragment�RequestTests.test_url_fragmentSsi���E�F������s�|�|�4��7�8������c�l�l�+�?���c�l������)�)�+�S�1r&c��,QNoSFD8o[U2oUOUO2UO2J:	P!)�http://docs.python.org)r�r�r�)rrr�r�)rrOrbrss&   r#�test_url_fullurl_get_full_url�*RequestTests.test_url_fullurl_get_full_url^s<��A���C��#�,�C����S�-�-�/����>�r&)r\rrZrYr[)rSrrTrUrrVr3r_rbrerhrkrnrqrtrxrTr~r�r�rVrWrXs@r#rRrRs^�����W���?�8�G�G�2�,�
0�:�5�8�5�	2�?�?r&rR�__main__)Gr=rvr�test.supportrrrrrr0r�rr�r�r�r�r��urllib.requestr+rr	r
rrr
rr�urllib.parserr��http.clientr:�requires_working_socket�TestCaserr[r�r�rqr�r�r�r�r��IOBaser�rr&r]r`rr>rbrrtrMr��HTTPSHandlerr�r�r�r�r�r��skipIf�is_libssl_fips_moderPr1rRrS�mainrRr&r#�<module>r�s����"�,�(���	�	�
�
��
����7�7�7�
"������t�,�-,�8�$�$�-,�`x'�x�(�(�x'�v,�,�
�
�#�$�#�
	�2�;�;�	�3�3�?�?��r�y�y��$*
�*
�Z38�38�l�D�0�f�n�n�0�0�0�H�f�n�n�8�8�H�8�4�;�;�)�*�*�	4�6�>�>�6�6�	4�Q�v�~�~�9�9�Q�&
(�
(�_A�(�+�+�_A�DGG�8�$�$�GG�T$vN��!�!�vN�r!������!�K���
�x�0�0�
�>^?�8�$�$�^?�B�z���M�M�O�r&

Youez - 2016 - github.com/yon3zu
LinuXploit