Your IP : 216.73.216.213
3
� f� � @ s� d Z ddlZddlZddlZddlmZmZ dd� Zedkr�ej d Z
eej �dkrbeej d �nd Z
ejd
e
e�Zedje
e
�� yej� W n ek
r� ed� Y nX dS )
a
Small wsgiref based web server. Takes a path to serve from and an
optional port number (defaults to 8000), then tries to serve files.
Mime types are guessed from the file names, 404 errors are raised
if the file is not found. Used for the make serve target in Doc.
� N)�
simple_server�utilc C s� t jjt| d dd � �}d|jt jj�d kr>t jj|d�}tj|�d }t jj|�rx|dd|fg� tj t
|d��S |d d
g� dgS d S )NZ PATH_INFO� �.z
index.htmlr z200 OK�Content-Type�rbz
404 Not Found�
text/plains not found���)r r )�os�path�join�split�sep� mimetypesZ
guess_type�existsr ZFileWrapper�open)�environZrespond�fn�type� r �8/opt/alt/python36/lib64/python3.6/Tools/scripts/serve.py�app
s r �__main__r � i@ � z(Serving {} on port {}, control-C to stopzShutting down.)�__doc__�sysr
r Zwsgirefr r r �__name__�argvr �len�intZportZmake_serverZhttpd�print�formatZ
serve_forever�KeyboardInterruptr r r r �<module> s