Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
test
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/test/test_httpservers.pyo
mò ‚=5Dc�����������@���sk��d��Z��d�k�l�Z�l�Z�d�k�l�Z�d�k�l�Z�d�k�Z�d�k�Z�d�k �Z �d�k �Z �d�k�Z�d�k�Z�d�k �Z �d�k�Z�d�k�Z�d�k�l�Z�d�k�Z�d�k�l�Z�d�f��d�„��ƒ��YZ�d �e�i�f�d �„��ƒ��YZ�d�e�i�f�d�„��ƒ��YZ�d �e�f�d�„��ƒ��YZ�d�e�f�d�„��ƒ��YZ�d�Z�d�Z�d�e�f�d�„��ƒ��YZ�d�„��Z�d�d�„�Z!�e"�d�j�o�e!�ƒ��n�d�S(���s±���Unittests for the various HTTPServer modules. Written by Cody A.W. Somerville <cody-somerville@ubuntu.com>, Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest. (���s���BaseHTTPRequestHandlers ���HTTPServer(���s���SimpleHTTPRequestHandler(���s���CGIHTTPRequestHandlerN(���s���sleep(���s���test_supportt���NoLogRequestHandlerc�����������B���s���t��Z�d�„��Z�RS(���Nc���������G���s���d��S(���N(����(���t���selft���args(����(����t+���/usr/lib/python2.4/test/test_httpservers.pyt���log_message���s����(���t���__name__t ���__module__R���(����(����(����R���R�������s���t���TestServerThreadc�����������B���s#���t��Z�d�„��Z�d�„��Z�d�„��Z�RS(���Nc���������C���s/���t��i�i�|��ƒ�|�|��_�|�|��_�t�|��_�d��S(���N(���t ���threadingt���Threadt���__init__R���t���request_handlert���test_objectt���Falset#���_TestServerThread__shutdown_request(���R���R���R���(����(����R���R ���"���s���� c���������C���s‘���t��d�|��i�ƒ�|��_�|��i�i�i�ƒ��d�|��i�_�|��i�i�i �ƒ��d��|��_�z2�x+�t�d�ƒ�|��i�o�PqP�|��i�i �ƒ��qP�WWd��|��i�i�ƒ��Xd��S(���Nt����i����i���f0.050000000000000003(���R���i����(���t ���HTTPServerR���R���t���servert���sockett���getsocknameR���t���PORTt���server_startedt���sett���Nonet���sleepR���t���handle_requestt���server_close(���R���(����(����R���t���run(���s���� �� �c���������C���s ���t��|��_�d��S(���N(���t���TrueR���R���(���R���(����(����R���t���stop8���s����(���R���R���R ���R���R���(����(����(����R���R���!���s��� t���BaseTestCasec�����������B���s,���t��Z�d�„��Z�d�„��Z�d�d��h��d�„�Z�RS(���Nc���������C���sN���t��i�ƒ��|��_�t�|��|��i�ƒ�|��_�t�|��i�_�|��i�i �ƒ��|��i�i �ƒ��d��S(���N(���R���t���EventR���R���R���R���t���threadR���t���daemont���startt���wait(���R���(����(����R���t���setUp=���s ���� c���������C���s���|��i�i�ƒ��d��S(���N(���R���R ���R���(���R���(����(����R���t���tearDownE���s����t���GETc���������C���s>���t��i�d�|��i�ƒ�|��_�|��i�i�|�|�|�|�ƒ�|��i�i �ƒ��S(���Nt ���localhost(���t���httplibt���HTTPConnectionR���R���t ���connectiont���requestt���methodt���urit���bodyt���headerst���getresponse(���R���R-���R,���R.���R/���(����(����R���R+���H���s����(���R���R���R$���R%���R���R+���(����(����(����R���R���<���s��� t���BaseHTTPServerTestCasec�����������B���sr���t��Z�d�e�e�f�d�„��ƒ��YZ�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z �d�„��Z �d �„��Z�d �„��Z�d�„��Z �RS(���NR���c�����������B���s8���t��Z�d�Z�d�Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�RS(���Ns���HTTP/1.1c���������C���s;���|��i�d�ƒ�|��i�d�d�ƒ�|��i�d�d�ƒ�|��i�ƒ��d��S(���NiÌ���s���Content-Types ���text/htmlt ���Connectiont���close(���R���t ���send_responset���send_headert���end_headers(���R���(����(����R���t���do_TESTS���s���� c���������C���s;���|��i�d�ƒ�|��i�d�d�ƒ�|��i�d�d�ƒ�|��i�ƒ��d��S(���NiÌ���s���Content-Types ���text/htmlR2���s ���keep-alive(���R���R4���R5���R6���(���R���(����(����R���t���do_KEEPY���s���� c���������C���s���|��i�d�ƒ�d��S(���Niç��(���R���t ���send_error(���R���(����(����R���t���do_KEYERROR_���s����c���������C���s;���|��i�d�ƒ�|��i�d�d�ƒ�|��i�d�d�ƒ�|��i�ƒ��d��S(���Niç��s���Content-Types ���text/htmlR2���R3���(���R���R4���R5���R6���(���R���(����(����R���t ���do_CUSTOMb���s���� (���R���R���t���protocol_versiont���default_request_versionR7���R8���R:���R;���(����(����(����R���R���O���s��� c���������C���s6���t��i�|��ƒ�t�i�d�|��i�ƒ�|��_�|��i�i�ƒ��d��S(���NR'���(���R���R$���R���R(���R)���R���t���cont���connect(���R���(����(����R���R$���h���s���� c���������C���s9���|��i�i�d�d�ƒ�|��i�i�ƒ��}�|��i�|�i�d�ƒ�d��S(���NR&���t���/iõ��(���R���R>���R+���R0���t���rest���assertEqualst���status(���R���RA���(����(����R���t���test_commandm���s����c���������C���sR���d�|��i�_�|��i�i�d�d�ƒ�|��i�i�ƒ��|��i�i�ƒ��}�|��i�|�i�d�ƒ�d��S(���Ns ���HTTP/1.1 R&���R@���iõ��( ���R���R>���t ���_http_vsn_strt ���putrequestt ���endheadersR0���RA���RB���RC���(���R���RA���(����(����R���t���test_request_line_trimmingr���s ���� c���������C���sY���|��i�i�d�d�ƒ�|��i�i�d�d�ƒ�|��i�i�ƒ��|��i�i�ƒ��}�|��i�|�i�d�ƒ�d��S(���NR&���R@���R2���R3���iõ��( ���R���R>���RF���t ���putheaderRG���R0���RA���RB���RC���(���R���RA���(����(����R���t���test_header_closey���s ���� c���������C���se���d�|��i�_�|��i�i�d�d�ƒ�|��i�i�d�d�ƒ�|��i�i�ƒ��|��i�i�ƒ��}�|��i�|�i �d�ƒ�d��S(���Ns���HTTP/1.1R&���R@���R2���s ���keep-aliveiõ��( ���R���R>���RE���RF���RI���RG���R0���RA���RB���RC���(���R���RA���(����(����R���t���test_head_keep_alive€���s���� c���������C���s9���|��i�i�d�d�ƒ�|��i�i�ƒ��}�|��i�|�i�d�ƒ�d��S(���Nt���TESTR@���iÌ���(���R���R>���R+���R0���RA���RB���RC���(���R���RA���(����(����R���t���test_handlerˆ���s����c���������C���sR���|��i�i�d�d�ƒ�|��i�i�ƒ��}�|��i�|�i�d�ƒ�d�ƒ�|��i�i�d�d�ƒ�d��S(���Nt���KEEPR@���R2���s ���keep-aliveRL���(���R���R>���R+���R0���RA���RB���t ���getheader(���R���RA���(����(����R���t���test_return_header_keep_alive���s����c���������C���s9���|��i�i�d�d�ƒ�|��i�i�ƒ��}�|��i�|�i�d�ƒ�d��S(���Nt���KEYERRORR@���iç��(���R���R>���R+���R0���RA���RB���RC���(���R���RA���(����(����R���t���test_internal_key_error“���s����c���������C���s9���|��i�i�d�d�ƒ�|��i�i�ƒ��}�|��i�|�i�d�ƒ�d��S(���Nt���CUSTOMR@���iç��(���R���R>���R+���R0���RA���RB���RC���(���R���RA���(����(����R���t���test_return_custom_status˜���s����(���R���R���R����t���BaseHTTPRequestHandlerR���R$���RD���RH���RJ���RK���RM���RP���RR���RT���(����(����(����R���R1���N���s��� t���SimpleHTTPServerTestCasec�����������B���sZ���t��Z�d�e�e�f�d�„��ƒ��YZ�d�„��Z�d�„��Z�d��d�„�Z�d�„��Z �d�„��Z �d�„��Z�RS( ���NR���c�����������B���s���t��Z�RS(���N(���R���R���(����(����(����R���R���Ÿ���s���c���������C���sª���t��i�|��ƒ�t�i�ƒ��|��_�t�i�ƒ��}�t�i �|�ƒ�d�|��_ �t�i�d�|�ƒ�|��_�t�i �i�|��i�ƒ�|��_�t�t�i �i�|��i�d�ƒ�d�ƒ�}�|�i�|��i �ƒ�|�i�ƒ��d��S(���Ns���We are the knights who say Ni!t���dirt���testt���wb(���R���R$���R���t���ost���getcwdt���cwdt���tempfilet ���gettempdirt���basetempdirt���chdirt���datat���mkdtempt���tempdirt���patht���basenamet���tempdir_namet���opent���joint���tempt���writeR3���(���R���Ri���R_���(����(����R���R$���¢���s���� !c���������C���sG���z2�t��i�|��i�ƒ�y�t�i�|��i�ƒ�Wn�n�XWd��t�i�|��ƒ�Xd��S(���N( ���RZ���R`���R���R\���t���shutilt���rmtreeRc���R���R%���(���R���(����(����R���R%���®���s�����c���������C���sa���|�i�ƒ��}�|��i�|�ƒ�|��i�|�i�|�ƒ�|��i�|�i�d��j�ƒ�|�o�|��i �|�|�ƒ�n�d��S(���N(���t���responset���readR.���R���t���assert_RB���RC���t���reasonR���Ra���t���assertEqual(���R���Rm���RC���Ra���R.���(����(����R���t���check_status_and_reason¸���s���� c���������C���sJ��|��i�|��i�d�ƒ�}�|��i�|�d�d�|��i�ƒ|��i�|��i�d�ƒ�}�|��i�|�d�ƒ�|��i�d�ƒ�}�|��i�|�d�ƒ�|��i�d�d�d�ƒ�}�|��i�|�d�ƒ�t�t�i�i �|��i�d�ƒ�d �ƒ�}�|��i�d�|��i�d�ƒ�}�|��i�|�d�ƒ�t�i�d �j�oP�t�i�|��i �d�ƒ�|��i�|��i�d�ƒ�}�|��i�|�d�ƒ�t�i�|��i �d�ƒ�n�d��S( ���Ns���/testiÈ���Ra���R@���s���/ThisDoesNotExisti”��t���ThisDoesNotExists ���index.htmlt���wt���posixi����ií��(���R���R+���Rf���Rm���Rr���Ra���Rg���RZ���Rd���Rh���t���ft���namet���chmodRc���(���R���Rm���Rv���(����(����R���t���test_getÀ���s ����!c���������C���sq���|��i�|��i�d�d�d�ƒ}�|��i�|�d�ƒ�|��i�|�i�d�ƒ�t�t�|��i �ƒ�ƒ�ƒ�|��i�|�i�d�ƒ�d�ƒ�d��S(���Ns���/testR,���t���HEADiÈ���s���content-lengths���content-types���application/octet-stream( ���R���R+���Rf���Rm���Rr���Rq���RO���t���strt���lenRa���(���R���Rm���(����(����R���t ���test_headÔ���s����c���������C���ss���|��i�d�d�d�ƒ}�|��i�|�d�ƒ�|��i�d�d�d�ƒ}�|��i�|�d�ƒ�|��i�d�d�d�ƒ}�|��i�|�d�ƒ�d��S(���NR@���R,���t���FOOiõ��t���gett���GETs(���R���R+���Rm���Rr���(���R���Rm���(����(����R���t���test_invalid_requestsÝ���s����(���R���R���R����t���SimpleHTTPRequestHandlerR���R$���R%���R���Rr���Ry���R}���R���(����(����(����R���RV���ž���s��� s@���#!%s print "Content-type: text/html" print print "Hello World" s¿���#!%s import cgi print "Content-type: text/html" print form = cgi.FieldStorage() print "%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"), form.getfirst("bacon")) t���CGIHTTPServerTestCasec�����������B���si���t��Z�d�e�e�f�d�„��ƒ��YZ�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z �d�„��Z �d �„��Z�d �„��Z�RS(���NR���c�����������B���s���t��Z�RS(���N(���R���R���(����(����(����R���R���ü���s���c���������C���s‡��t��i�|��ƒ�t�i�ƒ��|��_�t�i�i�|��i�d�ƒ�|��_ �t�i �|��i �ƒ�t�t�d�ƒ�o5�t�i�i�|��i�d�ƒ�|��_�t�i �t�i�|��i�ƒ�n �t�i�|��_�t�i�i�|��i �d�ƒ�|��_�t�|��i�d�ƒ�}�z+�|�i�t�|��i�ƒ�t�i�|��i�d�ƒ�Wd��|�i�ƒ��Xt�i�i�|��i �d�ƒ�|��_�t�|��i�d�ƒ�}�z+�|�i�t�|��i�ƒ�t�i�|��i�d�ƒ�Wd��|�i�ƒ��Xt�i�ƒ��|��_�t�i�|��i�ƒ�d��S(���Ns���cgi-bint���symlinkt���pythons���file1.pyRt���iÿ��s���file2.py(���R���R$���R���R]���Rb���t ���parent_dirRZ���Rd���Rh���t���cgi_dirt���mkdirt���hasattrt ���pythonexeR„���t���syst ���executablet ���file1_pathRg���t���file1Rj���t ���cgi_file1Rx���R3���t ���file2_patht���file2t ���cgi_file2R[���R\���R`���(���R���R‘���RŽ���(����(����R���R$���ÿ���s0���� ��c���������C���s���z{�t��i�|��i�ƒ�|��i�t�i�j�o�t��i�|��i�ƒ�n�t��i�|��i�ƒ�t��i�|��i �ƒ�t��i �|��i�ƒ�t��i �|��i�ƒ�Wd��t �i�|��ƒ�Xd��S(���N(���RZ���R`���R���R\���RŠ���R‹���RŒ���t���removeR���R���t���rmdirR‡���R†���R���R%���(���R���(����(����R���R%��� ��s�����c������ ���C���sî��h��d�d�d�f�<d�t��<d�t��<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d �d �d�f�<d�d �d�f�<d �d�d �f�<d�d�d �f�<d�d�d �f�<d�d�d �f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�d�d�f�<d�t��<d�d�d�f�<d �d�d�f�<d!�t��<d"�d�d�f�<}�xs�|�i�ƒ��D]e�\�}�}�|�t��j�o�|��i�|�t�i�|�ƒ�n3�t�i�|�ƒ�}�|��i �|�|�d#�d$�|�|�|�f�ƒqWd��S(%���NR���R@���s���..s���/.//..s���//s���/\s���\s���/.//s���cgi-bin/file1.pys���/cgi-bins���file1.pys���/cgi-bin/file1.pyt���as���/as���//as���./as���./C:/s���/C:s���/a/bt���bs���/a/b/s ���/a/b/c/..s���/a/b/c/../dt���ds���/a/b/c/../d/e/../fs���/a/b/dRv���s���/a/b/c/../d/e/../../fs���/a/b/c/../d/e/.././././..//fs���../a/b/c/../d/e/.././././..//fs���/a/b/c/../d/e/../../../fs���/a/b/c/../d/e/../../../../fs���/a/b/c/../d/e/../../../../../fs���/a/b/c/../d/e/../../../../f/..t���msgs���path = %r Got: %r Wanted: %r(���t ���IndexErrort���test_vectorst ���iteritemsRd���t���expectedR���t���assertRaisest ���CGIHTTPServert���_url_collapse_path_splitt���actualRB���(���R���Rš���R ���Rœ���Rd���(����(����R���t���test_url_collapse_path_split,��s����ÿ�u � c���������C���s>���|��i�d�ƒ�}�|��i�d�|�i�ƒ��|�i�d�ƒ�|�i�f�ƒ�d��S(���Ns���/cgi-bin/file1.pys���Hello World s ���text/htmliÈ���s���Content-type(���s���Hello World s ���text/htmliÈ���(���R���R+���RA���RB���Rn���RO���RC���(���R���RA���(����(����R���t���test_headers_and_contentS��s���� c���������C���sk���t��i�h��d�d�<d�d�<d�d�<ƒ�}�h��d�d�<}�|��i�d �d �|�|�ƒ�}�|��i�|�i�ƒ��d�ƒ�d��S(���Nt���spami���t���eggsR…���t���baconi@â�s���Content-types!���application/x-www-form-urlencodeds���/cgi-bin/file2.pyt���POSTs���1, python, 123456 ( ���t���urllibt ���urlencodet���paramsR/���R���R+���RA���RB���Rn���(���R���R/���R©���RA���(����(����R���t ���test_postX��s����*c���������C���s0���|��i�d�ƒ�}�|�i�ƒ��|��i�|�i�d�ƒ�d��S(���Ns���/cgi-bin/invalidi”��(���R���R+���RA���Rn���RB���RC���(���R���RA���(����(����R���t���test_invaliduri_��s���� c���������C���sc���h��d�d�t��i�d�ƒ�<}�|��i�d�d�d�|�ƒ}�|��i�d�|�i�ƒ��|�i�d �ƒ�|�i �f�ƒ�d��S(���Nt ���Authorizations���Basic %ss ���username:passs���/cgi-bin/file1.pyR&���R/���s���Hello World s ���text/htmliÈ���s���Content-type(���s���Hello World s ���text/htmliÈ���( ���t���base64t ���b64encodeR/���R���R+���RA���RB���Rn���RO���RC���(���R���R/���RA���(����(����R���t���test_authorizationd��s���� c���������C���s>���|��i�d�ƒ�}�|��i�d�|�i�ƒ��|�i�d�ƒ�|�i�f�ƒ�d��S(���Ns���cgi-bin/file1.pys���Hello World s ���text/htmliÈ���s���Content-type(���s���Hello World s ���text/htmliÈ���(���R���R+���RA���RB���Rn���RO���RC���(���R���RA���(����(����R���t���test_no_leading_slashk��s���� ( ���R���R���R����t���CGIHTTPRequestHandlerR���R$���R%���R¡���R¢���Rª���R«���R¯���R°���(����(����(����R���Rƒ���û���s��� ! ' c����������C���si���t��t�d�ƒ�oU�d�}�xL�t�o@�y1�t�i�|�t�i�ƒ�\�}�}��|�d�j�o�Pn�Wq�Pq�Xq�Wn�d�S(���så���Use this function at the end of test_main() whenever sub-processes are started. This will help ensure that no extra children (zombies) stick around to hog resources and create problems when looking for refleaks. t���waitpidiÿÿÿÿi����N(���R‰���RZ���t���any_processR���R²���t���WNOHANGt���pidRC���(���RC���Rµ���R³���(����(����R���t ���reap_childrenr��s������ c���������C���sk���t��i�ƒ��}�t��i�i�ƒ��}�z�t�i�t�t �t �ƒ�Wd��t�ƒ��t��i�i�ƒ��t��i�i �|�ƒ�t��i�|�ƒ�Xd��S(���N(���RZ���R[���R\���t���environt���copyt���envt���test_supportt���run_unittestR1���RV���Rƒ���R¶���t���cleart���updateR`���(���t���verboseR¹���R\���(����(����R���t ���test_main‡��s���� � t���__main__(#���t���__doc__t���BaseHTTPServerRU���R���t���SimpleHTTPServerR‚���Rž���R±���RZ���R‹���R���Rk���R§���R(���R]���R���t���timeR���t���unittestRX���Rº���R����R ���R���t���TestCaseR���R1���RV���R���R’���Rƒ���R¶���R���R¿���R���(���Rº���R¶���Rž���RÅ���Rƒ���RV���R���Rk���R���R’���R���R]���R1���R���R���R§���R¿���R���R‚���R‹���R����R(���R±���R���RU���RZ���(����(����R���t���?���s6��� PIw