403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.84
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_httplib.cpython-315.opt-2.pyc
R
>lqjb�c��]PHs]PHs]QHGsGs]PHs]PHs]PHs]PH s]PH$s	]PH(s
]PH,s]PH0s]QH0G
s
\Os]QH<Gs]QHDGs]QHDGs\O(P	Q5\O*O-\2s\O*O3\QQ2s\O*O3\QQ	2s\O*O3\QQ
2sQsQsQ
sQs Q\*Q*s!Qs"Qs#\OHs$QQ2s%QQ\%2s&QQ\ON2s(QQ\OR2s*QQ\2s+QQ\2s,QQ\2s-Q Q!\2s.Q"Q#\2s/Q$Q%\/2s0Q&Q'\/2s1Q(Q)2s2Q*Q+\2s3Q,Q-\2s4Q.Q/\2s5Q0Q1\2s6Q2Q3\2s7Q4Q5\2s8Q6Q7\2s9Q8Q9\2s:\;Q:6Xc\Ox]Q;5P!P!)<�)�client�
HTTPStatus)�mock)�support)�	os_helper)�
socket_helper)�module�certdatazkeycert.pemzkeycert2.pemzselfsigned_pythontestdotnet.pemz{HTTP/1.1 200 OK
Transfer-Encoding: chunked

a
hello worl
3
d! 
8
and now 
22
for something completely different
s7hello world! and now for something completely differentz;foo=barz0
�0�
zX-Dummy: foo
X-Dumm2: bar
c�h`�\sQs]6sn\O
PP1QksQsQQksQs	Qs
QsQsUs
P!)	�
FakeSocketc��[U[2%cUOQ2oVmV mQUm]UmP
UmV0mV@m	P!)�ascii�)
�
isinstance�str�encode�text�	fileclass�data�
sendall_calls�file_closed�host�port)�selfrrrrs&&&&&�&C:\Python315\\Lib\test\test_httplib.py�__init__�FakeSocket.__init__7sH���d�C� � ��;�;�w�'�D��	�"����	���� ����	��	rc�l�U9O]*
tmU9OU*
tmP!��)rr�rrs&&r�sendall�FakeSocket.sendallBs!�����a����	�	�T��	rc���UQ6wcUQ6wc[O2gUOUO2UmUO
UOmUO!)�r�rb)r�UnimplementedFileModerr�file�
file_close�close)r�mode�bufsizes&&&r�makefile�FakeSocket.makefileFsK���3�;�4�4�<��.�.�0�0��N�N�4�9�9�-��	��/�/��	�	���y�y�rc��P	UmP!)T)r�rs&rr*�FakeSocket.file_closeNs
����rc��P!�N�r1s&rr+�FakeSocket.closeQ���rc��P!r4r5)r�level�optname�values&&&&r�
setsockopt�FakeSocket.setsockoptTr7r)rr)rrrrrrr4)�__name__�
__module__�__qualname__�__firstlineno__�io�BytesIOrr#r.r*r+r<�__static_attributes__�__classdictcell__��
__classdict__s@rr
r
6s3����')�z�z��4�	��� �
�
�
rr
c�4`�\sQs]WsnQsQsQsQsUsP!)�EPipeSocketc�>�[OV2V mP!r4)r
r�pipe_trigger)rrrKs&&&rr�EPipeSocket.__init__Ys�����D�'�(�rc��UOU7c[[OQ2gU9OU*
tmP!)�gotcha)rK�OSError�errno�EPIPErr"s&&rr#�EPipeSocket.sendall^s/������$��%�+�+�x�0�0��	�	�T��	rc��P!r4r5r1s&rr+�EPipeSocket.closecr7r)rK)	r>r?r@rArr#r+rDrErFs@rrIrIWs����)�
�

�
rrIc�6`�\sQs]fsnQQksQQksQsUsP!)�NoEOFBytesIOc�j�[OOV2oUQ6Xc[Q2gU!�rzcaller tried to read past EOF)rBrC�read�AssertionError)r�nrs&& rrY�NoEOFBytesIO.readls,���z�z���t�'���3�;� �!@�A�A��rc�j�[OOV2oUQ6Xc[Q2gU!rX)rBrC�readlinerZ)r�lengthrs&& rr^�NoEOFBytesIO.readliners.���z�z�"�"�4�0���3�;� �!@�A�A��rr5����r4)r>r?r@rArYr^rDrErFs@rrVrVfs������rrVc�F``�\sQs]xsnU1QksU1QksQsQsUsU9s	!)�FakeSocketHTTPConnectionc�d:�]Um[RU_	Q2VmUOUmP!)r�example.com)�connections�superr�fake_socket_args�create_connection�_create_connection)r�args�	__class__s&*�rr�!FakeSocketHTTPConnection.__init__{s,������
����'� $��"&�"8�"8��rc�T:�U9O]*
tm[RU_	2!r )rgrh�connect)rrms&�rrp� FakeSocketHTTPConnection.connect�s!������A����w�� � rc�,�[UO!r4)r
ri)r�pos�kws&*,rrj�*FakeSocketHTTPConnection.create_connection�s���4�0�0�1�1r)rkrgri)
r>r?r@rArrprjrDrE�
__classcell__)rmrGs@@rrdrdxs����9�!�
2�2rrdc�p`�\sQs]�snQsQsQsQsQsQs	Qs
QsQ	sQ
s
QsQsQ
sQsUsP!)�HeaderTestsc
��QQ[2oQFD�oQFD�o[OQ2o[Q2UmU2UmQo-oU%c[
[U22Vc$UOQQVV2UOUO
OUO2*]2J�	J�	P!)	c�.`�\sQs]�snQsQsQsUsP!)�;HeaderTests.test_auto_headers.<locals>.HeaderCountingBufferc��-UmP!r4��countr1s&rr�DHeaderTests.test_auto_headers.<locals>.HeaderCountingBuffer.__init__�s	����
rc�6�UOQ2o[U2]6�cbU]*OQ2O2oUOOU]2UOU99*]*
tt$[OV2P!)�:r)�split�len�decode�lowerr~�
setdefault�list�append)r�item�kv�lcKeys&&  rr��BHeaderTests.test_auto_headers.<locals>.HeaderCountingBuffer.append�sj���Z�Z��%���r�7�Q�;��q�E�L�L��1�7�7�9�E��J�J�)�)�%��3��J�J�u�%��*�%����D�'rr}�r>r?r@rArr�rDrErFs@r�HeaderCountingBufferr{�s����
 �
(�
(rr�rf�blahblahblah�spamspamspam�POST�/)TF)�Content-length�HostzAccept-encoding)r�r�HTTPConnectionr
�sock�_bufferrr��request�assertEqualr~r�)rr��explicit_header�header�conn�body�headerss&      r�test_auto_headers�HeaderTests.test_auto_headers�s���
	(�4�
	(� +�O�E���,�,�]�;��&�~�6��	�3�5���%����"�&)�#�d�)�n�G�O����V�S�$�8�� � ����!3�!3�F�L�L�N�!C�Q�G�F� +rc	��QQ[2oQ	oQ
o[OV22FD�vqE[OQ2o[P2UmU2UmUOUQU2UOUOOQQOU22J�	QoSFD~o[OQ2o[P2UmU2UmUOUQP2UOUOOPQOU22J�	SFD~o[OQ2o[P2UmU2UmUOUQP2UOUOOQQOU22J�	[OVs2FD~o[OQ2o[P2UmU2UmUOUQQ2UOUOOQQOU22J�	P!)c�.`�\sQs]�snQsQsQsUsP!)�?HeaderTests.test_content_length_0.<locals>.ContentLengthCheckerc�@�[OU2PUmP!r4)r�r�content_lengthr1s&rr�HHeaderTests.test_content_length_0.<locals>.ContentLengthChecker.__init__�s���
�
�d�#�&*��#rc���UOQ]2o[U2]6�c9U]*O2Q6XcU]*O2Um[
O
V2P!)r�scontent-length)r�r�r��stripr�r�r�)rr�r�s&& rr��FHeaderTests.test_content_length_0.<locals>.ContentLengthChecker.append�sM���Z�Z��a�(���r�7�Q�;�2�a�5�;�;�=�4E�#E�*,�Q�%�+�+�-�D�'����D�'r)r�r�rFs@r�ContentLengthCheckerr��s����
+�
(�
(rr�rfr��0z%Header Content-Length incorrect on {}z.Header Content-Length set for empty body on {}� �1)N�)�PUTr��PATCH)�GET�CONNECT�DELETE�HEAD�OPTIONS�TRACE)
r��	itertools�productrr�r
r�r�r�r�r��format�chain)rr��bodies�methods_with_body�methodr�r��methods_without_bodys&       r�test_content_length_0�!HeaderTests.test_content_length_0�s���	(�4�	(���4��%�-�-�.?�H�L�F��(�(��7�D�"�4�(�D�I�/�1�D�L��L�L���d�+�������+�+�T�7�>�>�v�F�
�I� 
��+�F��(�(��7�D�"�4�(�D�I�/�1�D�L��L�L���d�+�������+�+�T�@�G�G��O�
�+�+�F��(�(��7�D�"�4�(�D�I�/�1�D�L��L�L���b�)�������+�+�T�7�>�>�v�F�
�+� �o�o�&:�N�F��(�(��7�D�"�4�(�D�I�/�1�D�L��L�L���c�*�������+�+�T�7�>�>�v�F�
�Orc��[OQ2o[P2UmUO	QQ2UOQ]*2UO
QUO2UOQQ2UO
QUO2UOQQ	2UO
Q
UO2UOQQ2UO
Q
UO2UOQQQ2UO
QUO2UOQQ2UO
QUO2UOQQ2UO
QUO2UOQQ2UO
QUO2UOQQ2UO
QUO2UOQQ2UO
Q UO2UOQ!Q"2UO
Q#UO2UOQ$Q"2UO
Q%UO2UOQ&Q"2UO
Q'UO2UOQ(Q"2UO
Q)UO2P!)*rfr�r�r�sContent-length: 42�Fooz bar s
Foo:  bar �Barz	baz	s
Bar: 	baz	�
AuthorizationzBearer mytokensAuthorization: Bearer mytoken�
IterHeader�IterA�IterBsIterHeader: IterA
	IterB�LatinHeader��sLatinHeader: ��
Utf8HeadersÀsUtf8Header: Àz
C1-Controls	next�linesC1-Control: next�linezEmbedded-Fold-Spacezis
 alloweds!Embedded-Fold-Space: is
 allowedzEmbedded-Fold-Tabzis
	allowedsEmbedded-Fold-Tab: is
	allowedz	Key Spacer;sKey Space: valuez	KeySpace sKeySpace : valuesNonbreak�SpacesNonbreak�Space: values�NonbreakSpaces�NonbreakSpace: value)rr�r
r��
putrequest�	putheader�assertInr��rr�s& r�test_putheader�HeaderTests.test_putheader�s���$�$�]�3���t�$��	�����c�"����'��,��
�
�+�T�\�\�:����u�g�&��
�
�m�T�\�\�2����u�i�(��
�
�o�t�|�|�4�����(8�9��
�
�6����E����|�W�g�6��
�
�5�t�|�|�D����}�g�.��
�
�*�D�L�L�9����|�[�1��
�
�-�t�|�|�<����|�_�5��
�
�1�4�<�<�@����,�.>�?��
�
�<�d�l�l�K����*�,=�>��
�
�;�T�\�\�J����{�G�,��
�
�)�4�<�<�8����{�G�,��
�
�)�4�<�<�8����+�W�5��
�
�1�4�<�<�@����+�W�5��
�
�1�4�<�<�@rc��Qo[OQ2o[P2oV2mUO	QQ2UOUOU2Qo[OQ2o[P2oV2mUO	QQ2UOUOU2Qo[OQ2o[P2oV2mUO	QQ2UOUOU2Qo[OQ	2o[P2oV2mUO	QQ2UOUOU2P!)
sCGET /foo HTTP/1.1
Host: [2001::]:81
Accept-Encoding: identity

z[2001::]:81r��/foosEGET /foo HTTP/1.1
Host: [2001:102A::]
Accept-Encoding: identity

z
[2001:102A::]s@GET /foo HTTP/1.1
Host: [fe80::]
Accept-Encoding: identity

z
[fe80::%2]sCGET /foo HTTP/1.1
Host: [fe80::]:81
Accept-Encoding: identity

z
[fe80::%2]:81)rr�r
r�r��assertStartsWithr�r�expectedr�r�s&   r�test_ipv6host_header� HeaderTests.test_ipv6host_headers��8���$�$�]�3���"�~���	����U�F�#����d�i�i��2�8���$�$�_�5���"�~���	����U�F�#����d�i�i��2�8���$�$�\�2���"�~���	����U�F�#����d�i�i��2�8���$�$�_�5���"�~���	����U�F�#����d�i�i��2rc���Qo[U2o[OU2oUO2UO	UOQ2Q2UO	UOQ2Q2P!)z4HTTP/1.1 200 OK
First: val
: nval
Second: val

�First�val�Second)r
r�HTTPResponse�beginr��	getheader�rr�r��resps&   r�!test_malformed_headers_coped_with�-HeaderTests.test_malformed_headers_coped_with.s\��O���$����"�"�4�(���
�
���������0�%�8��������1�5�9rc	��Q[[]!]22*Q*[[]�Q
22*Q*o[U2o[OU2oUO2UO
UOQ2Q2UO
UOQ*Q2UO
UOQ2Q2UO
UOQ*Q2PO[[[]!]222oUO
UOQ2U2UO
UOQ*U2UOUOQ22UOQUO2UOQ	2UOQ	*1FD9oUOUQ
2UOQU2UOUQ2J;	P!)s0HTTP/1.1 200 OK
!#$%&'*+-.^_`|~: value
VCHAR: s
obs-text: sM
obs-fold: text
 folded with space
	folded with tab
Content-Length: 0

�Content-Lengthr
z!#$%&'*+-.^_`|~r;�VCHARzobs-textzobs-foldrz folded with spacezfolded with tab�)�bytes�ranger
rr�r�r�r��msg�join�map�chr�assertIsNotNoner�r��assertEndsWith)rr�r�r��vchar�foldeds&     r�test_parse_all_octets�!HeaderTests.test_parse_all_octets8s���
��u�T�8�4�5�
6�9�
�"�%��h�"7�8�
9�<�
�	
��$����"�"�4�(���
�
��������(8�9�3�?�������"2�3�S�9�������(9�:�G�D�������"3�4�g�>�����C��t�X�!6�7�8���������0�%�8�������'�*�E�2����T�^�^�J�7�8��
�
�j�$�(�(�+��~�~�j�1�4�8�8�J�3G�H�F��!�!�&�&�1��M�M�.��7�����(9�:�Irc��[OQ2o[P2UmUO	QQ2QoSFD`vq4UOV4129^tt^2UO
[Q29^tt^2UOV42PPP2PPP2Jb	P!)%fhK9h)%fhJ�9h)rfr�r��Invalid header))s
Invalid
Name�
ValidValue)sInvalid
Namer�)sInvalid
Namer�)s

InvalidNamer�)s
InvalidNamer�)s
InvalidNamer�)s InvalidNamer�)s	InvalidNamer�)sInvalid:Namer�)s:InvalidNamer�)�	ValidNamesInvalid
Value)r�s
Invalid
Value)r�s
Invalid
Value)r�sInvalidValue
)r�s
InvalidValue
)r�s
InvalidValue
)	rr�r
r�r��subTest�assertRaisesRegex�
ValueErrorr�)rr��cases�namer;s&    r�test_invalid_headers� HeaderTests.test_invalid_headersVs����$�$�]�3���r�N��	�����s�#�
��$!�K�D����t�m�,�,��+�+�J�8H�I�I��N�N�4�/�J�-�,�!�I�I��-�,�,�s0�B8	�=B%
�B8	�%B5�.B5�0B8	�8C	
�C	
c��QoSFD�vq#UOV#129^tt^2[OQ2oUOQV#-Q5[	P2UmUO
[Q29^tt^2UO2PPP2PPP2J�	P!)%fhK9h)%fhJ�9h)�
Invalid
Namerf�tunnel�r�r�))r��
ValidValue)zInvalid
Namer)zInvalid
Namer)z

InvalidNamer)z
InvalidNamer)z
InvalidNamer)z InvalidNamer)z	InvalidNamer)zInvalid:Namer)z:InvalidNamer)�	ValidNamezInvalid
Value)rz
Invalid
Value)rz
Invalid
Value)rzInvalidValue
)rz
InvalidValue
)rz
InvalidValue
�	r�rr��
set_tunnelr
r�r�r��_tunnel)rr�r�r;r�s&    r�test_invalid_tunnel_headers�'HeaderTests.test_invalid_tunnel_headersts���
��$!�K�D����t�m�,�,��,�,�]�;�������3���'�r�N��	��+�+�J�8H�I�I��L�L�N�J�
-�,�!�J�I��
-�,�,�s0�AB9	�?B&
�B9	�&B6�/B6�1B9	�9C

�C

c��QoSFD�oUOU29^tt^2[OQ2oUOU2[	P2UmUO
[Q29^tt^2UO2PPP2PPP2J�	P!)%fhK9h)%fhJ�9h)�
invalid
.hostrfz,Tunnel host can't contain control characters)r
z
invalid.hostzinvalid.host
z
invalid.hostzinvalid hostr)rr��tunnel_hostr�s&   r�test_invalid_tunnel_host�$HeaderTests.test_invalid_tunnel_host�s���
��!�K����k�*�*��,�,�]�;������,�&�r�N��	��+�+�J�8g�h�h��L�L�N�i�	+�*�!�
i�h��	+�*�*�s0�AB3	�9B 
�
B3	� B0�)B0�+B3	�3C
�<C
c���Qo[U2o[OU]Q5o[O29^tt^2oUO2PPP2WO
2O2oUOU]*Q2UOU]*Q2UOU]*Q2UOU]*Q2P!)%fhK�9h)s9HTTP/1.1 200 OK
First: val
Second: val1
Second: val2
)�
debuglevelzreply: 'HTTP/1.1 200 OK\r\n'zheader: First: valzheader: Second: val1zheader: Second: val2)	r
rr�r�captured_stdoutr��getvalue�
splitlinesr�)rr�r�r��output�liness&     r�test_headers_debuglevel�#HeaderTests.test_headers_debuglevel�s���
 �	
��$����"�"�4�A�6��
�
$�
$�
&�
&�&��J�J�L�'����!�,�,�.������q��#C�D�����q��#7�8�����q��#9�:�����q��#9�:�
'�
&�s�C!�!C1	�*C1	c	��[O]*o[U2Tt,tFDoQUQU0O2MJ	ooQQO	U2*oUOPQ59^tt^2[
U2o[OU2oUO[OQ29^tt^2UO2PPP2PPP2UOUQ59^tt^2[
U2o[OU2oUOUQ5PPP2P!ttoh)%fhKu9h)%fhK�9h)%fhP!9h)��Name�: Value�HTTP/1.1 200 OK
�
��max_headerszgot more than 100 headers)�_max_headers)r�_MAXHEADERSr�rr�r�r
r�r��
HTTPExceptionr�)rr�ir�r�r�r�s&      r�test_max_response_headers�%HeaderTests.test_max_response_headers�s���(�(�2�-��:?��:L�M�:L�Q�T�!��G�A�3�'�.�.�0�:L��M�%����W�(=�=��
�\�\�d�\�
+�
+��d�#�D��&�&�t�,�D��'�'��$�$�(A����
�
���,��\�\�k�\�
2�
2��d�#�D��&�&�t�,�D��J�J�K�J�0�3�
2��N����,�
+��3�
2�
2�sH�!D=�:A
E�E	�E�?4E(�E
�E
�
E�E%	�E%	�(E9	�1E9	c	�n�[O]*oQ[U]*
22oQQOU2*Q*oUO	PQ59^tt^2[O
Q2o[
U2UmUOQQ2UO[OQ	[OQ
029^tt^2UO2oPPP2PPP2UO	PQ59^tt^2[O
QUQ5o[
U2UmUOQQ2UO2oUO2PPP2P!)%fhK�9h)%fhK�9h)%fhP!9h)rc3�Z�SF �DoQUQU0O2w�	J	P!3h)rr�r��.0r"s& r�	<genexpr>�:HeaderTests.test_max_connection_headers.<locals>.<genexpr>�s,��3I���3I�a�d�1�#�W�Q�C� �'�'�)�)�3I�s�$+rrs$
Content-Length: 12

Dummy body
rrfr�r��got more than z headers��max_response_headers)
rr r�r�r�r�r
r�r�r�r!�getresponserY)rrr�r�r��responses&     r�test_max_connection_headers�'HeaderTests.test_max_connection_headers�sU���(�(�2�-��
�38��q��3I�
��
#��l�l�7�#�
$�=�
>�	
��\�\�d�\�
+�
+��(�(��7�D�"�4�(�D�I��L�L���$��'�'��$�$��v�7I�7I�6J�(�&S��� �+�+�-���	,��\�\�d�\�
+�
+��(�(��K��D�#�4�(�D�I��L�L���$��'�'�)�H��M�M�O�,�
+����	,�
+��,�
+�
+�sD�*A3F�E=	�.F�AF#�=F

�F

�F�F 	�F 	�#F4	�,F4	c	���[O]*oPOQ[U]*
222o[[
*U*[*oUOPQ59^tt^2[OQ2o[U2Um
UOQQ2UO2oUOQ[OQ029^tt^2UO2PPP2PPP2UOUQ59^tt^2[OQUQ5o[U2Um
UOQQ2UO2oUO!UO2["2PPP2P!)%fhK�9h)%fhK�9h)%fhP!9h)rc3�@�SF �DoQUQUQ0w�	J	P!3h�z	X-Trailerz: rr5r(s& rr*�;HeaderTests.test_max_connection_trailers.<locals>.<genexpr>�s"��.E���.E��i��s�"�Q�C�t�$�.E���r-rfr�r�r,�	 trailers)rr r�r��
chunked_start�
last_chunk�chunked_endr�r�r
r�r�r/r�r!rYr��chunked_expected)r�max_trailers�
trailer_linesr�r�r0s&     r�test_max_connection_trailers�(HeaderTests.test_max_connection_trailers�sm���)�)�B�.����� 
�.3�L�1�4D�.E� 
�
�
��z�)�M�9�K�G��
�\�\�t�\�
4�
4��(�(��7�D�"�4�(�D�I��L�L���$��'�'�)�H��'�'��$�$� ��!3�!3� 4�I�>����
�
��	�5��\�\�|�\�
<�
<��(�(��L��D�#�4�(�D�I��L�L���$��'�'�)�H����X�]�]�_�.>�?�=�
<�
���5�
4��=�
<�
<�sD�=BG�F4	�G�;A/G�4G
�=G
�?G�G	�G	�G+	�#G+	r5)r>r?r@rAr�r�r�r�r�r�r�rrrr#r1r?rDrErFs@rrxrx�sS����H�:@�D A�D!3�F:�;�<0�<#�:#� ;�"1�$�:@�@rrxc�(`�\sQsQsnQsQsUsP!)�HttpMethodTests�c	��QoSFDcoUO[Q29^tt^2[OQ2o[	P2UmUO
UQQ5PPP2Je	P!)%fhJz9h)�GET
z'method can't contain control charactersrfr�)r��url)	rEzPOST
zPUT

z
POST
Valuez
POST
HOST:abczGET
rHost:abc
zPOST
Remainder:
z
GET
HOST:
z
PUT)r�r�rr�r
r�r�)r�methodsr�r�s&   r�test_invalid_method_names�)HttpMethodTests.test_invalid_method_names�s{��

���F��'�'�� I�K�K��,�,�]�;��&�t�,��	����F���4�	K�K��K�K�K�s�:A0	�0B
�9B
r5)r>r?r@rArHrDrErFs@rrBrB�s����5�5rrBc�T`�\sQsQsnQsQsQsQsQsQQks	Qs
Q	sQ
sUs
P!)�TransferEncodingTest�sIt's just a flesh woundc�b�[OQ2o[Q2UmUO	QQ2UOUO
2P	Q5UOUOO2vq#UOU2oUOV0O2P!)rfrr�r�)�encode_chunked)rr�r
r�r��
endheaders�
_make_body�_parse_requestr�_parse_chunkedr��
expected_body)rr��_r�s&   r�test_endheaders_chunked�,TransferEncodingTest.test_endheaders_chunkeds����$�$�]�3���s�O��	������$�������)�$��?��(�(������8�
��1��"�"�4�(������1�1�2rc	��[OQ2o[Q2UmUO	QQUO2QQ-2UO
UOO2vq#oSOQUO2Tt,tFDpUO2MJ	to2UOUQ*Q2UOV@O2[OQ2o[Q2UmUO	QQUOOQ2QQ-2UO
UOO2vq#oSOQUO2Tt,tFDpUO2MJ	to2UOUQ*Q2UOV@O2[OQ2o[Q2UmUO	QQQQ-P	UO2Q	5UO
UOO2vq#oSOQSTt,tFDpUO2MJ	to2UOUQ*Q2UOUOU2UO2P!ttohttohttoh)
rfrr�r��Transfer-Encoding�chunked�content-length�latin-1z
gzip, chunked)r�rNr�)rr�r
r�r�rPrQr�assertNotIn�keysr�r�rSr�rR�rr�rTr�r��ks&     r�test_explicit_headers�*TransferEncodingTest.test_explicit_headers!sD���$�$�]�3���s�O��	�	
����C����*�-@�)�,L�	N� �.�.�t�y�y�~�~�>���D����)�w�|�|�~�+N�~�!�G�G�I�~�+N�O�����!4�5�y�A�����1�1�2��$�$�]�3���s�O��	�����C��+�+�2�2�9�=�
 �)�,�	.� �.�.�t�y�y�~�~�>���D����)�w�|�|�~�+N�~�!�G�G�I�~�+N�O�����!4�5�y�A�����1�1�2��$�$�]�3���s�O��	����V�S�(�/�:�����"�	�	$� �.�.�t�y�y�~�~�>���D����)�w�+G�w�!�G�G�I�w�+G�H�����!4�5��G�����,�,�T�2�D�4F�4F�G��5,O��,O��,Hs�J?
�K
�K	
c���Q	FD�o[OQ2o[Q2UmUO	QQUOUQ52UO
UOO2vq4oUOU2oUOVPO2UOUQ*Q2SOQSTt,tFDpfO2MJ	to2J�	P!ttoh)
Frfrr�r�)�empty_linesrXrYrZ)FT)
rr�r
r�r�rPrQrrRr�rSr\r�)rrcr�rTr�r�r_s&      r�test_request�!TransferEncodingTest.test_requestGs���)�K��(�(��7�D�"�3��D�I��L�L���T�_�_��_�E�
G� $�2�2�4�9�9�>�>�B��A���&�&�t�,�D����T�#5�#5�6����W�%8�9�9�E�
���-�7�/K�7�a���	�7�/K�L�*��0Ls�
C4c	��[OQ2o[Q2UmUO	QQQ2UOUOO2vq#oUOUQ*Q2SOQSTt,tFDpUO2MJ	to2UOUQ2P!ttoh)	rfrr�r�rXrYrZs0

r5)
rr�r
r�r�rQrr�r\r�r^s&     r�test_empty_body�$TransferEncodingTest.test_empty_bodyWs����$�$�]�3���s�O��	����V�S�"�%��.�.�t�y�y�~�~�>���D�����!4�5�y�A����)�w�+G�w�!�G�G�I�w�+G�H�����|�,��,Hs�C
c#� �UOOQ2o[U2FDKvq4U%cU]*%cQw�	U[U2]*
6cUQ*w�	JFUw�	JM	P!3h)� r)rSr��	enumerater�)rrcr�idx�lines&&   rrP�TransferEncodingTest._make_bodyas[����"�"�(�(��.��"�5�)�I�C��s�Q�w�w��	��S��Z�!�^�#��T�k�!��
�*�s�5A<�A<�A<�#A<c��UOQ2oU]*o-o]oU[U26c{[V%*2]6�ceV%*OQ2vqgUOQ2O2oUOQ2O2VF$U]*
oJ�V4QO	V%]*P21!)rr�r[)r�r�r�r�r�)rrrr�r�r[�keyr�s&&      rrQ�#TransferEncodingTest._parse_requestls����
�
�7�#����(����
���#�e�*�n��U�X���!2��x�~�~�d�+�H�C��*�*�Y�'�-�-�/�C��:�:�i�0�6�6�8�G�L�
��F�A�����e��E�F�m�!<�<�<rc�:�,o-o]oUOQ2oVTU]*vqg[U]2oU]6XcU]*
oLHUOU[U22UO	U2U]*
oU[U26�fJrQOU2!)rrr)r��intr�r�r�r�)rrr��trailersr[r�size�chunks&&      rrR�#TransferEncodingTest._parse_chunkedys�������
���
�
�7�#����!�A�#�,�K�D��t�R�=�D��q�y��Q�������T�3�u�:�.��K�K���
��F�A��3�u�:�~���x�x��~�rr5)F)r>r?r@rArSrUr`rdrgrPrQrRrDrErFs@rrKrKs5����.�M�3�$H�LM� -�	�=��rrKc�~`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sQ
sQs
QsQ
sQsQsQsQsQsQsQsQsQsQsQsQsQsQsQsQsQs Qs!Q s"Q!s#Q"s$Q#s%Q$s&Q%s'Q&s(Q's)Q(s*Q)s+Q*s,Q+s-Q,s.Q-s/Q.s0Q/s1Q0s2Q1s3Q2s4Q3s5Q4s6Q5s7Q6s8Q7s9Q8s:Q9s;Q:s<Q;s=Q<s>Us?P!)=�	BasicTest�c
�j�UO.Ql[[[Q2226*2P!)�description�>r�r;�phraser|)�
assertTrue�set�dirrr1s&r�&test_dir_with_added_behavior_on_status�0BasicTest.test_dir_with_added_behavior_on_status�s#�����B�c�#�j�Y\�o�J^�F_�_�`rc�p�QQ[O2o[OU[2P!)c�`�\sQsQsnQ	Qks\Q2s\Q2s\Q2s\Q2s	\Q2s
Q
sQsQs
Q
sQsQsQsQsQsQsQsQsQsQsQsQsQsQsQsQsQsQs Q s!Q!s"Q"s#Q#s$Q$s%Q%s&Q&s'Q's(Q(s)Q)s*Q*s+Q+s,Q,s-Q-s.\.s/Q.s0\0s1Q/s2Q0s3\3s4Q1s5Q2s6Q3s7Q4s8\8s9Q5s:Q6s;Q7s<Q8s=Q9s>Q:s?Q;s@Q<sAQ=sBQ>sCQ?sDQ@sEQAsFQBsGQCsHQDsIQEsJQFsKQGsLQsMUsNP!)H�;BasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus�c�V�[OV2oVmV$mV4mU!r4)rs�__new__�_value_r~r|)�clsr;r~r|�objs&&&& rr��CBasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus.__new__�s$���k�k�#�-��#��#�
�"-���
rc�0�]dSt96*9%c]�6*!t!)�dr5r1s&r�is_informational�LBasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus.is_informational�����d�)�)�c�)�)�)�)rc�0�]�St96*9%cQ6*!t!����+r5r1s&r�
is_success�FBasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus.is_success�r�rc�0�QSt96*9%cQ6*!t!��,�r5r1s&r�is_redirection�JBasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus.is_redirection�r�rc�0�QSt96*9%cQ6*!t!����r5r1s&r�is_client_error�KBasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus.is_client_error�r�rc�0�QSt96*9%cQ6*!t!����Wr5r1s&r�is_server_error�KBasicTest.test_simple_httpstatus.<locals>.CheckedHTTPStatus.is_server_error�r�rr5)r�)r��Continuez!Request received, please continue)�ezSwitching Protocolsz.Switching to new protocol; obey Upgrade header)�f�
Processingz Server is processing the request)�gzEarly Hintsz(Headers sent to prepare for the response)r��OKz#Request fulfilled, document follows)���CreatedzDocument created, URL follows)���Acceptedz/Request accepted, processing continues off-line)��zNon-Authoritative InformationzRequest fulfilled from cache)��z
No Contentz"Request fulfilled, nothing follows)��z
Reset Contentz"Clear input form for further input)��zPartial ContentzPartial content follows)��zMulti-Statusz/Response contains multiple statuses in the body)��zAlready Reportedz#Operation has already been reported)��zIM Usedz.Request completed using instance manipulations)r�zMultiple Choicesz,Object has several resources -- see URI list)�-zMoved Permanently�(Object moved permanently -- see URI list)�.�Found�(Object moved temporarily -- see URI list)�/z	See Otherz'Object moved -- see Method and URL list)�0zNot Modifiedz)Document has not changed since given time)�1z	Use Proxyz@You must use proxy specified in Location to access this resource)�3zTemporary Redirectr�)�4zPermanent Redirectr�)r�zBad Requestz(Bad request syntax or unsupported method)��Unauthorizedz*No permission -- see authorization schemes)�zPayment Requiredz"No payment -- see charging schemes)��	Forbiddenz0Request forbidden -- authorization will not help)r}�	Not FoundzNothing matches the given URI)�zMethod Not Allowedz-Specified method is invalid for this resource)�zNot Acceptablez%URI not available in preferred format)�zProxy Authentication Requiredz7You must authenticate with this proxy before proceeding)�zRequest Timeoutz"Request timed out; try again later)��ConflictzRequest conflict)��Gonez5URI no longer exists and has been permanently removed)�zLength Requiredz"Client must specify Content-Length)�zPrecondition Failedz Precondition in headers is false)�zContent Too LargezContent is too large)�zURI Too LongzURI is too long)�zUnsupported Media Typez!Entity body in unsupported format)�zRange Not SatisfiablezCannot satisfy request range)�zExpectation Failedz'Expect condition could not be satisfied)�zI'm a Teapotz4Server refuses to brew coffee because it is a teapot)�zMisdirected Requestz(Server is not able to produce a response)�zUnprocessable Contentz8Server is not able to process the contained instructions)��LockedzResource of a method is locked)�zFailed Dependencyz&Dependent action of the request failed)�z	Too Earlyz:Server refuses to process a request that might be replayed)�zUpgrade Requiredz@Server refuses to perform the request using the current protocol)�zPrecondition Requiredz8The origin server requires the request to be conditional)�zToo Many RequestszOThe user has sent too many requests in a given amount of time ("rate limiting"))�zRequest Header Fields Too LargezVThe server is unwilling to process the request because its header fields are too large)��zUnavailable For Legal ReasonszOThe server is denying access to the resource as a consequence of a legal demand)r�zInternal Server ErrorzServer got itself in trouble)�zNot Implementedz&Server does not support this operation)�zBad Gatewayz+Invalid responses from another server/proxy)�zService Unavailablez8The server cannot process the request due to a high load)�zGateway Timeoutz4The gateway server did not receive a timely response)�zHTTP Version Not SupportedzCannot fulfill request)�zVariant Also Negotiatesz*Server has an internal configuration error)�zInsufficient Storagez.Server is not able to store the representation)�z
Loop Detectedz>Server encountered an infinite loop while processing a request)rCzNot Extendedz0Request does not meet the resource access policy)�zNetwork Authentication Requiredz7The client needs to authenticate to gain network access)Or>r?r@rAr��propertyr�r�r�r�r��CONTINUE�SWITCHING_PROTOCOLS�
PROCESSING�EARLY_HINTSr��CREATED�ACCEPTED�NON_AUTHORITATIVE_INFORMATION�
NO_CONTENT�
RESET_CONTENT�PARTIAL_CONTENT�MULTI_STATUS�ALREADY_REPORTED�IM_USED�MULTIPLE_CHOICES�MOVED_PERMANENTLY�FOUND�	SEE_OTHER�NOT_MODIFIED�	USE_PROXY�TEMPORARY_REDIRECT�PERMANENT_REDIRECT�BAD_REQUEST�UNAUTHORIZED�PAYMENT_REQUIRED�	FORBIDDEN�	NOT_FOUND�METHOD_NOT_ALLOWED�NOT_ACCEPTABLE�PROXY_AUTHENTICATION_REQUIRED�REQUEST_TIMEOUT�CONFLICT�GONE�LENGTH_REQUIRED�PRECONDITION_FAILED�CONTENT_TOO_LARGE�REQUEST_ENTITY_TOO_LARGE�URI_TOO_LONG�REQUEST_URI_TOO_LONG�UNSUPPORTED_MEDIA_TYPE�RANGE_NOT_SATISFIABLE�REQUESTED_RANGE_NOT_SATISFIABLE�EXPECTATION_FAILED�IM_A_TEAPOT�MISDIRECTED_REQUEST�UNPROCESSABLE_CONTENT�UNPROCESSABLE_ENTITY�LOCKED�FAILED_DEPENDENCY�	TOO_EARLY�UPGRADE_REQUIRED�PRECONDITION_REQUIRED�TOO_MANY_REQUESTS�REQUEST_HEADER_FIELDS_TOO_LARGE�UNAVAILABLE_FOR_LEGAL_REASONS�INTERNAL_SERVER_ERROR�NOT_IMPLEMENTED�BAD_GATEWAY�SERVICE_UNAVAILABLE�GATEWAY_TIMEOUT�HTTP_VERSION_NOT_SUPPORTED�VARIANT_ALSO_NEGOTIATES�INSUFFICIENT_STORAGE�
LOOP_DETECTED�NOT_EXTENDED�NETWORK_AUTHENTICATION_REQUIREDrDrErFs@r�CheckedHTTPStatusr��sY����&
��
*��
*��
*��
*��
*��
*��
*��
*��
*��
*�L�H�#F��N�J�<�K�B�B�E�G�C�H�-Q�)�P�J�V�M�O�O�C�L� 7��V�G� @��!<��L�E�S�I�=�L�T�I�"<��"<��<�K�>�L� 6��D�I�1�I�"A��9�N�-K�)�6�O�:�H�I�D�6�O�#4��!(��'8�$�C�L�#/� �&5�"�%0�!�/D�+�";��H�K�#<��%L�!�#8� �D�F�!:��N�I� T��%L�!�!<��/(�+�-?�)�
%0�!�:�O�?�K�#L��H�O�**�&�'>�#�$B� �R�M�D�L�/K�+rr2)�enum�IntEnum�_test_simple_enumr)rr2s& r�test_simple_httpstatus� BasicTest.test_simple_httpstatus�s*��n	K����n	K�^	
���0�*�=rc��[OO2FD'oUOU]d2UO	UQ2J)	P!)r�r�)r�__members__�values�assertGreaterEqual�assertLessEqual)r�members& r�test_httpstatus_range�BasicTest.test_httpstatus_rangeKs=��!�,�,�3�3�5�F��#�#�F�C�0�� � ���-�6rc��Qo[OO2FDRoSFDHvvq4o[V%2oX2t96:cU6:cLLUO	U2J7UOU2JJ	JT	P!)r�)))r���r�)r�r�)r�r�)r�r�)r�r�)rr9r:�getattrr�assertFalse)r�
categoriesr=r��upper�category�category_indicators&      r�test_httpstatus_category�"BasicTest.test_httpstatus_categoryRsg��
�
�!�,�,�3�3�5�F�,6�(����%,�V�%>�"��+�e�+��O�O�$6�7��$�$�%7�8�-7�6rc���Qo[U2o[OU2oUO2UO	UO]2Q2UO
UO22UO
UO2UO	UO2Q2UOUO22UO
UO2UO2UOUO2Qo[U2o[OU2oUO[OUO2P!)�HTTP/1.1 200 Ok

Textr�TextzHTTP/1.1 400.100 Not Ok

Text)
r
rr�r�r�rYrC�isclosed�closedrr+�assertRaises�
BadStatusLiner�s&   r�test_status_lines�BasicTest.test_status_linesds���-���$����"�"�4�(���
�
��������1��s�+��������)�������%��������g�.�����
�
��(�������%��
�
��������$�4���$����"�"�4�(�����&�.�.��
�
�;rc�j�[OP2oUO[U2Q2P!)r�zBadStatusLine("''"))rrPr��repr)r�excs& r�test_bad_status_repr�BasicTest.test_bad_status_reprys'���"�"�2�&������c��$=�>rc��Qo[U2o[OU2oUO2UO	UO]2Q2UO
UO22UO	UO]2Q2UOUO22UO
UO2UO2UOUO2P!��*HTTP/1.1 200 Ok
Content-Length: 4

Text�Te�xt�r
rr�r�r�rYrCrMrrNr+r�s&   r�test_partial_reads�BasicTest.test_partial_reads}s���B���$����"�"�4�(���
�
��������1��u�-��������)�������1��u�-�����
�
��(�������%��
�
��������$rc��Qo[U2o[OU2oUO2UO	UO2Q2UO
UO22UO	UO2Q2UOUO22UO
UO2UO2UOUO2P!)z4HTTP/1.1 200 Ok
Content-Length: 13

Text
AnothersText
sAnother)r
rr�r�r�r^rCrMrYrrNr+r�s&   r�test_mixed_reads�BasicTest.test_mixed_reads�s���N���$����"�"�4�(���
�
���������+�6��������)��������j�1�����
�
��(�������%��
�
��������$rc��Qo[U2o[OU2oUO2[	]2oUOU2oUO
U]2UO
[U2Q2UOUO22UOU2oUO
U]2UO
[U2Q2UOUO22UOUO2UO2UOUO2P!rY�
r
rr�r��	bytearray�readintor�r�rCrMrrNr+�rr�r�r��br[s&     r�test_partial_readintos� BasicTest.test_partial_readintos�s���B���$����"�"�4�(���
�
���a�L���M�M�!�������A������q��5�)��������)��M�M�!�������A������q��5�)�����
�
��(�������%��
�
��������$rc�z�Qo[U2o[OU2oUO2UO	UO]
2Q2UO
UO22UOUO2UO2UO
UO2P!)rZrL�r
rr�r�r�rYrrMrCrNr+r�s&   r�test_partial_reads_past_end�%BasicTest.test_partial_reads_past_end�s��A���$����"�"�4�(���
�
��������2���0�����
�
��(�������%��
�
��������$rc���Qo[U2o[OU2oUO2[	]
2oUOU2oUO
U]2UO
[U2Q*Q2UOUO22UOUO2UO2UOUO2P!)rZ:N�NrL)
r
rr�r�rerfr�r�rrMrCrNr+rgs&     r�test_partial_readintos_past_end�)BasicTest.test_partial_readintos_past_end�s���A���$����"�"�4�(���
�
���b�M���M�M�!�������A������q��"��w�/�����
�
��(�������%��
�
��������$rc�<�Qo[U2o[OU2oUO2UO	UO]2Q2UO
UO22UO	UO]2Q2UO	UO]2Q2UOUO22UO
UO2UO2UOUO2P!)rKr[r\rr]r�s&   r�$test_partial_reads_no_content_length�.BasicTest.test_partial_reads_no_content_length�s���-���$����"�"�4�(���
�
��������1��u�-��������)�������1��u�-�������1��s�+�����
�
��(�������%��
�
��������$rc�>�Qo[U2o[OU2oUO2[	]2oUOU2oUO
U]2UO
[U2Q2UOUO22UOU2oUO
U]2UO
[U2Q2UOU2oUO
U]2UOUO22P!)rKr[r\)r
rr�r�rerfr�r�rCrMrrgs&     r�(test_partial_readintos_no_content_length�2BasicTest.test_partial_readintos_no_content_length�s���-���$����"�"�4�(���
�
���a�L���M�M�!�������A������q��5�)��������)��M�M�!�������A������q��5�)��M�M�!�������A������
�
��(rc��Qo[U2o[OU2oUO2UO	UO]2Q2UO
UO22UO	UO]2Q2UO	UO]2Q2UOUO22P!)�+HTTP/1.1 200 Ok
Content-Length: 10

Textr[r\r)	r
rr�r�r�rYrCrMrr�s&   r�"test_partial_reads_incomplete_body�,BasicTest.test_partial_reads_incomplete_body�s���C���$����"�"�4�(���
�
��������1��u�-��������)�������1��u�-�������1��s�+�����
�
��(rc���Qo[U2o[OU2oUO2[	]2oUOU2oUO
U]2UO
[U2Q2UOUO22UOU2oUO
U]2UO
[U2Q2UOU2oUO
U]2UOUO22UOUO2UO2UOUO2P!)rzr[r\rdrgs&     r�&test_partial_readintos_incomplete_body�0BasicTest.test_partial_readintos_incomplete_body�s	��C���$����"�"�4�(���
�
���a�L���M�M�!�������A������q��5�)��������)��M�M�!�������A������q��5�)��M�M�!�������A������
�
��(�������%��
�
��������$rc�,�QFD2oUO[O[OU2J4	QFDRvqo[OU2oUO	V$O
2UO	V4O2JT	P!)�www.python.org:abc�r�zuser:password@www.python.org)�z[fe80::207:e9ff:fe9b]:8000�fe80::207:e9ff:fe9bi@)zwww.python.org:80�www.python.org�P)�www.python.org:r�r�)r�r�r�)�[fe80::207:e9ff:fe9b]r�r�)�[fe80::207:e9ff:fe9b]:r�r�)rOr�
InvalidURLr�r�rr�r�hp�h�p�cs&    r�test_host_port�BasicTest.test_host_portsv��I�B����f�/�/��1F�1F��K�I�P�H�B�1��%�%�b�)�A����Q���'����Q���'�Prc��QoQo[U2o[OU2oUO2UO	Q2oUOVR2P!)z�HTTP/1.1 200 OK
Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"
Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"

No body
zrCustomer="WILE_E_COYOTE"; Version="1"; Path="/acme", Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"z
Set-Cookie)r
rr�r�r�r�)rr�hdr�sr&�cookiess&     r�test_response_headers�BasicTest.test_response_headers!sR����O��
�t�������"��	���	��+�+�l�+������&rc���[Q[2o[OUQQ5oUO	2UO2%cUO
Q2P!P!)�*HTTP/1.1 200 OK
Content-Length: 14432

r��r��)Did not expect response from HEAD request)r
rVrr�r�rY�fail�rr�r�s&  r�test_read_head�BasicTest.test_read_head3sR���
�
�	��
�"�"�4��7���
�
���9�9�;�;��I�I�A�B�rc��[Q[2o[OUQQ5oUO	2[]2oUO
U2]6wcUOQ2UO[U2Q2P!)r�r�r�r��)
r
rVrr�r�rerfr�r�r�)rr�r�rhs&   r�test_readinto_head�BasicTest.test_readinto_head@sp���
�
�	��
�"�"�4��7���
�
���a�L���=�=���q� ��I�I�A�B�����q��9�-rc�*�QOQ[[O]*222Q*oQU*o[	U2o[O
U2oUO
[OQUO2P!)rc3�@�SF �DoQU*w�	J	P!3h)z
Header%d: foor5r(s& rr*�2BasicTest.test_too_many_headers.<locals>.<genexpr>Ps��'D���'D�!�.��1�1�'D�r7zHTTP/1.1 200 OK
zgot more than \d+ headers)	r�r�rr r
r�r�r!r�)rr�rr�r&s&    r�test_too_many_headers�BasicTest.test_too_many_headersOs}���+�+�F�',�V�-?�-?�!�-C�'D�F�F�HN�O��%��/���t�������"�����v�3�3�;�Q�W�W�	Frc�"�Qo[[Q29^tt^2o[OQ2o[	U2oVCmUO
QQU2UOUOU2PPP2P!)%fhP!9h)s_GET /foo HTTP/1.1
Host: example.com
Accept-Encoding: identity
Transfer-Encoding: chunked

r'rfr�r�)	�open�__file__rr�r
r�r�r�r�rr�r�r�r�s&    r�test_send_file�BasicTest.test_send_fileXsl����
�(�D�
!�
!�T��(�(��7�D��d�#�D��I��L�L����-��!�!�$�)�)�X�6�"�
!�
!�
!�s�AA=�=B	�B	c���Qo[OQ2o[P2oV2mUO	U2UOVO2QUmUO	[OQU22UOVO2QUmUO	[OU22UOVO2P!)s"this is a test this is only a testrfrrh)
rr�r
r��sendr�r�arrayrBrCr�s&   r�	test_send�BasicTest.test_sendes���8���$�$�]�3���$����	��	�	�(������9�9�-���	��	�	�%�+�+�c�8�,�-�����9�9�-���	��	�	�"�*�*�X�&�'�����9�9�-rc�`�QnU1QkQ[O2oQo[OQ2o[	P2oVCmUO
U22UOUOU2P!)c3�. �Qw�	Pw�	Qw�	P!3h)r�data_twor5r5rrr�/BasicTest.test_send_updating_file.<locals>.datats����L��J�����c�B:`�\sQsQsnQsY2sQQksQsUsP!)�7BasicTest.test_send_updating_file.<locals>.UpdatingFileiyr&c�.�[UO2!r4)�next�d)r�	blocksizes&&rrY�<BasicTest.test_send_updating_file.<locals>.UpdatingFile.read|s���D�F�F�|�#rr5ra)	r>r?r@rAr,r�rYrDrE)rGrs@�r�UpdatingFiler�ys�����D���A�
$�
$rr�sdatarf)	rB�
TextIOBaserr�r
r�r�r�r)rr�r�r�r�rs&    @r�test_send_updating_file�!BasicTest.test_send_updating_filess_���	�
	$�2�=�=�	$����$�$�]�3���"�~���	��	�	�,�.�!�������H�-rc���QoQo[OQ2o[P2oVCmUO	QQU2QQ-2UOUOU2P!)sbGET /foo HTTP/1.1
Host: example.com
Accept-Encoding: identity
Content-Length: 11

onetwothreec3�. �Qw�	Qw�	Qw�	P!3h)sonestwosthreer5r5rrr��&BasicTest.test_send_iter.<locals>.body�s����L��L��N�r�rfr�r�r��11)rr�r
r�r�r�rr�s&    r�test_send_iter�BasicTest.test_send_iter�s\��&��	�
�$�$�]�3���"�~���	����U�F�D�F�-=�t�,D�E�������H�-rc�r�]o[OQUQ5o[P2oV2mQU*Q*oUO	QQ[
OU2QQ-2UOUO]2UOOQ	]2]*oUOVT2P!)
�rf�r��a�br�r�r��9�

)rr�r
r�r�rBrCr�rrr�)rr�r�r�r�r�s&     r�test_blocksize_request� BasicTest.test_blocksize_request�s����	��$�$�]�i�H���$����	��)�#�d�*�����U�C����H�!5�8H�#�7N�O�����+�+�Q�/��y�y���{�A�.�q�1������(rc�8�]o[OQUQ5o[P2oV2mQU*Q*oUO	[
OU22UOUO]2UOUOU2P!)r�rfr�r�r�)
rr�r
r�r�rBrCr�rr)rr�r�r�r�s&    r�test_blocksize_send�BasicTest.test_blocksize_send�sv���	��$�$�]�i�H���$����	��)�#�d�*���	�	�"�*�*�X�&�'�����+�+�Q�/�������H�-rc���[OQ2o[P2UmUO	[
29^tt^2UO
QQU2PPP2P!)%fhP!9h)rfr��test)rr�r
r�rO�	TypeErrorr�r�s& r�test_send_type_error�BasicTest.test_send_type_error�sM���$�$�]�3���r�N��	�
�
�
�y�
)�
)��L�L����.�*�
)�
)�
)�s�A#�#A4	�,A4	c	��[o[[[*[*2o[
OUQQ5oUO2UOUO2U2UO2QFD�oUOQUQ59^tt^2[[[*[*2o[
OUQQ5oUO2UOUO2UOUOU2U2UO2PPP2J�	UOQ29^tt^2[[[*[*2o[
OUQQ5oUO2UOUO2UOUOP2Q2UO2PPP2[]]2FD�o[[[*[*2o[
OUQQ5oUO2UOUOU2UOU2*UO2*U2UO2J�	Q	FDso[[U*2o[
OUQQ5oUO2UO2UO!Q2UO2Ju	P!)%fhCJ�9h)%fhCK_9h[
O"cooSOSO$S2Q['S2*oSO[)S2S2SO[+S2S2Po=K�Po=hh9hSO2h9h)
r�r�z	full read)r[z	read1(-1)s
hello worl�IncompleteRead expected�IncompleteRead(%d bytes read))i����rbN�r�zfoo
)r<r
r9r:r;rr�r�r�rYr+r�rrY�read1r�r��IncompleteRead�partialr�rTr)rr�r�r�r[�xr"�expected_messages&       r�test_chunked�BasicTest.test_chunked�s���#���-�*�4�{�B�C���"�"�4��6���
�
���������h�/��
�
��"�A����k�Q��/�/�!�-�*�"<�{�"J�K���*�*�4��>���
�
��������-�� � ����1��x�8��
�
��
0�/�"��\�\�+�
&�
&��m�j�8�;�F�G�D��&�&�t�E�:�D��J�J�L��O�O�D�L�L�)����T�Z�Z��^�]�;��J�J�L�
'��q�"��A��m�j�8�;�F�G�D��&�&�t�E�:�D��J�J�L����T�Y�Y�q�\�D�I�I�a�L�8�4�9�9�;�F��Q��J�J�L��!�A��m�a�/�0�D��&�&�t�E�:�D��J�J�L�

��	�	���	�	�3�4��
�
��!�30�/�/��'�
&�
&��,�(�(�
;�� � ����H�5�#B�S��]�#R� �� � ��a��*:�;�� � ��Q��)9�:�:��	
;���
�
��s]�&BM	�%BM�	M)�O/�M
�	M
�M&	�M&	�)O,�=O,�>A$O'�"O/�'O,�,O/�/Pc	�p�[o[U2o[]�2o[[[
*[*2o[OUQQ5oUO2UOU2oUOUPUU2UOVb2UO2[]]2FD�o[[[
*[*2o[OUQQ5oUO2[U2oUOU]U2oV�OVxVh*2*
oV�OVxP2*
oUOUPUU2UOV�2UO2J�	QFDto	[[U	*2o[OUQQ5oUO2UOU2oUOQ2UO2Jv	P![O cooSOSO"S2Q[S2*o
SO[%S2S
2SO['S2S
2Po=K�Po=hh9hSO2h9h)�r�r�r�r�r�)r<r�rer
r9r:r;rr�r�rfr�r+r��
memoryviewr�r�r�rTr)rr��	nexpectedrhr�r�r[�mr"r�r�s&          r�test_readinto_chunked�BasicTest.test_readinto_chunked�s��#����M�	��c�N���-�*�4�{�B�C���"�"�4��6���
�
���M�M�!�������:�I���1�����&��
�
���q�"��A��m�j�8�;�F�G�D��&�&�t�E�:�D��J�J�L��1�
�A��
�
�a��!�f�%�A�
���q�1�5�z�*�*�A�
���q��u�%�%�A����Q�z�	�]�H�5����Q�*��J�J�L��!�A��m�a�/�0�D��&�&�t�E�:�D��J�J�L�

��M�M�!�$���	�	�3�4��
�
��!���(�(�
;�� � ����H�5�#B�S��]�#R� �� � ��a��*:�;�� � ��Q��)9�:�:��	
;���
�
��s7�%H�6J#�J �1J �2A$J�J#�J � J#�#J5c��Qo[U[*[*2o[OUQQ5oUO2UO
UO2Q2UO
UO]�2UO
UOQ2UOUO22UOUO2UO2UOUO2P!)�EHTTP/1.1 200 OK
Transfer-Encoding: chunked

a
hello world
1
d
r�r�rr�)r
r:r;rr�r�r�rY�status�reasonrrMrCrNr+)rr9r�r�s&   r�test_chunked_head�BasicTest.test_chunked_heads���
�	��-�*�4�{�B�C���"�"�4��7���
�
���������c�*�������c�*�������d�+�����
�
��(�������%��
�
��������$rc�j�Qo[U[*[*2o[OUQQ5oUO2[
]2oUOU2oUOU]2UO[U2Q2UOUO]�2UOUOQ2UOUO22UOUO2UO!2UOUO2P!)r�r�r�r�r�)r
r:r;rr�r�rerfr�r�r�r�rrMrCrNr+)rr9r�r�rhr[s&     r�test_readinto_chunked_head�$BasicTest.test_readinto_chunked_head(s���
�	��-�*�4�{�B�C���"�"�4��7���
�
���a�L���M�M�!�������A������q��9�-�������c�*�������d�+�����
�
��(�������%��
�
��������$rc���[Q2o[OUQQ5oUO2UO	UO2Q2UO
UO22P!)z.HTTP/1.1 200 OK
Content-Length: -1

Hello
r�r��Hello
)r
rr�r�r�rYrrMr�s&  r�test_negative_content_length�&BasicTest.test_negative_content_length?sS���D�F���"�"�4��6���
�
���������l�3�����
�
��(rc���[Q2o[OUQQ5oUO2UO	2UOQ2P![Oc}oSOSOQ2SO[S2Q2SO[S2Q2SOSO22Po=P!Po=hh9h)z.HTTP/1.1 200 OK
Content-Length: 10

Hello
r�r�r�r�z-IncompleteRead(7 bytes read, 3 more expected))
r
rr�r�rYr�r�r�r�rTrrrM)rr�r�r"s&   r�test_incomplete_read�BasicTest.test_incomplete_readGs����R�S���"�"�4��6���
�
��
	1��I�I�K�
�I�I�/�0���$�$�	-����Q�Y�Y��5����T�!�W�L�
N����S��V�L�
N��O�O�D�M�M�O�,�,��
	-�s�A�C*�-C*�.A1C%�%C*c�*`�[QQ2o[OQ2nURmUO	[
U1Qk2RO
2oUOQUO2UOQUOQ22P!)zgHTTP/1.0 401 Authorization Required
Content-type: text/html
WWW-Authenticate: Basic realm="example"
sContent-Lengthrfc�,:�ROQQQ2!)r��/urlr�)r�)r�s�r�<lambda>�&BasicTest.test_epipe.<locals>.<lambda>`s���$�,�,�u�f�f�"Err�zBasic realm="example"zwww-authenticate)
rIrr�r�rOrOr/r�r�r�)rr�r�r�s&  @r�
test_epipe�BasicTest.test_epipeWs�����
<�
�	��
�$�$�]�3����	����'�E�	G����!������d�k�k�*����2����(:�;�	=rc���QQQ**Q*o[O[U22oUO[O[O
1UO2P!)�HTTP/1.1 200 Okr_�r)rr�r
rO�LineTooLongrPr��rr�r�s&  r�test_overflowing_status_line�&BasicTest.test_overflowing_status_linehsO�� �3��;�.��7���"�"�:�d�#3�4�����6�-�-�v�/C�/C�D�d�j�j�Qrc���QQQ**Q*o[O[U22oUO[OUO
2P!)zHTTP/1.1 200 OK
X-Foo: barr&r�

)rr�r
rOrr�rs&  r�test_overflowing_header_line�&BasicTest.test_overflowing_header_linemsQ��
���;�
'�)3�
4�	
��"�"�:�d�#3�4�����&�,�,�d�j�j�9rc��QQ*o[O[U22oUO[O29^tt^2oUO2PPP2UO
Q[WO22UO
Q[UO22P!)%fhK\9h)zHTTP/1.1 100 OK
r
i�r,r�)	rr�r
rOr!r�r�r�	exception�rr�r��cms&   r�'test_overflowing_header_limit_after_100�1BasicTest.test_overflowing_header_limit_after_100us���
��
�	
��"�"�:�d�#3�4��
�
�
�v�3�3�
4�
4���J�J�L�5�	
�
�
�&��B�L�L�(9�:��
�
�i��R�\�\�!2�3�5�
4�s�B6�6C	�?C	c��Q[O]**o[O[U22oUO	[O
29^tt^2oUO
2PPP2UOQ[WO22UOQ[UO22P!)%fhK\9h)�HTTP/1.1 100 Continue

r,zinterim responses)
r�_MAXINTERIMRESPONSESr�r
rOr!r�r�rrrs&   r�test_too_many_interim_responses�)BasicTest.test_too_many_interim_responses�s���
,��*�*�Q�.�
0�	
��"�"�:�d�#3�4��
�
�
�v�3�3�
4�
4���J�J�L�5��
�
�&��B�L�L�(9�:��
�
�)�3�r�|�|�+<�=�5�
4�s�&C�C	�C	c��Qo[O[U2QQ5oUO2UO	UO
]�2UO	UO
2Q2UO2P!)rr�r�shellozvHTTP/1.1 100 Continue

HTTP/1.1 100 Continue

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Content-Length: 5

hello)rr�r
r�r�r�rYr+rs&  r�test_multiple_interim_responses�)BasicTest.test_multiple_interim_responses�sa��
�	
��"�"�:�d�#3�E�B���
�
��������c�*��������h�/��
�
�rc���QQQ**Q*o[O[U22oUO2UO	[O
UO2P!)z/HTTP/1.1 200 OK
Transfer-Encoding: chunked

r
rza
hello world
0

)rr�r
r�rOrrYrs&  r�test_overflowing_chunked_line�'BasicTest.test_overflowing_chunked_line�s\��
1��E�k�
��
�	
��"�"�:�d�#3�4���
�
�����&�,�,�d�i�i�8rc�x�Qo[U2o[OU2oUO2UO	UO2Q2UO
UO22UOUO2UO2UO
UO2P!)rrrlr�s&   r�test_early_eof�BasicTest.test_early_eof�s}�� ���$����"�"�4�(���
�
���������c�*�����
�
��(�������%��
�
��������$rc�`�[OQ2oPnU1QkQ[O2oV!m[	Q2UmUO
QQ2UO[OUO2UORO2UOUO
O2P!)rfc�0:`�\sQsQsnU1QksQsUsP!)�+BasicTest.test_error_leak.<locals>.Responsei�c�X:�Un[OOU,UN3-U@P!r4)rr�r)rrsrtr0s&*,�rr�4BasicTest.test_error_leak.<locals>.Response.__init__�s&������#�#�,�,�T�>�C�>�2�>rr5)r>r?r@rArrDrE)rGr0s@�r�Responser%�s����
?�
?rr(zInvalid status liner�r�)
rr�r��response_classr
r�r�rOrPr/rrNr)rr�r(r0s&  @r�test_error_leak�BasicTest.test_error_leak�s�����$�$�]�3����	?�v�*�*�	?�
'���4�5��	����U�C� ����&�.�.��0@�0@�A�������(�����	�	�-�-�.rc�.�Qo[Q*o[[U*[*[*2o[
OUQQ5oUO2UOUO2U2UO2P!)z3;foo=bar
sabcr�r�z3;foo=bar
abc
)r<r
r9�last_chunk_extendedr;rr�r�r�rYr+)r�extrar�r�r�s&    r�test_chunked_extension� BasicTest.test_chunked_extension�se��+��#�f�,���-�%�/�2E�E��S�T���"�"�4��6���
�
���������h�/��
�
�rc��[o[[[*2o[O
UQQ5oUO
2UOUO2U2UO2P!�r�r�)
r<r
r9r:rr�r�r�rYr+�rr�r�r�s&   r�test_chunked_missing_end�"BasicTest.test_chunked_missing_end�sP��#���-�*�4�5���"�"�4��6���
�
���������h�/��
�
�rc�x�[o[[[*[*[
*2o[OUQQ5oUO2UOUO2U2UOUOO2Q2UO2P!)r�r�r)
r<r
r9r:rtr;rr�r�r�rYr)r+r3s&   r�test_chunked_trailers�BasicTest.test_chunked_trailers�su��#���-�*�4�x�?�+�M�N���"�"�4��6���
�
���������h�/���������)�3�/��
�
�rc���POQ[[O]*222o[	[
[*U*[*2o[OUQQ5oUO2UO[OQ[OQ029^tt^2UO2PPP2UO2[	[
[*U*[*2o[OUQQ5oUO2UO[OQ[OQ029^tt^2UO[[2]*2PPP2UO2P!)%fhK�9h)%fhK59h)r�c3�@�SF �DoQUQUQ0w�	J	P!3hr5r5r(s& rr*�;BasicTest.test_chunked_too_many_trailers.<locals>.<genexpr>�s"��.K���.K��i��s�"�Q�C�t�$�.K�r7r�r�r,r8)r�r�rr r
r9r:r;r�r�r�r!rYr+r�r<)r�too_many_trailersr�r�s&   r�test_chunked_too_many_trailers�(BasicTest.test_chunked_too_many_trailers�s\���G�G�$
�.3�F�4F�4F��4J�.K�$
�
����J�&�):�:�[�H�J���"�"�4��6���
�
��
�
#�
#�� � ��V�/�/�0�	�:�
�
�
�I�I�K�	
�
	
�
�
����J�&�):�:�[�H�J���"�"�4��6���
�
��
�
#�
#�� � ��V�/�/�0�	�:�
�
�
�I�I�c�*�+�a�/�0�	
�
	
�
�
��#
�
��
�
�s$�F<�<&G�<G	�G	�G	�G	c��[oQo[[[*[*[
*U*2o[OUQQ5oUO2UOUO2U2UOUOO2UOQ22UO2P!)�	extradatar�r�r)r<r
r9r:rtr;rr�r�r�rYr)rr+)rr�r@r�r�s&    r�test_chunked_sync�BasicTest.test_chunked_syncs���#���	��-�*�4�x�?�+�M�PY�Y�Z���"�"�4��6���
�
���������h�/���������)�9�+;�+;�G�+D�E��
�
�rc�F�QoQo[QU*U*2o[OUQQ5oUO2UO	UO2U2UO	UOO2U2UO2P!)�	extradata�
Hello123
�'HTTP/1.1 200 OK
Content-Length: 10

r�r�)r
rr�r�r�rYr)r+�rr@r�r�r�s&    r�test_content_length_sync�"BasicTest.test_content_length_syncsw�� �	�"���J�X�U�Xa�a�b���"�"�4��6���
�
���������h�/���������)�9�5��
�
�rc�J�QoQo[QU*U*2o[OUQQ5oUO2UO	UOQ2U,2UO	UOO2U2UO2P!�rDrErFr�r�i�)	r
rr�r�r��	readlinesr)rYr+rGs&    r�test_readlines_content_length�'BasicTest.test_readlines_content_lengths|�� �	�"���J�X�U�Xa�a�b���"�"�4��6���
�
���������-��z�:���������)�9�5��
�
�rc�H�QoQo[QU*U*2o[OUQQ5oUO2UO	UOQ2U2UO	UOO2U2UO2P!rK)	r
rr�r�r�r�r)rYr+rGs&    r�test_read1_content_length�#BasicTest.test_read1_content_length&sz�� �	�"���J�X�U�Xa�a�b���"�"�4��6���
�
��������D�)�8�4���������)�9�5��
�
�rc��QoQo[QU*U*2o[OUQQ5oUO2UO	UO]
2U2UO	UO]
2Q2UO	UOO2U2UO2P!)rDrErFr�r�r)	r
rr�r�r�r^r)rYr+rGs&    r�"test_readline_bound_content_length�,BasicTest.test_readline_bound_content_length1s��� �	�"���J�X�U�Xa�a�b���"�"�4��6���
�
��������r�*�H�5�������r�*�C�0���������)�9�5��
�
�rc��QoQo[QU]**U*2o[OUQQ5oUO2UO	UO]2U]*2UO	UO
2U2UO	UOO
2U2UO2P!)rDrEs'HTTP/1.1 200 OK
Content-Length: 30

r�r�)	r
rr�r�r�r�rYr)r+rGs&    r�test_read1_bound_content_length�)BasicTest.test_read1_bound_content_length=s��� �	�"���J�X�VW�Z�W�Zc�c�d���"�"�4��6���
�
��������B���!��4��������h�/���������)�9�5��
�
�rc�``�[O[]12nUORO2PnUU1Qko[
OUQ5oUO2UOUO[]22[ORO2oUOQQ2UO2oUOUO [O"2[OUO%2Q5oUO'Q2UO)2UO	2UO	2UO2UORQ2P!SO)2h9hSO	2SO	2h9h)rc	�~:�RO2vqS9^tt^2UOQ29^tt^2oUO2oUOQ2%cJ*UO	Q2UO2nPPP2PPP2P!)%fhK9h)%fhP!9h)r'rs'HTTP/1.1 200 Connection established

)�acceptr.r^�rstripr#rY)r��address�readerrm�result�servs    ��r�
run_server�2BasicTest.test_response_fileno.<locals>.run_serverOsu���"�k�k�m�O�T���t�}�}�T�*�*�f��!�?�?�,�D��;�;�w�/�/�����K�L������+���*�*�����s4�B+�&B	�$"B	�B+�B(
�!B(
�#B+�+B<	�4B<	��targetr�z
dummy:1234)�filenos
proxied data
)�socket�
create_server�HOST�
addCleanupr+�	threading�Thread�startr��floatrr��getsocknamer�r/r�r�r�rdr#�detach)rr`�threadr�r0r�r^r_s&     @@r�test_response_fileno�BasicTest.test_response_filenoIs2����#�#�T�1�I�.������
�
�#���
	'��!�!��4������������U�1�X�.��$�$�d�&6�&6�&8�9�����Y��-��#�#�%��		����X�_�_�f�i�i�8��
�
�X�_�_�%6�7�A�
��	�	�+�,����
��N�N���J�J�L����
�����!2�3�����
���N�N���J�J�L�s%�AF!�&F�7F!�F�F!�!"Gc
�``�[O[]12nUORO2UU1Qko[
OUQ5oUO2UOUOQ2[ORO2o[]]2FDho]U*nUOQQ2UO29^tt^2oUO[!UO#22R2PPP2Jj	UO	2UOQ2P!)%fhJ�9hSO	2SOQ2h9h)rc�j:�RO2vqS9^tt^2UOQ2%c`UOQR*2UOQR]**2UOQRR]**
*2JvPPP2P!)%fhP!9h)�s'HTTP/1.1 200 Ok
Content-Length: %d

�A�B�rZ�recvr#�r�r\r_rus  ��rr`�7BasicTest.test_large_content_length.<locals>.run_serverrs|���"�k�k�m�O�T����i�i��o�o��L�L� �"&�'�(��L�L���q��!1�2��L�L����a���!8�9�
&�����s�B!�AB!�!B2	�*B2	rb��?r�r�)rerfrgrhr+rirjrkr�rr�rmr�r�r/r�r�rY�rr`ror��wr0r_rus&     @@r�test_large_content_length�#BasicTest.test_large_content_lengthns
����#�#�T�1�I�.������
�
�#�		:��!�!��4������������S�)��$�$�d�&6�&6�&8�9��	��2�r�]���A�v�����U�C�(��%�%�'�'�8��$�$�S�����%9�4�@�(�'�#�
�J�J�L��K�K���	(�'�'��
�J�J�L��K�K���s+�)AE�,*E	�E�E
�E
�	E�#E<c	�``�[O[]12nUORO2UU1Qko[
OUQ5oUO2UOUOQ2[ORO2o[]]A2FDyo]U*nUOQQ2UO29^tt^2oUO[O UO"2PPP2UO	2J{	UO	2]nUOQQ2UO	2UOQ2P!)%fhKk9hSO	2]nSOQQ2SO	2SOQ2h9h)rc�:�RO2vqS9^tt^2UOQ2R%fPPP2P!UOQR*2PPP2Jd)%fhJu9h)Trts+HTTP/1.1 200 Ok
Content-Length: %d

Textrwrys  ��rr`�ABasicTest.test_large_content_length_truncated.<locals>.run_server�sY����"&�+�+�-����T��I�I�d�O����T��L�L� �#'�'�(�	�T�T�T�s�A'�A'�A'�'A8	�0A8	rbr{r�r�)rerfrgrhr+rirjrkr�rr�rmr�r�r/rOr�rYr|s&     @@r�#test_large_content_length_truncated�-BasicTest.test_large_content_length_truncated�sG����#�#�T�1�I�.������
�
�#�	(��!�!��4������������S�)��$�$�d�&6�&6�&8�9��	��2�r�]���A�v�����U�C�(��%�%�'�'�8��%�%�f�&;�&;�X�]�]�K�(��
�
��#�
�J�J�L��D��L�L���$��J�J�L��K�K���(�'��
�J�J�L��D��L�L���$��J�J�L��K�K���s,�)AF
�,+E:	�F
�:F

�F

�F
�
AGc��QQ[O2oUQ2o[P2UmUO	QQ2P!)c�(`�\sQsQsnQsQsUsP!)�RBasicTest.test_putrequest_override_domain_validation.<locals>.UnsafeHTTPConnectioni�c��P!r4r5�rrFs&&r�_validate_path�aBasicTest.test_putrequest_override_domain_validation.<locals>.UnsafeHTTPConnection._validate_path����rr5)r>r?r@rAr�rDrErFs@r�UnsafeHTTPConnectionr�������
�
rr�rfr�z/�rr�r
r�r��rr�r�s&  r�*test_putrequest_override_domain_validation�4BasicTest.test_putrequest_override_domain_validation�s9��
	�6�#8�#8�	�$�M�2���r�N��	�����w�'rc��QQ[O2oUQ2o[P2UmUO	QQ]Q5P!)c�(`�\sQsQsnQsQsUsP!)�PBasicTest.test_putrequest_override_host_validation.<locals>.UnsafeHTTPConnectioni�c��P!r4r5r�s&&r�_validate_host�_BasicTest.test_putrequest_override_host_validation.<locals>.UnsafeHTTPConnection._validate_host�r�rr5)r>r?r@rAr�rDrErFs@rr�r��r�rr�z
example.com
r�r�)�	skip_hostr�r�s&  r�(test_putrequest_override_host_validation�2BasicTest.test_putrequest_override_host_validation�s@��	�6�#8�#8�	�$�$5�6���r�N��	�	
����s�a��0rc��QQ[O2oUQ2o[P2UmUO	QQ2P!)c�(`�\sQsQsnQsQsUsP!)�IBasicTest.test_putrequest_override_encoding.<locals>.UnsafeHTTPConnectioni�c�&�UOQ2!)�utf-8r')r�str_urls&&r�_encode_request�YBasicTest.test_putrequest_override_encoding.<locals>.UnsafeHTTPConnection._encode_request�s���~�~�g�.�.rr5)r>r?r@rAr�rDrErFs@rr�r��s����
/�
/rr�rfr�u/☃r�r�s&  r�!test_putrequest_override_encoding�+BasicTest.test_putrequest_override_encoding�s9��	/�6�#8�#8�	/�$�M�2���r�N��	�����v�&rr5)@r>r?r@rAr�r6r>rHrQrVr^rarirmrqrtrwr{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr	r
rrrrr!r*r/r4r7r=rArHrMrPrSrVrpr~r�r�r�r�rDrErFs@rryry�s6����a�p>�d.�9�$<�*?�
%�
%�%�(
%�
%�%� )�&)�%�,(�"'�$C�
.�F�7�.�.�*.� 
)�	.�/�1�f)�V%�(%�.)�1� 
=�"R�
:�4�>�� 9�
%�/� ��	��:
�
�	�	�
�
�#4�J�<"�H(�	1�'�'rryc�`�\sQsQsnQs\\OQ2PO
Q2sQsQs	Qs
QsQ	sQQ
ks
QsQsQ
sQsQsQsUsP!)�ExtendedReadTesti�zOHTTP/1.1 200 OK

hello world!
and now 
for something completely different
foo�hellor��HTTP/1.1 200 OK
Transfer-Encoding: chunked

a
hello worl
3
d!

9
and now 

23
for something completely different

3
foo
0

c���[UO2o[OUQQ5oUO	2[
OUO2UmV mP!r2)	r
rrr�r�rB�BufferedReader�fpr�r�s&  r�setUp�ExtendedReadTest.setUp�sF���$�*�*�%���"�"�4��6���
�
���#�#�D�G�G�,����	rc�`�UOoUOOnQU1QkkoV!Om,oUO]2oU%c�UO[	U2]2UO2oUO[	U2[	U22UO
VT2UO[	U22oUOVe2L!UO2oUOU2UOU2U%cJ�UOQOU2UO2P!)r!c�@:�RU2oU]6�cUPU!UQ*!)r:N�
Nr5)r[r��oldpeeks& �r�mypeek�*ExtendedReadTest.test_peek.<locals>.mypeeks'�����
�A��A�v���!�u���S�6�Mrrra)
r�r��peek�
assertGreaterr�r;r�rYr�rCr�r��lines_expected)rr�r��allr��p2r�r�s&      @r�	test_peek�ExtendedReadTest.test_peek�s�����y�y���'�'�,�,��	�
��������	�	�!��A���"�"�3�q�6�1�-��Y�Y�[���'�'��B���Q��8��%�%�b�,��y�y��R��)��� � ��*��y�y�{��� � ��&��J�J�t���4��������#���(;�(;�<rc��UOoUOUOOUO2P!r4)r��_verify_readliner^r�)rr�s& r�
test_readline�ExtendedReadTest.test_readlines+���y�y�����d�i�i�0�0�$�2E�2E�Frc�l�UOUOOUOPQ5P!)r!)�limit)r�r�r^r�r1s&r�test_readline_without_limit�,ExtendedReadTest.test_readline_without_limit!s'�����d�i�i�0�0�$�2E�2E�R��Prc�L�,oUU2oU%c*UQ6wc#[U2]6cUOUQ2UOU2U%cJUUOQO	U2U2UOUOO22P!)T�foo�
r)r�r�r�r�r�rr�rM)rr^r�r�r�rms&&&&  rr��!ExtendedReadTest._verify_readline$s|������E�?�D������t�9�q�=��'�'��e�4��J�J�t���4��������#���1�����	�	�*�*�,�-rc�``�ROnUU1Qko[U2oROUORO2P!)c�b:�RO]2oRO[U2]2U!)rp)r�r<r�)�resr�rs ��rr&�&ExtendedReadTest.test_read1.<locals>.r4s)����*�*�Q�-�C�� � ��S��1�-��Jr)r��	Readlinerr�r^r�)rr&�	readlinerr�sf  @r�
test_read1�ExtendedReadTest.test_read12s8����y�y��	��a�L�	����i�0�0�$�2E�2E�Frc��UOo,oUO2oU%fLUOU2J-UOQO	U2UO
2UO
UO22P!�Tr)r�r�r�r�r�r�rrM�rr�r�rs&   r�test_read1_unbounded�%ExtendedReadTest.test_read1_unbounded;s`���y�y������:�:�<�D����J�J�t��������#���(;�(;�<�����
�
��(rc�J�UOo,oUO]
2oU%fL.UO[U2]
2UO	U2JIUOQO
U2UO2UOUO22P!r�)
r�r�r<r�r�r�r�r�rrMr�s&   r�test_read1_bounded�#ExtendedReadTest.test_read1_boundedFsv���y�y������:�:�b�>�D���� � ��T��B�/��J�J�t��������#���(;�(;�<�����
�
��(rc��UOUOO]2Q2UOUOO	22P!)rr)r�r�r�rCrMr1s&r�test_read1_0�ExtendedReadTest.test_read1_0Rs:�����������+�S�1�������+�+�-�.rc�t�UOO]2oUO][U22P!�r)r�r�r<r�)rr�s& r�test_peek_0�ExtendedReadTest.test_peek_0Vs(���I�I�N�N�1������Q��A��'r�r�)�)r>r?r@rAr�findrr��
lines_chunkedr�r�r�r�r�r�r�r�r�r�rDrErFs@rr�r��sv����
	�
��5�:�:�g�.�/�0�7�7��@�N�
	��"�=�>G�Q�.�G�	)�
)�/�(�(rr�c��\sQsQs\O
O
Q]2vss\Q\	\2Q0*\*sQs
P!)�"ExtendedReadTestContentLengthKnowni[rz
Content-Length: r5)r>r?r@rAr�rr��_header�_bodyr�rDr5rrr�r�[s;��%�+�+�1�1�*�a�@�N�G�U��,�S��Z�L��A�A�E�I�Err�c��\sQsQsQsQsP!)�ExtendedReadTestChunkedi`r�r5)r>r?r@rArrDr5rrr�r�`s��

	�
rr�c�.`�\sQsQsnQsQsQsUsP!)r�ivc�"�VmQUmP!)r��readfunc�	remainder)rr�s&&rr�Readliner.__init__zs�� �
���rc��,o]oUOoUOQ2oUP6wcLTU[U2*U6�cV*
]*
oUOU2UO	2oU%cJk]oU]*
oUOUPU2VEPUmQOU2!QOS2Smg9h)rr�r)r�r�r�r�r�r�)rr�r�datalenrYrls&&    rr^�Readliner.readline~s��������~�~��	���i�i��&���"�9���S��Y�&�%�/��/�A�-�C����D�!��}�}����t��C���1�H�C��K�K��T�c�
�#�!�$�Z�D�N��8�8�D�>�!��	� �X�X�d�^�D�N��s�B8�B8�5B8�>9B8�8Cr�)r>r?r@rArr^rDrErFs@rr�r�vs������rr�c�4`�\sQsQsnQsQsQsQsUsP!)�OfflineTesti�c�,�Q.oQQ.o[[2FDWoUOQ2%fV27cJ"[[U2o[UQP2Q6XfJFUO	U2JY	UO[OU2P!)�	responses�HTTPMessage�
parse_headersrTr?zhttp.client)r�r�
startswithrB�add�assertCountEqual�__all__)rr��denylistr��
module_objects&    r�test_all�OfflineTest.test_all�sy���=��"�?�3����K�D����s�#�#�t�'7��#�F�D�1�M��}�l�D�9�]�J����T�"� �	
���f�n�n�h�7rc�r�UO[O[O*Q2P!)r�)r�rr�r
r1s&r�test_responses�OfflineTest.test_responses�s#������)�)�&�*:�*:�;�[�Irc	��,QMQMQMQMQMQMQMQMQMQ	MQ
MQMQMQ
MQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQ MQ!MQ"MQ#MQ$MQ%MQ&MQ'MQ(MQ)MQ*MQ+MQ,MQ-MQ.MQ/MQ0MQ1MQ2MQ3MQ4MQ5MQ6MQ7MQ8MQ9MQ:MQ;MQ<MQ=MoSFD<oUOUQ>59^tt^2UO[U2PPP2J>	P!)%fhJS9h)?r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr	r
rrr
rrrrrrrrrrrrrrrrrrr r"r#r$r%r&r'r(r)r*r+r,r.r0r1r�r!)�constant)r��
assertHasAttrr)rr��consts&  r�test_client_constants�!OfflineTest.test_client_constants�s���?
��?
�!�?
�
�?
�
�	?
�

�?
�
�
?
�
,�?
�
�?
�
�?
�
�?
�
�?
�
�?
�
�?
�
 �?
�
�?
� 
�!?
�"
�#?
�$
�%?
�&
!�'?
�(
�)?
�*
�+?
�,
�-?
�.
�/?
�0
�1?
�2
!�3?
�4
�5?
�6
,�7?
�8
�9?
�:
�;?
�<
�=?
�>
�??
�@
"�A?
�B
 �C?
�D
'�E?
�F
�G?
�H
#�I?
�J
%�K?
�L
$�M?
�N
.�O?
�P
!�Q?
�R
�S?
�T
"�U?
�V
$�W?
�X
#�Y?
�Z
�[?
�\
 �]?
�^
�_?
�`
$�a?
�b
 �c?
�d
.�e?
�f
,�g?
�h
$�i?
�j
�k?
�l
�m?
�n
"�o?
�p
�q?
�r
)�s?
�t
#�u?
�v
�w?
�x
.�y?
�z
�{?
�|
�}?
��@�E����u��-�-��"�"�6�5�1�.�-��-�-�-�s� C	�C
�C
r5)	r>r?r@rAr�rrrDrErFs@rr�r��s����8�J�D2�D2rr�c�~`�\sQsQsnQsQsQs\O\	\
Q2%(Q2Q2sQsUs
P!)	�SourceAddressTesti�c�8�[O[O[O2Um[O
UO2Um[O2UmUOO2PUm
P!r4)re�AF_INET�SOCK_STREAMr_r�	bind_portr�find_unused_port�source_port�listenr�r1s&rr��SourceAddressTest.setUp�s\���M�M�&�.�.�&�2D�2D�E��	�!�+�+�D�I�I�6��	�(�9�9�;����	�	������	rc��UO%c"UOO2PUmUOO2PUmP!r4)r�r+r_r1s&r�tearDown�SourceAddressTest.tearDown�s5���9�9�9��I�I�O�O���D�I��	�	������	rc�6�[O[UOPUO1Q5UmUO
O
2UOUO
OO2]*UO2P!�r�)�source_address)
rr�rgrrr�rpr�r�rmr1s&r�testHTTPConnectionSourceAddress�1SourceAddressTest.testHTTPConnectionSourceAddresssf���)�)�$��	�	� "�D�$4�$4�5�7��	��	�	������������3�3�5�a�8�$�:J�:J�Kr�HTTPSConnectionz'http.client.HTTPSConnection not definedc�x�[O[UOPUO1Q5UmP!r)rrrgrrr�r1s&r� testHTTPSConnectionSourceAddress�2SourceAddressTest.testHTTPSConnectionSourceAddresss,���*�*�4���� "�D�$4�$4�5�7��	r)r�rr_r)r>r?r@rAr�rr�unittest�skipIf�hasattrrrrDrErFs@rr
r
�sD������L��_�_���):�;�;�>�@�7�@�7rr
c�8`�\sQsQsnPsQsQsQsQsUs	P!)�TimeoutTestic��[O[O[O2Um[O
UO2[mUOO2P!r4)	rerr
r_rrr#�PORTrr1s&rr��TimeoutTest.setUpsE���M�M�&�.�.�&�2D�2D�E��	�(�2�2�4�9�9�=����	�	���rc�J�UOO2PUmP!r4)r_r+r1s&rr�TimeoutTest.tearDowns���	�	������	rc�r�UO[O22[O]2[O
[[O2oUO2[OP2UOUOO2]2UO2UO[O22[O]2[O
[[OPQ5oUO2[OP2UOUOO2P2UO2[O
[[O]Q5oUO2UOUOO2]2UO2P![OP2h9h[OP2h9h��)�timeout)�assertIsNonere�getdefaulttimeout�setdefaulttimeoutrr�rgr#r%rpr�r��
gettimeoutr+)r�httpConns& r�testTimeoutAttribute� TimeoutTest.testTimeoutAttributes���
	
���&�2�2�4�5�� � ��$�	+��,�,�T�;�3C�3C�D�H������$�$�T�*�������1�1�3�R�8�����	
���&�2�2�4�5�� � ��$�	+��,�,�T�;�3C�3C�6:�<�H������$�$�T�*�������1�1�3�T�:������(�(��{�/?�/?��L������������1�1�3�R�8������)
�$�$�T�*��
�$�$�T�*�s�9H�;H�H�H6)r_)
r>r?r@rAr%r�rr2rDrErFs@rr#r#s�����D��
��rr#c�4`�\sQsQsnQsQsQsQsUsP!)�PersistenceTesti>c���QoSFCD>vq#oUOV#Q59^tt^2QOV#2o[U2oUOUO2UOQQ2UO
29^tt^2oUOUOPIU%(2UO2PPP2UOUOPIU%(2UOUO]2UOQQ2SOUOU%c]L]2PPP2CJA	P!)%fhK�9h)%fhCJj9h)�1.0)�versionr�z4HTTP/{} 200 OK
{}Content-Length: 12

Dummy body
r�z/open-connectionz/subsequent-request))r7r�F)r7zConnection: keep-alive
T)�1.1r�T)r9zConnection: close
F)r7zConnection: keep-ALIVE
T)r9zConnection: cloSE
F)
r�r�rdr-r�r�r/r�rYrg)r�testsr8r��reuser�r�r0s&       r�test_reuse_reconnect�$PersistenceTest.test_reuse_reconnect@s!��
��',�"�G�U����g��=�=�%�
�&��)�
�0��4���!�!�$�)�)�,����U�$6�7��%�%�'�'�8��$�$�T�Y�Y�$�%6�E�	�B��M�M�O�(�� � ����d�!2��I�>�� � ��!1�!1�1�5����U�$9�:�� � ��!1�!1��1�1�E�#>�=�',�(�'��>�=�=�s7�A"E	�
4E
�>A6E	�5E	�E�E�E	�E1
�(E1
c	���Qo[O[O1U[11oSFD�vq4UOUQ59^tt^2[
QU2oUOQQ2UOVEO2UOUO2UOQQ2UOUO]2PPP2J�	P!)%fhJ�9h)c�x`�[OU2nU1QkoURm[OR2!)c�l:�[OORU2oU]6Xc[2gU!r�)rBrCrf�ConnectionResetError)�bufferru�streams& �rrf�NPersistenceTest.test_disconnected.<locals>.make_reset_reader.<locals>.readintocs.����z�z�*�*�6�6�:���1�9�.�0�0��r)rBrCrfr�)rrfrCs& @r�make_reset_reader�<PersistenceTest.test_disconnected.<locals>.make_reset_reader`s0����Z�Z��%�F�
�
'�F�O��$�$�V�,�,r)rrr�z
/eof-response�
/reconnect)rBrCr�RemoteDisconnectedrAr�rdr�rOr/r-r�r�rg)rrEr:�stream_factoryrr�s&     r�test_disconnected�!PersistenceTest.test_disconnected^s���		-��Z�Z��2�2�3�
� 4�5�
��*/�%�N����	��2�2�/��^�D�����U�O�4��!�!�)�-=�-=�>��!�!�$�)�)�,����U�L�1�� � ��!1�!1�1�5�3�2�*/�2�2�2�s�BC 	� C1
�)C1
c�0�[Q2oUOQQQQ-Q5UO[OUO
2UO
UO2UOQQ2UOUO]2P!)sHTTP/1.1 100 Continue

r�r��Expectz100-continuerrG)
rdr�rOrrHr/r-r�r�rgr�s& r�test_100_close�PersistenceTest.test_100_closeys|��'�
�
��
	
���U�C�(�N�)C��D����&�3�3�T�5E�5E�F����$�)�)�$����U�L�)�����)�)�1�-rr5)	r>r?r@rAr<rJrNrDrErFs@rr5r5>s����F�<6�6
.�
.rr5c�`�\sQsQsnQsQsQsQsQs\	OQ2sQs\	OQ	2Q
2sQsQsQ
s\O&\\Q2%(Q2Q2sQsQsUsP!)�	HTTPSTesti�c�Z�[[Q2%fUOQ2P!P!)rzssl support required)r!r�skipTestr1s&rr��HTTPSTest.setUp�s"���v�0�1�1��M�M�0�1�2rc�"�]QHGoUVQ5!)r)�make_https_server)�certfile)�test.ssl_serversrV)rrWrVs&& r�make_server�HTTPSTest.make_server�s��6� ��9�9rc��[O[[O]Q5oUOUO]2P!r*)rrrgr#r%r�r,)rr�s& r�test_attributes�HTTPSTest.test_attributes�s0���"�"�4��)9�)9�2�F��������B�'rc	���]PHo[OQ2[OQ29^tt^2[
OQQ2oUOUO29^tt^2oUOQQ2PPP2UOWOOQ2PPP2P!)%fhK@9h)%fhP!9h)r�network�self-signed.pythontest.net�r�r��CERTIFICATE_VERIFY_FAILED)
�sslr�requiresr�transient_internetrrrO�SSLErrorr�r�rr�)rrcr��exc_infos&   r�test_networked�HTTPSTest.test_networked�s��������#�
�
-�
-�.J�
K�
K��&�&�'C�S�I�A��"�"�3�<�<�0�0�H��	�	�%��%�1����X�/�/�6�6�8S�T�	L�
K�0�0��L�
K�
K�s/�;C�5C	�.C�C
�	C
�C�C$	�C$	c���]PHo[OQ2[OQ29^tt^2UO2o[OQQUQ5oUOQQ2UO2oUO2UOQUOQ22UO2PPP2P!)%fhP!9h)	rr_r`ra��contextr�r��nginx�server)
rcrrdrre�_create_unverified_contextrrr�r/r+r�r�)rrcrlr�r�s&    r�test_networked_noverification�'HTTPSTest.test_networked_noverification�s��������#�
�
-�
-�.J�
K�
K��4�4�6�G��&�&�'C�S�/6�8�A�
�I�I�e�S�!��=�=�?�D�
�G�G�I��M�M�'�4�>�>�(�#;�<��J�J�L�L�
K�
K�
K�s�B
C�C"	�C"	c��[OQ2[OQ29^tt^2[O
QQ2oUO
QQ2UO2oUOQ2oUO2UO2UOQU2PPP2P!)%fhP!9h)r_r�rar�r�zcontent-typez	text/html)rrdrrerrr�r/r�r+r�)rr�r��content_types&   r�&test_networked_trusted_by_default_cert�0HTTPSTest.test_networked_trusted_by_default_cert�s���	����#�
�
-�
-�.>�
?�
?��&�&�'7��=�A�
�I�I�e�S�!��=�=�?�D��>�>�.�9�L��J�J�L�
�G�G�I��M�M�+�|�4�@�
?�
?�
?�s�A=B=�=C	�C	c
�V�]PHo[OQ2Qo[OU29^tt^2UOUO2oUOUOUO2UOUOP	2UO[2[OUQUQ5oUOQQ2UO!2oUO/Q2oUO12UO12UO3QU2PPP2P!SO"cLo[%S2o[&O(QS2%c[*O,QSQ	SQ
02ggPo=hh9h)%fhP!9h)
rr_r`rarkr�r�z(?i)key.too.weakzGot z trying to connect to z). See https://bugs.python.org/issue36816.rnrm)rcrrdrre�
SSLContext�PROTOCOL_TLS_CLIENTr��verify_mode�
CERT_REQUIRED�check_hostname�load_verify_locations� CERT_selfsigned_pythontestdotnetrrr�r/rfr�re�searchr�SkipTestr�r+r�)	rrc�selfsigned_pythontestdotnetrlr�r��ssl_err�ssl_err_str�
server_strings	&        r�test_networked_good_cert�"HTTPSTest.test_networked_good_cert�sg�������#�&B�#�
�
-�
-�.I�
J�
J��n�n�S�%<�%<�=�G����W�0�0�#�2C�2C�D����W�3�3�T�:��)�)�*J�K�
��*�*�+F��3:�<���	�	�%��%��}�}���!�N�N�8�4�M��J�J�L�
�G�G�I��M�M�'�=�1�5K�
J���<�<�
�!�'�l���9�9�0�+�>�>�"�+�+��{�m�,�9�:�;B�B�C�C���
��K�
J�
J�sC�A3F�0;D8�+AF�8F�F�	'F�1F�F�F�F(	� F(	�walltimec	�2�]PHo[OQ2[OQ29^tt^2UOUO2oUO[2[OQQUQ5oUOUO29^tt^2oUOQQ2PPP2UOWOO Q2PPP2P!)%fhK@9h)%fhP!9h)rr_r`rarkr�r�rb)rcrrdrrerwrxr|�CERT_localhostrrrOrfr�r�rr�)rrcrlr�rgs&    r�test_networked_bad_cert�!HTTPSTest.test_networked_bad_cert�s���	�����#�
�
-�
-�.J�
K�
K��n�n�S�%<�%<�=�G��)�)�.�9��&�&�'C�S�RY�Z�A��"�"�3�<�<�0�0�H��	�	�%��%�1����X�/�/�6�6�8S�T�
L�
K�1�0��	L�
K�
K�s0�A-D�'C2	�:.D�2D
�;D
�=D�D	�D	c�j�]PHoUO[2o[OQUO
2oUO
UO29^tt^2oUOQQ2PPP2UOWOOQ2P!)%fhK89h)r�	localhostr�r�rb)rcrYr�rrrrOrfr�r�rr�)rrcrnr�rgs&    r�test_local_unknown_cert�!HTTPSTest.test_local_unknown_cert�s{����!�!�.�1���"�"�;����<��
�
�
�s�|�|�
,�
,��
�I�I�e�S�!�-�����+�+�2�2�4O�P�-�
,�s�B"�"B2	�+B2	c���]PHoUO[2oUOUO2oUO[2[OQUOUQ5oUOUO2UOQQ2UO2oUOUO2UOUOQ2P!)rr�rkr��/nonexistentr})rcrYr�rwrxr|rrrrhr+r�r/r�r��rrcrnrlr�r�s&     r�test_local_good_hostname�"HTTPSTest.test_local_good_hostname�s�����!�!�.�1���.�.��!8�!8�9���%�%�n�5��"�"�;����W�M�������� �	�	�	�%��(��}�}�������
�
�#�������c�*rc��]PHoUO[2oUOUO2oUO[2[OQUOUQ5oUOUO29^tt^2UOQQ2PPP2P	Um[OQUOUQ5oUOUO29^tt^2UOQQ2PPP2P
Um[OQUOUQ5oUOQQ2UO2oUO2UO2UOUO Q2P!)%fhCK9h)%fhK�9h)rr�rkr�r�r�r})rcrY�CERT_fakehostnamerwrxr|rrrrO�CertificateErrorr�r{r/r+r�r�r�s&     r�test_local_bad_hostname�!HTTPSTest.test_local_bad_hostname�s=����!�!�"3�4���.�.��!8�!8�9���%�%�&7�8��"�"�;����W�M��
�
�
�s�3�3�
4�
4�
�I�I�e�S�!�5�"&����"�"�;����W�M��
�
�
�s�3�3�
4�
4�
�I�I�e�S�!�5�"'����"�"�;����W�M��	�	�	�%��(��}�}����
�
��	���	�������c�*�!5�
4�
4��5�
4�s$�F�9F2�F/	�'F/	�2G	�;G	rz)http.client.HTTPSConnection not availablec�,�QFD2oUO[O[OU2J4	QFDRvqo[OU2oUO	V$O
2UO	V4O2JT	P!)r�r�)r�)zwww.python.org:443r�ra)r�r�ra)r�r�ra)r�r�ra)r�r�ra)rOrr�rr�rrr�s&    rr��HTTPSTest.test_host_port	st��
I�B����f�/�/��1G�1G��L�I�#�H�B�1��&�&�r�*�A����Q���'����Q���'�#rc���]PHoUO%cUO%fUOQ2[O
QQ2oUO
UOO2UOUO2oUOUO2[O
QQUQ5oUOUOU2UOUOO2UOUO[Q5oP	Um[O
QQUQ5oUO
UOO2P!)rzTLS 1.3 PHA support requiredr�rark)�	cert_file)rc�HAS_TLSv1_3�HAS_PHArSrrr�_context�post_handshake_authrwrxrC�assertIsr�)rrcr�rls&   r�test_tls13_pha�HTTPSTest.test_tls13_pha+	s��������c�k�k�k��M�M�8�9��"�"�;��4������
�
�6�6�7��.�.��!8�!8�9������4�4�5��"�"�;��W�E���
�
�a�j�j�'�*�������7�7�8��.�.��!8�!8�N�.�S��&*��#��"�"�;��W�E������
�
�6�6�7rr5)r>r?r@rAr�rYr\rhrpr�system_must_validate_certrtr��requires_resourcer�r�r�r�rr r!rr�r�rDrErFs@rrQrQ�s�����2�:�(�
U��
�&�&�
5�'�
5�2�B
���z�*�
U�+�
U�Q�+�+�2�_�_���):�;�;�@�B�(�B�(�$8�8rrQc�X`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sQ
sQs
UsP!)�RequestBodyTesti?	c��[OQ2Um[P29UOmUmUOUOmP!)rf)rr�r�r
r�r1s&rr��RequestBodyTest.setUpB	s9���)�)�-�8��	�%/��^�3��	�	��������	�	�rc��[OUOO2oUO	2[
OU2oV!1!r4)rBrCr�rr^rr��r�f�messages&  r�get_headers_and_fp�"RequestBodyTest.get_headers_and_fpG	s9���J�J�t�y�y�~�~�&��	�
�
���&�&�q�)���z�rc	�<�QQ,Q1Q
1oSFD�vq#UOU29^tt^2[OQ2Um[	P29UOmUmUOO
QQU2UO2vqEUOQU2UOQU2UOUOQ2Q	2UOV5O22PPP2J�	P!)%fhCJ9h)r��bar�3
foo
3
bar
0

rfr�r�zContent-Typer�rXrY))r�r�r�)r�rr�r�r
r�r�r�r\r��getrY)rr�r�r�r�r�s&     r�test_list_body�RequestBodyTest.test_list_bodyM	s���
�f�
�C�D�D�
��$�N�D����d�#�#�"�1�1�-�@��	�-7��^�;��	�	�����	�	�!�!�%���6��0�0�2���� � ���5�� � �!1�3�7�� � ����)<�!=�y�I�� � ��6�6�8�4�$�#�$�#�#�#�s�CD		�	D
�D
c��UOOQQQQQ-2UO2vqUOQUO	Q22UO][UO
222P!)r�r�r�r��42rZ)r�r�r�r�r�r�rY�rr�r�s&  r�test_manual_content_length�*RequestBodyTest.test_manual_content_lengtha	sh��	
�	�	���%���+�T�2�	4��,�,�.�
������w�{�{�+;�<�=�����C�����M�*rc�f�UOOQQQ2UO2vqUOQUO	22UOUO
22UOQUOQ22UOQUO22P!)r�r�r��
text/plain�4rZsbody�	r�r�r�r��get_content_typer-�get_charsetr�rYr�s&  r�test_ascii_body�RequestBodyTest.test_ascii_bodyj	s����	�	���%���0��,�,�.�
������w�'?�'?�'A�B����'�-�-�/�0�����g�k�k�*:�;�<�����!�&�&�(�+rc�f�UOOQQQ2UO2vqUOQUO	22UOUO
22UOQUOQ22UOQUO22P!)r�r�ubodyÁr��5rZ�body�r�r�s&  r�test_latin1_body� RequestBodyTest.test_latin1_bodyr	s����	�	���%���4��,�,�.�
������w�'?�'?�'A�B����'�-�-�/�0�����g�k�k�*:�;�<�����a�f�f�h�/rc�f�UOOQQQ2UO2vqUOQUO	22UOUO
22UOQUOQ22UOQUO22P!)r�r�r�r�r�rZr�r�s&  r�test_bytes_body�RequestBodyTest.test_bytes_bodyz	s����	�	���%���5��,�,�.�
������w�'?�'?�'A�B����'�-�-�/�0�����g�k�k�*:�;�<�����a�f�f�h�/rc�&�UO[O[O2[	[OQQQ59^tt^2oUOQ2PPP2[	[OQQ59^tt^2oUOOQQU2UO2vq!UOQUO22UOUO22UOUOQ22UOQUOQ	22UOQ
UO22PPP2P!)%fhCK9h)%fhP!9h)r}r�)�encodingr�r�r�r�rZrYztransfer-encodings4
body
0

)rhr�unlink�TESTFNr��writer�r�r�r�r�r-r�r�rYr�s&  r�test_text_file_body�#RequestBodyTest.test_text_file_body�	s�����	�(�(�)�*:�*:�;�
�)�"�"�C�'�
:�
:�a�
�G�G�F�O�;�
�)�"�"�W�
5�
5���I�I���e�V�Q�/��0�0�2�J�G����\�7�+C�+C�+E�F����g�1�1�3�4�
���g�k�k�*:�;�<����Y����4G�(H�I����6�����A�6�
5�;�
:�
:��
5�
5�
5�s%�E+�CE?�+E<	�4E<	�?F	�F	c��UO[O[O2[	[OQ29^tt^2oUOQ2PPP2[	[OQ29^tt^2oUOOQQU2UO2vq!UOQUO22UOUO22UOQUOQ22UOQU2UOQ	UO22PPP2P!)%fhK�9h)%fhP!9h)
�wbr�r'r�r�r�rYrXr�s5
body�
0

)rhrr�r�r�r�r�r�r�r�r�r-r�r�r\rYr�s&  r�test_binary_file_body�%RequestBodyTest.test_binary_file_body�	s
�����	�(�(�)�*:�*:�;�
�)�"�"�D�
)�
)�Q�
�G�G�K� �*�
�)�"�"�D�
)�
)�Q��I�I���e�V�Q�/��0�0�2�J�G����\�7�+C�+C�+E�F����g�1�1�3�4����Y����4G�(H�I����-�w�7����:�A�F�F�H�E�*�
)�*�
)��
)�
)�
)�s%�E�CE-�E*	�#E*	�-E>	�6E>	)r�r�)r>r?r@rAr�r�r�r�r�r�r�r�r�rDrErFs@rr�r�?	s:����#�
�5�(+�,�0�0�
B�F�Frr�c�F`�\sQsQsnQsQsQsQsQsQs	Qs
UsP!)	�HTTPResponseTesti�	c��Qo[U2o[OU2UmUOO	2P!)zXHTTP/1.1 200 Ok
My-Header: first-value
My-Header:                 second-value

Text)r
rr�r�r�)rr�r�s&  rr��HTTPResponseTest.setUp�	s3��*���$����'�'��-��	��	�	���rc��UOOQ2oUOUQ2UOOQQ2oUOUQ2P!)z	My-Headerzfirst-value, second-valuezsome default�r�r�r��rr�s& r�test_getting_header�$HTTPResponseTest.test_getting_header�	sN�����$�$�[�1������!<�=����$�$�[�.�A������!<�=rc�d�UOOQQ2oUOUQ2P!)�No-Such-Headerz
default-valuer�r�s& r�3test_getting_nonexistent_header_with_string_default�DHTTPResponseTest.test_getting_nonexistent_header_with_string_default�	s)�����$�$�%5��G�������1rc���UOOQQQ,2oUOUQ2UOOQQ2oUOUQ2P!)r��defaultr:zdefault, values)r�r:r�r�s& r�5test_getting_nonexistent_header_with_iterable_default�FHTTPResponseTest.test_getting_nonexistent_header_with_iterable_default�	sX�����$�$�%5�	�8�7L�M������!2�3����$�$�%5�7L�M������!2�3rc�b�UOOQ2oUOUP2P!)r�r�r�s& r�/test_getting_nonexistent_header_without_default�@HTTPResponseTest.test_getting_nonexistent_header_without_default�	s'�����$�$�%5�6�������&rc�f�UOOQ]*Q5oUOU]*2P!)r�)r�r�r�s& r�test_getting_header_defaultint�/HTTPResponseTest.test_getting_header_defaultint�	s,�����$�$�%5�b�$�A�������$rr�)r>r?r@rAr�r�r�r�r�r�rDrErFs@rr�r��	s(�����>�2�4�'�%�%rr�c�`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sQ
sQs
QsQ
sQsQsQsQsQsQsQsQsQsQsUsP!)�TunnelTestsi�	c���QoQUm[OUm[OUO2UmUO
U2UO
mP!)z:HTTP/1.1 200 OK

HTTP/1.1 200 OK
Content-Length: 42

z	proxy.com)rr�	HTTP_PORTrr�r�rk)r�
response_texts& rr��TunnelTests.setUp�	sO��
)�	�
 ��	��$�$��	��)�)�$�)�)�4��	�'+�'>�'>�}�'M��	�	�$rc�<�UOO2P!r4)r�r+r1s&rr�TunnelTests.tearDown�	s���	�	���rc�`�QU1QkkoU!)Nc�>:�[RU]*U]*Q5!)r�rr�r
)r\r,rr�s&&&�rrj�9TunnelTests._create_connection.<locals>.create_connection�	s����m�'�!�*�7�1�:�N�Nr�NNr5)rr�rjs&f rrk�TunnelTests._create_connection�	s���	O� � rc��QoQoQQ-oUO2oQV1*UQ$UOOVUQ5UOOQQP2UO	UOO
OUO2UO	UOO
OUO2UO	UOOU2UO	UOOU2UO	UOOU2P!)	�destination.com�"�
User-Agent�!Mozilla/5.0 (compatible, MSIE 11)�%s:%dr��rr�r�r�)�copyr�rr�r�r�rr�_tunnel_host�_tunnel_port�_tunnel_headers)rr�tunnel_port�tunnel_headers�tunnel_headers_afters&    r�2test_set_tunnel_host_port_headers_add_host_missing�>TunnelTests.test_set_tunnel_host_port_headers_add_host_missing�	s���'����&�(K�L��-�2�2�4��'.�+�1K�'K��V�$��	�	���[�%3�	�	5��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8�������/�/��=�������/�/��=�������2�2�4H�Irc�l�QoQoQQQQV1*-oUOOVUQ5UOOQQP2UOUOOO
UO
2UOUOOOUO2UOUOOU2UOUOOU2UOUOOU2P!)	r�r�rrr�rrr�r��
r�rr�r�r�rrrrr�rrrr	s&   r�4test_set_tunnel_host_port_headers_set_host_identical�@TunnelTests.test_set_tunnel_host_port_headers_set_host_identical�	s���'����&�(K� �'�[�,F�"F�H���	�	���[�%3�	�	5��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8�������/�/��=�������/�/��=�������2�2�N�Crc�j�QoQoQQQQQ	*-oUOOVUQ5UOOQQP2UOUOOO
UO
2UOUOOOUO2UOUOOU2UOUOOU2UOUOOU2P!)
r�r�rrr�rrr�r�)rfihrrs&   r�4test_set_tunnel_host_port_headers_set_host_different�@TunnelTests.test_set_tunnel_host_port_headers_set_host_different�	s���'����&�(K� �'�,A�"A�C���	�	���[�%3�	�	5��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8�������/�/��=�������/�/��=�������2�2�N�Crc��UOO2UO[UOOQ2P!)r�)r�rprO�RuntimeErrorrr1s&r�&test_disallow_set_tunnel_after_connect�2TunnelTests.test_disallow_set_tunnel_after_connect
s1���	�	�������,��	�	�(<�(<�+�	-rc��QQQ[O-oUOOUQ*O	Q22UOOQQP2UO
UOOOUO2UO
UOOOUO2UOQU*UOOO2UOQU*UOOO2P!��host�destination.com�portrr�r��?CONNECT %(host)s:%(port)d HTTP/1.1
Host: %(host)s:%(port)d

�!HEAD / HTTP/1.1
Host: %(host)s
�rr�r�rr�r�r�r�rrr�r�rr�s& r�test_connect_with_tunnel�$TunnelTests.test_connect_with_tunnel
�����'��V�%�%�
��	
�	�	���Q�w�Z�.�.�w�7�8��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8��
�
�9�;<�=��i�i�n�n�)�)�	+�	
�
�
�>��B��i�i�n�n�)�)�	+rc��QQQ[O-oUOOUQ*O	Q2UQ*Q5UOOQQP2UO
UOOOUO2UO
UOOOUO2UOQU*UOOO2UOQU*UOOO2P!)	rrrr�rr�r�rrr r!s& r�*test_connect_with_tunnel_with_default_port�6TunnelTests.test_connect_with_tunnel_with_default_port
s����'��V�%�%�
��	
�	�	���Q�w�Z�.�.�w�7�a��j��I��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8��
�
�9�;<�=��i�i�n�n�)�)�	+�	
�
�
�>��B��i�i�n�n�)�)�	+rc��QQQQ-oUOOUQ*OQ2UQ*Q5UOOQQP2UO	UOO
OUO2UO	UOO
OUO2UOQU*UOO
O2UOQ	U*UOO
O2P!)
rrrr�rr&r�r�rs*HEAD / HTTP/1.1
Host: %(host)s:%(port)d
)
r�rr�r�r�r�rrr�rr!s& r�.test_connect_with_tunnel_with_nonstandard_port�:TunnelTests.test_connect_with_tunnel_with_nonstandard_port%
s����'��T�
��	
�	�	���Q�w�Z�.�.�w�7�a��j��I��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8��
�
�9�;<�=��i�i�n�n�)�)�	+�	
�
�
�G�!�K��i�i�n�n�)�)�	+rc���QQQQQ[O-oUOOUQ*O	Q2QUQ*O	Q2-Q5UOOQQ	P2UO
UOOOUO2UO
UOOOUO2UOQ
U*UOOO2UOQU*UOOO2P!)rrstunnel_host_headersexample.com:9876rrrgrr�r�sDCONNECT %(host)s:%(port)d HTTP/1.1
HOST: %(tunnel_host_header)s

rr r!s& r�3test_connect_with_tunnel_with_different_host_header�?TunnelTests.test_connect_with_tunnel_with_different_host_header7
s���'�!�#6��V�%�%�
��
	
�	�	���
�g�J���g�&��Q�4�5�<�<�W�E�F�	�	H�	
�	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�d�i�i�8��
�
�>�@A�B��i�i�n�n�)�)�	+�	
�
�
�>��B��i�i�n�n�)�)�	+rc��QQQ[O-oUOOUQ*O	Q22UOOQQP2UO
UOOOUO2UO
UOOOUO2UOQU*UOOO2UOQU*UOOO2P!rr r!s& r�'test_connect_with_tunnel_different_host�3TunnelTests.test_connect_with_tunnel_different_hostI
r$rc�.�QoQUOQ2[O1*oQV"1*oUOO	U2UOOQQP2UO
UOOOUO2UO
UOOO[O2UOV0OOO2P!)u	δπθ.grs%s:%d�idnas!CONNECT %s HTTP/1.1
Host: %s

r�r�)rrr�r�rr�r�r�rrr�r)r�dest�	dest_portr�s&   r�test_connect_with_tunnel_idna�)TunnelTests.test_connect_with_tunnel_idnaX
s���&������F� 3�V�5E�5E�F�F�	�=��A"�"���	�	���T�"��	�	���&�#�r�*���������,�,�d�i�i�8���������,�,�f�.>�.>�?��
�
�h�	�	��� 3� 3�4rc�d�[OOUOQ29^tt^2oUOO	Q2UOO2UOO
QQ2PPP2WO2UO[UO2]QUO0Q5UO]*]*]*oUOQU2UOUQQU80Q5P!)%fhK�9h)	r�r�r�r�z!unexpected number of send calls: )r�sCONNECT destination.comr�zunexpected proxy data sent )
r�patch�objectr�rrpr��
assert_calledr�r��
mock_callsr�r�)r�	mock_send�proxy_setup_data_sents&  r�0test_tunnel_connect_single_send_connection_setup�<TunnelTests.test_tunnel_connect_single_send_connection_setupc
s���
�Z�Z�
�
�t�y�y�&�
1�
1�Y��I�I� � �!2�3��I�I�����I�I���e�S�)�2�	���!�����I�(�(�)�1�7�	�8L�8L�7M�N�	�	P�!*� 4� 4�Q� 7�� :�1� =���
�
�0�2G�H����1�;�1�2G�1J�K�	�	M�2�
1�s�AD�D/	�(D/	c��QQQ[O-oUOOUQ*O	Q22UOOQQP2UO
UOOOUO2UO
UOOOUO2UOQU*UOOO2UOQU*UOOO2P!)rrrrr�r�rs PUT / HTTP/1.1
Host: %(host)s
r r!s& r�test_connect_put_request�$TunnelTests.test_connect_put_requests
s����'��V�%�%�
��	
�	�	���Q�w�Z�.�.�w�7�8��	�	���%��b�)���������,�,�d�i�i�8���������,�,�d�i�i�8��
�
�9�;<�=��i�i�n�n�)�)�	+�	
�
�
�=��A��i�i�n�n�)�)�	+rc�*�UOOQQ2UOOQQP2UOUOOO
UO
2UOUOOO[O2UOQUOOO2UOQUOOO2P!)z
[1:2:3::4]i�r�r��CONNECT [1:2:3::4]:1234�Host: [1:2:3::4]:1234�r�rr�r�r�rrrr�r�rr1s&r�test_connect_put_request_ipv6�)TunnelTests.test_connect_put_request_ipv6�
s����	�	���\�4�0��	�	���%��b�)���������,�,�d�i�i�8���������,�,�f�.>�.>�?��
�
�0�$�)�)�.�.�2E�2E�F��
�
�.��	�	���0C�0C�Drc�(�UOOQ2UOOQQP2UOUOOO
UO
2UOUOOO[O2UOQUOOO2UOQUOOO2P!)z[1:2:3::4]:1234r�r�rErFrGr1s&r�"test_connect_put_request_ipv6_port�.TunnelTests.test_connect_put_request_ipv6_port�
s����	�	���.�/��	�	���%��b�)���������,�,�d�i�i�8���������,�,�f�.>�.>�?��
�
�0�$�)�)�.�.�2E�2E�F��
�
�.��	�	���0C�0C�Drc��QoQOU2oUOO]2UOU2UOmUOO	Q2[
O29^tt^2oUOOQQP2PPP2WO2O2oUOQOU2U2P!)%fhKQ9h)z
X-Dummy: 1zHTTP/1.0 200 OK
{}

r�r�r�z
header: {})r�r��set_debuglevelrkrrrr�rrr�)r�expected_headerr�rrs&    r�test_tunnel_debuglog� TunnelTests.test_tunnel_debuglog�
s���&��7�>�>��O�
��	�	� � ��#�'+�'>�'>�}�'M��	�	�$��	�	���.�/�
�
$�
$�
&�
&�&��I�I���e�S�"�-�'����!�,�,�.���
�
�l�)�)�/�:�E�B�'�
&�s�C/�/C?	�8C?	c�n�QoQOQOU22oUOU2UOmUOO	Q2UOOQQP2UOO
2oUOVO22P!)�X-Dummy�HTTP/1.0 200 OK
{0}

�:r�r�r��rS�1)	r�r�rkr�rr��get_proxy_response_headersr��items�rrOr�r�s&   r�test_proxy_response_headers�'TunnelTests.test_proxy_response_headers�
s���*��
� �&����/�!:�;�	�
(,�'>�'>�}�'M��	�	�$��	�	���.�/��	�	���%��b�)��)�)�6�6�8���
�
�o�}�}��7rc��QoQOQOU22oUOU2UOmUOO	QQP2UOO2oUO
U2P!)rSrTrUr�r�rV)r�r�rkr�r�rXr-rZs&   r�test_no_proxy_response_headers�*TunnelTests.test_no_proxy_response_headers�
ss��*��
� �&����/�!:�;�	�
(,�'>�'>�}�'M��	�	�$��	�	���%��b�)��)�)�6�6�8�����'�"rc�@`�PnQU1QkkoVOmUOOQ2PoUOOQQP2UOU2UO
RO2P![c
oSoPo=K@Po=hh9h)Nc�B:�[QU]*U]*Q5nR!)zHTTP/1.1 404 NOT FOUND

r�r�)r\r,rr�s&&&�rrk�8TunnelTests.test_tunnel_leak.<locals>._create_connection�
s%����0��Q�Z��Q�Z��D�
�Krr�r�r�r�)r�rkrr�rOr�rr)rrkrU�er�s&   @r�test_tunnel_leak�TunnelTests.test_tunnel_leak�
s������	�(:�	�	�$��	�	���.�/���	��I�I���f�c�2�.�	
���S�!�����(�(�)��	�	��C��	�s�B�	B�B�B�B)r�rr)r>r?r@rAr�rrkrrrrr"r'r*r-r0r6r?rBrHrKrPr[r^rdrDrErFs@rr�r��	s{����	N��!�

J�D�D�-�
+�
+�
+�$+�$
+�	5�M� 
+�E�E�C�8�#�*�*rr��__main__)�	verbosity)=r3rP�httprrrBr��osr�r~rerirr�TestCaser�r�test.supportrr�requires_working_socket�path�dirnamer��herer�r�r�r}r9r<�chunk_extensionr:r-rtr;rgr
rIrCrVr�rdrxrBrKryr�r�r�r�r�r
r#r5rQr�r�r�r>�mainr5rr�<module>rrs����#�	��	��	�
���������"�&����t�,�	�w�w���x� �������d�J�
�>���G�G�L�L��z�>�B��#%�7�7�<�<��*�7�$� �	-��N����
�
��O�+�f�4��-��������
�
�B

�*�

��2�:�:��$2�v�4�4�2�"s@�(�s@�j5�h�5�,}�8�}�@@'��@'�F"A(�x�A(�HJ�)9�J�
�.��,��DV2�(�V2�r7��7�>+�(�+�\E.�h�E.�Pv8��v8�r]F�h�]F�@!%�x�!%�FM*�(�M*�`�z���M�M�A��r

Youez - 2016 - github.com/yon3zu
LinuXploit