AlkantarClanX12

Your IP : 3.145.180.152


Current Path : /proc/self/root/usr/lib64/python3.8/wsgiref/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.8/wsgiref/__pycache__/simple_server.cpython-38.opt-2.pyc

U

e5d3�	@sddlmZmZddlZddlZddlmZddlm	Z	dZ
dddd	gZd
e
Ze	�dej
��dZedeZGd
d�de�ZGdd�de�ZGdd�de�Zdd�Zeefdd	�Zedk�redde��BZej��Zededdedd�ddlZe�d�e��W5QRXdS)�)�BaseHTTPRequestHandler�
HTTPServerN)�
SimpleHandler)�python_implementationz0.2�
WSGIServer�WSGIRequestHandler�demo_app�make_server�WSGIServer/�/� c@seZdZeZdd�ZdS)�
ServerHandlerc	Cs4z"|j�|j�dd�d|j�W5t�|�XdS)Nr�r)r�close�request_handlerZlog_requestZstatus�splitZ
bytes_sent��self�r�-/usr/lib64/python3.8/wsgiref/simple_server.pyr s�zServerHandler.closeN)�__name__�
__module__�__qualname__�software_versionZserver_softwarerrrrrr
sr
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�ZdS)
rNcCst�|�|��dS�N)r�server_bind�
setup_environrrrrr0s
zWSGIServer.server_bindcCsFi}|_|j|d<d|d<t|j�|d<d|d<d|d<d|d<dS)	NZSERVER_NAMEzCGI/1.1ZGATEWAY_INTERFACEZSERVER_PORT��REMOTE_HOST�CONTENT_LENGTHZSCRIPT_NAME)�base_environZserver_name�strZserver_port)r�envrrrr5s

zWSGIServer.setup_environcCs|jSr��applicationrrrr�get_app?szWSGIServer.get_appcCs
||_dSrr#)rr$rrr�set_appBszWSGIServer.set_app)rrrr$rrr%r&rrrrr*s

c@s,eZdZdeZdd�Zdd�Zdd�ZdS)	rr
cCsP|jj��}|j|d<|j|d<|j|d<d|jkrH|j�dd�\}}n|jd}}tj	�
|d�|d<||d	<|��}||jd
kr�||d<|jd
|d<|j
�d
�dkr�|j
��|d<n|j
d
|d<|j
�d�}|r�||d<|j
��D]`\}}|�dd���}|��}||k�rq�d||k�r>|d|d|7<q�||d|<q�|S)NZSERVER_PROTOCOLZSERVER_SOFTWAREZREQUEST_METHOD�?rrz
iso-8859-1Z	PATH_INFOZQUERY_STRINGrrZREMOTE_ADDRzcontent-typeZCONTENT_TYPEzcontent-lengthr�-�_ZHTTP_�,)�serverr �copy�request_version�server_version�command�pathr�urllib�parseZunquoteZaddress_stringZclient_addressZheaders�getZget_content_type�items�replace�upper�strip)rr"r0Zquery�hostZlength�k�vrrr�get_environKs8




zWSGIRequestHandler.get_environcCstjSr)�sys�stderrrrrr�
get_stderrpszWSGIRequestHandler.get_stderrcCs�|j�d�|_t|j�dkr<d|_d|_d|_|�d�dS|��sHdSt	|j|j
|��|��dd�}||_
|�|j���dS)Niiri�F)Zmultithread)Zrfile�readlineZraw_requestline�lenZrequestliner-r/Z
send_errorZ
parse_requestr
Zwfiler>r;r�runr+r%)rZhandlerrrr�handless$
�zWSGIRequestHandler.handleN)rrr�__version__r.r;r>rBrrrrrGs%cCsrddlm}|�}td|d�t|d�t|���}|D]\}}t|dt|�|d�q8|ddg�|���d�gS)	Nr)�StringIOzHello world!)�file�=z200 OK)zContent-Typeztext/plain; charset=utf-8zutf-8)�iorD�print�sortedr4�repr�getvalue�encode)�environZstart_responserD�stdout�hr9r:rrrr�s
cCs|||f|�}|�|�|Sr)r&)r8�portZappZserver_classZ
handler_classr+rrrr	�s
�__main__ri@zServing HTTP onrPrz...zhttp://localhost:8000/xyz?abc)Zhttp.serverrrr<Zurllib.parser1Zwsgiref.handlersr�platformrrC�__all__r.�versionr�sys_versionrr
rrrr	rZhttpdZsocketZgetsocknameZsarHZ
webbrowser�openZhandle_requestrrrr�<module>
s.C
�