Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_cgi.cpython-311.pyc
�

�KeY����ddlZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZej
d��ZGd�d��Ze��e_Gd	�d
��Zd�Zdifd
ed��fded��fdifdifdddgifded��fded��fded��fdddgifdddgifdddgifdddgifded��fd ed!��fd"d#gd$gd%�fd&dd#d'gifd(d)gd*gd+gd,�fd-d.gd/gd0gd1gd2gd3gd4gd5gd6�fd7d8gd9gd:gd)gd;gd<gd=�fgZd>�Zd?�Zd@�ZdA�ZGdB�dCej��ZdDZdEZdFZdGZdHZedIkrej ��dSdS)J�N)�
namedtuple)�StringIO�BytesIO)�support)�warnings_helper�cgic� �eZdZgZejZdS)�HackedSysModuleN)�__name__�
__module__�__qualname__�argv�sys�stdin���7/usr/local/apps/python3/lib/python3.11/test/test_cgi.pyr
r

s�������D��I�E�E�Err
c�&�eZdZd�Zd�Zd�Zd�ZdS)�ComparableExceptionc��||_dS�N)�err)�selfrs  r�__init__zComparableException.__init__s
������rc�*�t|j��Sr)�strr�rs r�__str__zComparableException.__str__s���4�8�}�}�rc��t|t��stS|jj|jko|jj|jkSr)�
isinstance�	Exception�NotImplementedr�	__class__�args)r�anExcs  r�__eq__zComparableException.__eq__sA���%��+�+�	"�!�!���"�e�o�5�,���
���+�	-rc�,�t|j|��Sr)�getattrr)r�attrs  r�__getattr__zComparableException.__getattr__"s���t�x��&�&�&rN)rrr
rrr&r*rrrrrsP������������-�-�-�'�'�'�'�'rrc�|�i}|dkr
d}d|d<||d<nd|dkrLt|�d����}d|d<d|d<tt|����|d<nt	d	|z���	t
�||d
���S#t$r}t|��cYd}~Sd}~wwxYw)N�GET�REQUEST_METHOD�QUERY_STRING�POST�latin-1�!application/x-www-form-urlencoded�CONTENT_TYPE�CONTENT_LENGTHzunknown method: %s�)�strict_parsing)	r�encoder�len�
ValueErrorr�parser!r)�buf�method�env�fprs     r�do_testr>%s���
�C�
����
�� %����!��N���	�6�	�	�
�S�Z�Z�	�*�*�
+�
+�� &����A��N�� #�C��H�H�
�
������-��6�7�7�7�(��y�y��S��y�3�3�3���(�(�(�"�3�'�'�'�'�'�'�'�'�����(���s�;B�
B;�"B6�0B;�6B;��&�bad query field: ''z&&�=z=&=z=a�az&=az=a&z=&a�bad query field: 'a'zb=a�bzb+=azb za=b=aza=+b=az b=az&b=azb&=a�bad query field: 'b'za=a+b&b=b+c�a b�b c�rCrEza=a+b&a=b+a�b azx=1&y=2.0&z=2-3.%2b0�1�2.0�2-3.+0��x�y�zz�Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env�400006�r�	964546263z
130003.300038zen-US� 0bb2e248638833d48cb7fed300000f1br<�bustomer)z1Hbc5161168c542333633315dee1182227:key_store_seqid�cuyer�expire�kid�lobale�order_id�ss�viewzQgroup_id=5470&set=custom&_assigned_to=31392&_status=1&_category=100&SUBMIT=Browse�Browse�31392�100�5470�custom)�SUBMIT�_assigned_to�	_category�_status�group_id�setc�.�t|t���S)N)�key)�sorted�repr)�seqs r�normrnas���#�4� � � � rc��d�|D��S)Nc��g|]
}|d��S)rr��.0�ps  r�
<listcomp>zfirst_elts.<locals>.<listcomp>es�����Q�A�a�D���rr��lists r�
first_eltsrwds����$����rc��d�|D��S)Nc�:�g|]}|d|ddf��S)rr4rrqs  rrtz%first_second_elts.<locals>.<listcomp>hs(��*�*�*��Q�q�T�1�Q�4��7�O�*�*�*rrrus r�first_second_eltsrzgs��*�*�T�*�*�*�*rc�l�d}t|�|����}|�d��t�|||���}i}t|�����D]9\}}t|t��r|�	|��p|j
||<�:|S)Nr0r)r=�environ�encoding)rr6�seekr�FieldStorage�dict�itemsr rv�getlist�value)�datar|r}�
fake_stdin�form�result�k�vs        r�
gen_resultr�js����H�����X�.�.�/�/�J��O�O�A�������z�7�X��N�N�D�
�F��T�
�
� � �"�"�G�G���1��q�$�'�'�;�D�L�L��O�O�F�q�w��q�	�	��Mrc���eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
je���d	���Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zdddgddd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS) �CgiTestsc��tt�d����}t�d��dd�}t�||��}dgdgdgdgd�}|�||��dS)	N�latin1�558��boundaryzCONTENT-LENGTH� Add �1234�
Testing 123.
r?)�submit�id�file�title)r�POSTDATAr6�BOUNDARYr�parse_multipart�assertEqual)rr=r<r��expecteds     r�test_parse_multipartzCgiTests.test_parse_multipartxs���
�X�_�_�X�.�.�
/�
/��#�?�?�8�4�4�!&�(�(���$�$�R��-�-��&�i��x�.�/�2�$�@�@�������*�*�*�*�*rc���d}t|�d����}dd�d��i}t�||��}ddgi}|�||��dS)NzY--JfISa01
Content-Disposition: form-data; name="submit-name"

just a string

--JfISa01--
r�r��JfISa01�submit-namezjust a string
)rr6rr�r�)rr�r=r<r�r�s      r�+test_parse_multipart_without_content_lengthz4CgiTests.test_parse_multipart_without_content_length�s{�����X�_�_�X�.�.�
/�
/���9�+�+�H�5�5�6���$�$�R��-�-��!�$5�#6�7�������*�*�*�*�*rc���d}d}t|�d����}|�d��tt|�d������d�}t�||dd���}d	d
gi}|�||��|�d�d��|d	d�dd����dS)
Nr�u]--JfISa01
Content-Disposition: form-data; name="submit-name"
Content-Length: 3

☃
--JfISa01�utf8r�r��ascii�surrogateescape)r}�errorsr�u	���u☃r)rr6rr7rr�r�)rr�r�r=r<r�r�s       r�%test_parse_multipart_invalid_encodingz.CgiTests.test_parse_multipart_invalid_encoding�s�����
���X�_�_�V�,�,�
-�
-��#�?�?�8�4�4�!$�S�����)@�)@�%A�%A�!B�!B�D�D���$�$�R��w�,=�%�?�?��!�$8�#9�:�������*�*�*��������0�0��
�.�q�1�8�8��AR�S�S�	U�	U�	U�	U�	Urc��t���}|�|��|�dt	|����|�t
|��t
|�������|j�tdd��d����|�
|��dS)Nr�MockFieldStorage�name�
fieldvalue)rr�assertFalse�assertInrlr�rv�keys�appendr�
assertTrue�r�fss  r�test_fieldstorage_propertiesz%CgiTests.test_fieldstorage_properties�s���
�
�
�
�
����������
�
�n�d�2�h�h�/�/�/�����b���4����	�	�?�?�3�3�3�
����=�z�"4�f�=�=�l�K�K�L�L�L���������rc�$�|�ttjdddi���|�ttjdd��t�ddi�	��}|�tt|��dS)
Nznot-a-file-objr-�PUT�r|�foo�barzcontent-type�
text/plain)�headers)�assertRaises�	TypeErrorrr�boolr�s  r�test_fieldstorage_invalidz"CgiTests.test_fieldstorage_invalid�s������)�S�%5�7G�EU�V[�D\�	�	^�	^�	^����)�S�%5�u�e�D�D�D�
�
�
�~�l�&C�
�
D�
D�����)�T�2�.�.�.�.�.rc	���tD�]�\}}t|d��}|�||dt|��z��t|d��}|�||dt|��z��d|i}t�|���}t
|t���r5|�t|��t|����|�	|�
��|�
����|�|�dd��d��|�
��D]�}||}|�||��t|��d	kr*|�|�|��|���]|�|�|��|d
�������dS)Nr,zError parsing %s method GETr/zError parsing %s method POSTr.r�znonexistent field�defaultr4r)
�parse_strict_test_casesr>r�rlrrr r�r7�assertCountEqualr��getvaluer�)r�orig�expect�dr<r�rj�
expect_vals        r�test_strictzCgiTests.test_strict�s���3�	J�	J�L�D�&���e�$�$�A����Q��(E��T�
�
�(R�S�S�S���f�%�%�A����Q��(F��d���(S�T�T�T�!�4�(�C��!�!�#�!�.�.�B��&�$�'�'�
J�� � ��V���c�"�g�g�6�6�6��%�%�f�k�k�m�m�R�W�W�Y�Y�?�?�?�� � ����-@�)�!L�!L�i�X�X�X�!�;�;�=�=�J�J�C�!'���J��M�M�#�r�*�*�*��:����*�*��(�(����S�)9�)9�:�F�F�F�F��(�(����S�)9�)9�:�a�=�I�I�I�I��/	J�	Jrc��ddgdgd�fddgdgdgd�fdtd	��fd
td	��fdtd��fd
td	��fdtd��fddgdgd�fddddgifg	}|D]�\}}d|i}t�d|���}t|t��r�|���D]�}||}|�||��t|��dkr*|�|�	|��|���]|�|�	|��|d������dS)Nz	x=1;y=2.0rKrL)rOrPzx=1;y=2.0;z=2-3.%2b0rMrN�;rAz;;z=;arDz;b=azb;=arFza=a+b;b=b+crGrHrIza=a+b;a=b+arCrJr.)�	separatorr|r4r)
r8rrr r�r�r�r7r�r�)r�parse_semicolonr�r�r<r�rjr�s        r�test_separatorzCgiTests.test_separator�s���
���U�G�4�4�5�
#�C�5��w�h�Z�%P�%P�Q�
�*�2�3�3�4�
�:�3�4�4�5�
�J�5�6�6�7�
�Z� 5�6�6�7�
�Z� 6�7�7�8�
�5�'���8�8�9�
�S�5�%�.�1�2�

��,�
	J�
	J�L�D�&�!�4�(�C��!�!�C��!�=�=�B��&�$�'�'�
J�!�;�;�=�=�J�J�C�!'���J��M�M�#�r�*�*�*��:����*�*��(�(����S�)9�)9�:�F�F�F�F��(�(����S�)9�)9�:�a�=�I�I�I�I��
	J�
	Jr)�categoryc�|�t�d��t��t_t�dd��t�dd��|�tj���d��tj�	tj
��rxdt_tj
t_t�dd��|�tj
��t�d��dSdS)N�Testingz%szTesting initlog 1z
Testing log 2z Testing initlog 1
Testing log 2
z
Testing log 3z
Testing log 4)r�logr�logfp�initlogr�r��os�path�exists�devnull�logfile�
addCleanup�closelogrs r�test_logzCgiTests.test_log�s������	�����J�J��	����D�-�.�.�.�����o�&�&�&������+�+�-�-�/S�T�T�T�
�7�>�>�"�*�%�%�	%��C�I��*�C�K��K�K��o�.�.�.��O�O�C�L�)�)�)��G�G�O�$�$�$�$�$�	%�	%rc���Gd�d��}|tjd����}|�|j��|�ddz��|�d��ddi}t�||�	��}|�|jj��|�	|j
d
��|���dS)Nc�"�eZdZd�Zdd�Zd�ZdS)�=CgiTests.test_fieldstorage_readline.<locals>.TestReadlineFilec�"�||_d|_dS)Nr)r��numcalls)rr�s  rrzFCgiTests.test_fieldstorage_readline.<locals>.TestReadlineFile.__init__�s�� ��	� !��
�
�
rNc��|xjdz
c_|r|j�|��S|j���S)Nr4)r�r��readline)r�sizes  rr�zFCgiTests.test_fieldstorage_readline.<locals>.TestReadlineFile.readline�sD���
�
��"�
�
��0��9�-�-�d�3�3�3��9�-�-�/�/�/rc��|jd}t||��}t|t��st	|||��|S)Nr�)�__dict__r(r �int�setattr)rr�r�rCs    rr*zICgiTests.test_fieldstorage_readline.<locals>.TestReadlineFile.__getattr__sF���}�V�,���D�$�'�'��!�!�S�)�)�+��D�$��*�*�*��rr)rrr
rr�r*rrr�TestReadlineFiler��sF������
"�
"�
"�
0�
0�
0�
0�
�
�
�
�
rr�zwb+sxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxirr-r��r=r|�)�tempfile�
TemporaryFiler��close�writer~rrr��
assertGreaterr�)rr��fr<r�s     r�test_fieldstorage_readlinez#CgiTests.test_fieldstorage_readline�s���
	�	�	�	�	�	�	�	�&
��X�3�E�:�:�;�;������� � � �	���
�T�!�"�"�"�	���q�	�	�	���&��
�
�
��C�
�
0�
0�������
�&�&�&�	
���1�:�q�)�)�)�	���	�	�	�	�	rc�0�dd�t��dd�}tt�d����}t
�||d���}|�t|j	��d��ddd	d
�dddd
�d
ddd
�dddd
�g}tt|j	����D]S}||���D]6\}}t|j	||��}|�||���7�TdS)Nr/� multipart/form-data; boundary={}r��r-r2r3r0�r|r}�r�r��r��filenamer�r�r?r��test.txtr�r�r��
�formatr�rr�r6rrr�r7rv�ranger�r(�	rr<r=r�r�rOr��exp�gots	         r�test_fieldstorage_multipartz$CgiTests.test_fieldstorage_multiparts6��%�>�E�E�h�O�O�#�%�%���X�_�_�Y�/�/�
0�
0��
�
�
�b�#�	�
�
B�
B������R�W���q�)�)�)��4��@�@�!�d�B�?�?� �Z�AR�S�S�"�t�W�E�E�G���s�2�7�|�|�$�$�	+�	+�A� ��)�/�/�+�+�
+�
+���3��b�g�a�j�!�,�,��� � ��c�*�*�*�*�
+�	+�	+rc�6�dd�t��dd�}tdt�d��z��}t
�||d���}|�t|j	��d��d	dd
d�ddd
d�dddd�dddd�g}tt|j	����D]S}||���D]6\}}t|j	||��}|�||���7�TdS)Nr/r��560r�s
r0r�r�r�r�r�r�r?r�r�r�r�r�r�r�s	         r�.test_fieldstorage_multipart_leading_whitespacez7CgiTests.test_fieldstorage_multipart_leading_whitespace(s9��$�>�E�E�h�O�O�#�%�%���W�x���y�9�9�9�
:�
:��
�
�
�b�#�	�
�
B�
B������R�W���q�)�)�)��4��@�@�!�d�B�?�?� �Z�AR�S�S�"�t�W�E�E�G���s�2�7�|�|�$�$�	+�	+�A� ��)�/�/�+�+�
+�
+���3��b�g�a�j�!�,�,��� � ��c�*�*�*�*�
+�	+�	+rc��dd�t��dd�}dD]�}tt�|����}t
�|||���}|�t|j	��d��ddd	d
�g}tt|j	����D]S}||���D]6\}}t|j	||��}	|�|	|���7�T��dS)Nr/r�r�r�)z
iso-8859-1zutf-8r�r4r�uçñ€r�)
r�r�r�POSTDATA_NON_ASCIIr6rrr�r7rvr�r�r()
rr<r}r=r�r�rOr�r�rs
          r�%test_fieldstorage_multipart_non_asciiz.CgiTests.test_fieldstorage_multipart_non_ascii;s�� &�>�E�E�h�O�O�"�$�$��/�	/�	/�H��+�2�2�8�<�<�=�=�B��!�!�"�c�8�!�D�D�B����S���\�\�1�-�-�-�"�t�^�L�L�M�F��3�r�w�<�<�(�(�
/�
/��$�Q�i�o�o�/�/�/�/�F�A�s�!�"�'�!�*�a�0�0�C��$�$�S�#�.�.�.�.�/�
/�	/�	/rc���d}d�_�fd�}|d|dz
z��|d|dz
zdz��|d|dz
zdzd|dz
zz��dS)Nic����d�dd��|z}tt|����ddd�}��t	||��d|�d��i��dS)	Nzp---123
Content-Disposition: form-data; name="upload"; filename="fake.txt"
Content-Type: text/plain

%s
---123--
�
z
�"multipart/form-data; boundary=-123r/�r3r2r-�uploadr�)�replacerr7r�r�r6)�contentr�r|rs   �r�checkz;CgiTests.test_fieldstorage_multipart_maxline.<locals>.checkNs������G�D�&���G�
$�D�%(��D�	�	�N�N�$H�$*���G�

���Z��g�6�6�&����x�(@�(@�A�
C�
C�
C�
C�
CrrOr4�
rP)�maxDiff)r�maxliners`  r�#test_fieldstorage_multipart_maxlinez,CgiTests.test_fieldstorage_multipart_maxlineJs���������	C�	C�	C�	C�	C�	��c�W�q�[�!�"�"�"�
��c�W�q�[�!�D�(�)�)�)�
��c�W�q�[�!�D�(�3�'�A�+�+>�>�?�?�?�?�?rc��dd�t��ttt����d�}tt�d����}t�||d���}|�	t|j
��d��|�	|j
djd��|�	|j
djd	��|�	|j
d
jd��|j
d
j}|�	t|��d��ddd
d�dddd�g}tt|����D]N}||���D]1\}}t|||��}	|�	|	|���2�OdS)Nr/r�r�r0r�r�rr��Larryr4�filesz	file1.txts... contents of file1.txt ...r�z	file2.gifs...contents of file2.gif...)r��BOUNDARY_W3rr7�POSTDATA_W3rr6rrr�rvr�r�r�r�r()
rr<r=r�rr�rOr�r�rs
          r�test_fieldstorage_multipart_w3cz(CgiTests.test_fieldstorage_multipart_w3cas���%�>�E�E�k�R�R�!�#�k�"2�"2�3�3�5�5���[�'�'�	�2�2�
3�
3��
�
�
�b�#�	�
�
B�
B������R�W���q�)�)�)���������-�8�8�8��������)�7�3�3�3���������'�2�2�2����
� ������U���Q�'�'�'��[�Cc�d�d��[�Ca�b�b�d���s�5�z�z�"�"�	+�	+�A� ��)�/�/�+�+�
+�
+���3��e�A�h��*�*��� � ��c�*�*�*�*�
+�	+�	+rc���d}d}dd�|��tt|����d�}t|�d����}t
�||d���}|�t|j��d��|�|jd	j	d
��|�|jd	j
d��dS)Nr�z_--JfISa01
Content-Disposition: form-data; name="submit-name"
Content-Length: 5

Larry
--JfISa01r/r�r�r0r�r4rr�r)r�rr7rr6rrr�rvr�r�)rr�r�r<r=r�s      r�%test_fieldstorage_part_content_lengthz.CgiTests.test_fieldstorage_part_content_lengthvs�����
��%�>�E�E�h�O�O�!�#�h�-�-�0�0�2�2���X�_�_�Y�/�/�
0�
0��
�
�
�b�#�	�
�
B�
B������R�W���q�)�)�)���������-�8�8�8��������)�7�3�3�3�3�3rc���td��}dd|d�}t�||���}|�t	|dj�����d��dS)Nsa--MyBoundary
Content-Disposition: form-data; name="my-arg"; filename="foo"

Test

--MyBoundary--
r/z(multipart/form-data; boundary=MyBoundary)r-r2z
wsgi.inputr�zmy-arg�)rrrr�r7r��read)rr=r<�fieldss    r�.test_field_storage_multipart_no_content_lengthz7CgiTests.test_field_storage_multipart_no_content_length�s��
�����%�F��
�
��
�!�!�"�c�!�2�2������V�H�-�2�7�7�9�9�:�:�A�>�>�>�>�>rc��td��}ddi}t�||���5}|j���}|�|jj��ddd��n#1swxYwY|�|jj��|�|d��|�	td��5|j���ddd��dS#1swxYwYdS)Ns
xxxxxxxxxxr-r�r��
xxxxxxxxxxzI/O operation on closed file)rrrr�rr��closedr�r��assertRaisesRegexr8)rr=r<r�rs     r�$test_fieldstorage_as_context_managerz-CgiTests.test_fieldstorage_as_context_manager�sc��
�Y�
�
����'��
�
�
��S�
�
1�
1�	-�R��g�l�l�n�n�G����R�W�^�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	
������'�'�'�����(�+�+�+�
�
#�
#�J�0N�
O�
O�	�	��G�L�L�N�N�N�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s#�9A5�5A9�<A9�C7�7C;�>C;�value1�value2x�value2y�value3�value4)�key1�key2�key3�key4c��d}tt|����dddd�}t||��}|�|j|��dS)Nz$key2=value2x&key3=value3&key4=value4r1zkey1=value1&key2=value2yr/�r3r2r.r-�rr7r�r��
_qs_result�rr�r|r�s    r�testQSAndUrlEncodezCgiTests.testQSAndUrlEncode�sZ��5�� #�C��I�I��� C� :� &�	
�
��
�t�W�%�%�������!�,�,�,�,�,rc���d�dgdz��}tt|����ddd�}|�t��5t
�t|�����|d���ddd��n#1swxYwYd	}tt|����d
ddd�}|�t��5t
�t|�����|d
���ddd��n#1swxYwYt
�t|�����|d���dS)Nr@za=a�r1r/r�
)r=r|�max_num_fieldsz�---123
Content-Disposition: form-data; name="a"

3
---123
Content-Type: application/x-www-form-urlencoded

a=4
---123
Content-Type: application/x-www-form-urlencoded

a=5
---123--
rza=1&a=2r1r�r)	�joinrr7r�r8rrrr6)rr�r|s   r�test_max_num_fieldszCgiTests.test_max_num_fields�s����x�x����
�#�#��!�#�d�)�)�n�n�?�$�
�
���
�
�z�
*�
*�	�	�����4�;�;�=�=�)�)��!�
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
��!$�C��I�I��� D� )� &�	
�
���
�
�z�
*�
*�	�	�����4�;�;�=�=�)�)�� �
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	����t�{�{�}�}�%�%���	�	
�	
�	
�	
�	
s$�=B�B!�$B!�%=D.�.D2�5D2c��d}tt|����dddd�}t||��}|�|j|��dS)Nz�---123
Content-Disposition: form-data; name="key2"

value2y
---123
Content-Disposition: form-data; name="key3"

value3
---123
Content-Disposition: form-data; name="key4"

value4
---123--
r�key1=value1&key2=value2xr/r1r2r4s    r�testQSAndFormDatazCgiTests.testQSAndFormData�s^��
��!$�C��I�I��� D� :� &�	
�
��
�t�W�%�%�������!�,�,�,�,�,rc��d}tt|����dddd�}|j���}|�ddi��t||��}|�||��dS)NaE---123
Content-Disposition: form-data; name="key2"

value2y
---123
Content-Disposition: form-data; name="key3"

value3
---123
Content-Disposition: form-data; name="key4"

value4
---123
Content-Disposition: form-data; name="upload"; filename="fake.txt"
Content-Type: text/plain

this is the content of the fake file

---123--
rr=r/r1r
s%this is the content of the fake file
)rr7r3�copy�updater�r�)rr�r|r�r�s     r�testQSAndFormDataFilezCgiTests.testQSAndFormDataFiles�����*!$�C��I�I��� D� :� &�	
�
����%�%�'�'���
�
��?�
�	�	�	�
�t�W�%�%�������#�#�#�#�#rc��|�t�d��dif��|�t�d��dif��|�t�d��dddif��|�t�d��dddif��|�t�d��ddd	d
�f��|�t�d��dd
dif��|�t�d��dd
dif��|�t�d��dddd�f��|�t�d��dddd�f��dS)Nr�ztext/vnd.just.made.this.up ; ztext/vnd.just.made.this.upztext/plain;charset=us-ascii�charsetzus-asciiztext/plain ; charset="us-ascii"z,text/plain ; charset="us-ascii"; another=opt�opt)rD�anotherz attachment; filename="silly.txt"�
attachmentr�z	silly.txtz#attachment; filename="strange;name"zstrange;namez-attachment; filename="strange;name";size=123;�123)r�r�z-form-data; name="files"; filename="fo\"o;bar"z	form-datarzfo"o;bar)r�r�)r�r�parse_headerrs r�test_parse_headerzCgiTests.test_parse_header%s��������\�*�*�
�2��	 �	 �	 �	
������<�=�=�
)�2�.�	0�	0�	0�	
������:�;�;�
�I�z�2�3�	5�	5�	5�	
������>�?�?�
�I�z�2�3�	5�	5�	5�	
������K�L�L�
�z�e�D�D�E�	G�	G�	G�	
������?�@�@�
�J��4�5�	7�	7�	7�	
������B�C�C�
�J��7�8�	:�	:�	:�	
������L�M�M�
���F�F�G�	I�	I�	I�	
������M�N�N�
�7�
�C�C�D�	F�	F�	F�	F�	Frc�F�hd�}tj|t|���dS)N>	r��dologr��nolog�maxlenr�r�r��valid_boundary)�not_exported)r�check__all__r)rrPs  r�test_allzCgiTests.test_allBs3��(�(�(��	��T�3�\�B�B�B�B�B�BrN)rrr
r�r�r�r�r�r�r�r�ignore_warnings�DeprecationWarningr�r�rrrrrrr!r&r3r5r;r>rBrJrRrrrr�r�vs�������+�+�+�+�+�+�U�U�U�$���/�/�/�J�J�J�4J�J�J�0%�_�$�.@�A�A�A�%�%�B�A�%�#�#�#�J+�+�+�$+�+�+�&
/�
/�
/�@�@�@�.+�+�+�*4�4�4�$?�?�?�"	�	�	���I�&���	��J�	-�	-�	-�4
�4
�4
�l-�-�-�0 $� $� $�DF�F�F�:C�C�C�C�Crr�z6---------------------------721837373350705526688164684a-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="id"

1234
-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="title"


-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

Testing 123.

-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="submit"

 Add 
-----------------------------721837373350705526688164684--
u�-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="id"

çñ€
-----------------------------721837373350705526688164684
�AaB03xa�--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"
Content-Type: multipart/mixed; boundary=BbC04y

--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain

... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
Content-Transfer-Encoding: binary

...contents of file2.gif...
--BbC04y--
--AaB03x--
�__main__)!r�rr��unittest�collectionsr�iorr�testr�test.supportr�import_deprecatedrr
rr>r8r�rnrwrzr��TestCaser�r�r�rrrr�mainrrr�<module>r_sY��	�	�	�	�
�
�
�
���������"�"�"�"�"�"� � � � � � � � �������(�(�(�(�(�(�'�o�'��.�.�����������/�
�
���'�'�'�'�'�'�'�'� (�(�(�&��H��*�*�*�
+�
+�,�	�:�:�+�,�,�-��"�I�
�B�K�	�B���;��
�J�J�,�-�-�.�
�J�J�,�-�-�.�
�J�J�-�.�.�/�
�S�3�%�L���d�S�E�]���s�U�G�n��
��f�X����Z�Z�-�
.�
.�/��Z�Z�.�
/�
/�0��5�'���0�0�1��S�5�%�.�)�*��C�5��w�h�Z�H�H�I�w�<D�:��u��
��
��	�5�6�
�G��l���		�Y��
��i��7����(��Z���	�A(��T!�!�!� � � �+�+�+�
�
�
�PC�PC�PC�PC�PC�x� �PC�PC�PC�fD����*������.�z����H�M�O�O�O�O�O��r