Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_urllibnet.cpython-310.pyc
o

�9jK%�@s�ddlZddlmZddlmZddlmZddlZddlZddlZ	ddl
Z	ddlZddlZ
ddlZe�d�Gdd�dej�ZGdd	�d	ej�ZGd
d�dej�Zedkr\e��dSdS)
�N)�support)�	os_helper)�
socket_helper�networkc@s$eZdZdd�Zdd�Zdd�ZdS)�URLTimeoutTestcCst�tj�dS�N)�socket�setdefaulttimeoutr�INTERNET_TIMEOUT��self�r
�*/usr/lib/python3.10/test/test_urllibnet.py�setUpszURLTimeoutTest.setUpcCst�d�dSr)rr	rr
r
r�tearDownszURLTimeoutTest.tearDowncCsd|�tjj�tj�tj�j}t	�
|��tj�tj�}|��Wd�dS1s+wYdSr)
�
addCleanup�urllib�request�
urlcleanup�parse�urlparser�
TEST_HTTP_URL�netlocr�transient_internet�urlopen�read)r�domain�fr
r
r�testURLreads
"�zURLTimeoutTest.testURLreadN)�__name__�
__module__�__qualname__rrrr
r
r
rrsrc@sZeZdZdZdZdd�Zejdd��Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�ZdS)�urlopenNetworkTestsaATests urllib.request.urlopen using the network.

    These tests are not exhaustive.  Assuming that testing using files does a
    good job overall of some of the basic interface features.  There are no
    tests exercising the optional 'data' and 'proxies' arguments.  No tests
    for transparent redirection have been written.

    setUp is not used for always constructing a connection to
    http://www.pythontest.net/ since there a few tests that don't use that address
    and making a connection is expensive enough to warrant minimizing unneeded
    connections.

    �http://www.pythontest.net/cC�|�tjj�dSr�rrrrrr
r
rr6�zurlopenNetworkTests.setUpc	osj�|d}t�|��!tjj|i|��}z	|VW|��n|��wWd�dS1s.wYdS�Nr)rrrrr�close)r�args�kwargs�resource�rr
r
rr:s�"�zurlopenNetworkTests.urlopencCsb|�|j��!}dD]
}|�t||�d|�q	|�|��d�Wd�dS1s*wYdS)N)r�readline�	readlines�filenor(�info�geturlz3object returned from urlopen lacks the %s attributezcalling 'read' failed)r�url�
assertTrue�hasattrr)r�open_url�attrr
r
r�
test_basicDs�"�zurlopenNetworkTests.test_basiccCsV|�|j��}|�|��td�|�|��td�Wd�dS1s$wYdS)Nz readline did not return a stringzreadlines did not return a list)rr2�assertIsInstancer-�bytesr.�list)rr5r
r
r�test_readlinesMs��"�z"urlopenNetworkTests.test_readlinescCs\|�|j��}|��}|�|tjjd�|�|��d�Wd�dS1s'wYdS)NzEobject returned by 'info' is not an instance of email.message.Message�html)	rr2r0r8�email�message�Message�assertEqual�get_content_subtype)rr5�info_objr
r
r�	test_infoUs�"�zurlopenNetworkTests.test_infocCsH|�|j��}|��}|�||j�Wd�dS1swYdSr)rr2r1r@)rr5�
gotten_urlr
r
r�test_geturl^s"�zurlopenNetworkTests.test_geturlc	Cs�|jd}t�|��<|�t��tj���|�}Wd�n1s#wYz
|�	�}W|�
�n|�
�w|�|d�Wd�dS1sIwYdS)N�
XXXinvalidXXXi�)r2rr�assertWarns�DeprecationWarningrr�FancyURLopener�open�getcoder(r@)r�URLr5�coder
r
r�test_getcodeds
�
"�z urlopenNetworkTests.test_getcodecCs~d}zt�|�Wn	tyYnw|�d|�d}|jt|d��tj�d�|��Wd�dS1s8wYdS)Nzsadflkjsasf.i.nvali.d.z&%r should not resolve for test to workzuopening an invalid URL did not raise OSError; can be caused by a broken DNS server (e.g. returns 404 or hijacks page)��msgz
http://{}/)	r�
gethostbyname�OSError�skipTest�assertRaisesrrr�format)r�bogus_domain�failure_explanationr
r
r�test_bad_addressps�"�z$urlopenNetworkTests.test_bad_addressN)rr r!�__doc__r2r�
contextlib�contextmanagerrr7r;rCrErNrXr
r
r
rr"%s
			r"c@sReZdZdZdd�Zejdd��Zdd�Zdd	�Z	d
d�Z
dZd
d�Zdd�Z
dS)�urlretrieveNetworkTestsz3Tests urllib.request.urlretrieve using the network.cCr$rr%rr
r
rr�r&zurlretrieveNetworkTests.setUpc
osv�|d}t�|��'tjj|i|��\}}z||fVWt�|�nt�|�wWd�dS1s4wYdSr')rrrr�urlretriever�unlink)rr)r*r+�
file_locationr0r
r
rr]�s�"�z#urlretrieveNetworkTests.urlretrievec	Cs�|�|j��:\}}|�tj�|�d�t|d��}|�|��d�Wd�n1s+wYWd�dSWd�dS1sCwYdS)Nz9file location returned by urlretrieve is not a valid path�rbz=reading from the file location returned by urlretrieve failed)r]�logor3�os�path�existsrJr�rr_r0rr
r
rr7�s��"�z"urlretrieveNetworkTests.test_basicc	Cs�|�|jtj��@\}}|�|tj�|�tj�|��t	|d��}|�|�
�d�Wd�n1s3wYWd�dSWd�dS1sKwYdS)Nr`z"reading from temporary file failed)r]rar�TESTFNr@r3rbrcrdrJrrer
r
r�test_specified_path�s���"�z+urlretrieveNetworkTests.test_specified_pathcCsH|�|j��\}}|�|tjjd�Wd�dS1swYdS)Nz0info is not an instance of email.message.Message)r]rar8r=r>r?)rr_r0r
r
r�test_header�s
�"�z#urlretrieveNetworkTests.test_headerr#c	Cs�|�|j��3\}}|�d�}d}zt�||�Wnty(|�d|�Yn	wWd�dSWd�dS1s<wYdS)N�Datez%a, %d %b %Y %H:%M:%S GMTzDate value not in %r format)r]ra�get�time�strptime�
ValueError�fail)rr_�fileheaders�	datevalue�
dateformatr
r
r�test_data_header�s
���"�z(urlretrieveNetworkTests.test_data_headercsg��fdd�}|j|j|d��\}}t|d�}Wd�n1s#wYt��}|jt��ddd�|��ddd�|j�dddd	|d�|��dd
|�|��dd
|�dd
��D�}|j�ddh|d|d�|j�dd�dd|d|d�dS)Ncs��|||f�dSr)�append)�blocks�
block_size�
total_size��recordsr
r�recording_reporthook�szEurlretrieveNetworkTests.test_reporthook.<locals>.recording_reporthook)�
reporthookzContent-Length�zKThere should always be two calls; the first one before the transfer starts.rOrzblock size can't be 0 in %s����cSsh|]\}}}|�qSr
r
)�.0�_rur
r
r�	<setcomp>�sz:urlretrieveNetworkTests.test_reporthook.<locals>.<setcomp>zblock sizes in %s must be equalz9number of blocks * block size must be >= total size in %s)r]ra�int�repr�
assertGreater�lenr@�assertGreaterEqual)rryr_ro�
expected_size�records_repr�block_sizesr
rwr�test_reporthook�s.����
�z'urlretrieveNetworkTests.test_reporthookN)rr r!rYrrZr[r]r7rgrhrarrr�r
r
r
rr\�s
				r\�__main__)�unittest�testr�test.supportrrrZr�urllib.parser�urllib.requestrb�
email.messager=rk�requires�TestCaserr"r\r�mainr
r
r
r�<module>s$
rO�

Youez - 2016 - github.com/yon3zu
LinuXploit