AlkantarClanX12

Your IP : 3.144.89.245


Current Path : /proc/self/root/opt/alt/python33/lib64/python3.3/wsgiref/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python33/lib64/python3.3/wsgiref/__pycache__/simple_server.cpython-33.pyc

�
��f!c@s�dZddlmZmZddlZddlZddlmZddl	m
Z
dZddd	d
gZdeZ
e
�dejj�dZe
d
eZGdd�de�ZGdd�de�ZGdd�de�Zdd	�Zeedd
�Zedkr}edde�Zejj�Zededdedd�ddlZejd�ej�ej �ndS(u!BaseHTTPServer that implements the Python WSGI protocol (PEP 3333)

This is both an example of how WSGI can be implemented, and a basis for running
simple web applications on a local machine, such as might be done when testing
or debugging an application.  It has not been reviewed for security issues,
however, and we strongly recommend that you use a "real" web server for
production use.

For example usage, see the 'if __name__=="__main__"' block at the end of the
module.  See also the BaseHTTPServer module docs for other API information.
i(uBaseHTTPRequestHandleru
HTTPServerN(u
SimpleHandler(upython_implementationu0.2u
WSGIServeruWSGIRequestHandlerudemo_appumake_serveruWSGIServer/u/u cBs&|EeZdZeZdd�ZdS(u
ServerHandlercCsBz-|jj|jjdd�d|j�Wdtj|�XdS(Nu ii(urequest_handlerulog_requestustatususplitu
bytes_sentu
SimpleHandleruclose(uself((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuclose s	$uServerHandler.closeN(u__name__u
__module__u__qualname__usoftware_versionuserver_softwareuclose(u
__locals__((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyu
ServerHandlersu
ServerHandlercBsP|EeZdZdZd
Zdd�Zdd�Zdd�Zdd	�Z	d
S(u
WSGIServeru7BaseHTTPServer that implements the Python WSGI protocolcCstj|�|j�dS(u.Override server_bind to store the server name.N(u
HTTPServeruserver_bindu
setup_environ(uself((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuserver_bind0s
uWSGIServer.server_bindcCsYi}|_|j|d<d|d<t|j�|d<d|d<d|d<d|d<dS(	NuSERVER_NAMEuCGI/1.1uGATEWAY_INTERFACEuSERVER_PORTuuREMOTE_HOSTuCONTENT_LENGTHuSCRIPT_NAME(ubase_environuserver_nameustruserver_port(uselfuenv((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyu
setup_environ5s




uWSGIServer.setup_environcCs|jS(N(uapplication(uself((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuget_app?suWSGIServer.get_appcCs
||_dS(N(uapplication(uselfuapplication((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuset_appBsuWSGIServer.set_appN(
u__name__u
__module__u__qualname__u__doc__uNoneuapplicationuserver_bindu
setup_environuget_appuset_app(u
__locals__((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyu
WSGIServer*s
cBsB|EeZdZdeZdd�Zdd�Zdd�ZdS(	uWSGIRequestHandleruWSGIServer/cCs�|jjj�}|j|d<|j|d<|j|d<d|jkrf|jjdd�\}}n|jd}}tj	j
|�jd�|d<||d	<|j�}||j
d
kr�||d<n|j
d
|d<|jjd
�dkr
|jj�|d<n|jd
|d<|jjd�}|r@||d<nx�|jj�D]y\}}|jdd�j�}|j�}||kr�qPnd||kr�|d|d|7<qP||d|<qPW|S(NuSERVER_PROTOCOLuSERVER_SOFTWAREuREQUEST_METHODu?iuu
iso-8859-1u	PATH_INFOuQUERY_STRINGiuREMOTE_HOSTuREMOTE_ADDRucontent-typeuCONTENT_TYPEucontent-lengthuCONTENT_LENGTHu-u_uHTTP_u,(userverubase_environucopyurequest_versionuserver_versionucommandupathusplituurllibuparseuunquote_to_bytesudecodeuaddress_stringuclient_addressuheadersugetuNoneuget_content_typeuitemsureplaceuupperustrip(uselfuenvupathuqueryuhostulengthukuv((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuget_environKs8





uWSGIRequestHandler.get_environcCstjS(N(usysustderr(uself((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyu
get_stderrpsuWSGIRequestHandler.get_stderrcCs�|jjd�|_t|j�dkrVd|_d|_d|_|jd�dS|j�sfdSt	|j|j
|j�|j��}||_
|j|jj��dS(uHandle a single HTTP requestiiui�N(urfileureadlineuraw_requestlineulenurequestlineurequest_versionucommandu
send_erroru
parse_requestu
ServerHandleruwfileu
get_stderruget_environurequest_handlerurunuserveruget_app(uselfuhandler((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuhandless			
$	uWSGIRequestHandler.handleN(u__name__u
__module__u__qualname__u__version__userver_versionuget_environu
get_stderruhandle(u
__locals__((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyuWSGIRequestHandlerGs
%cCs�ddlm}|�}tdd|�td|�t|j��}x0|D](\}}t|dt|�d|�qOW|dd
g�|j�jd	�gS(Ni(uStringIOuHello world!ufileu=u200 OKuContent-Typeutext/plain; charset=utf-8uutf-8(uContent-Typeutext/plain; charset=utf-8(uiouStringIOuprintusorteduitemsureprugetvalueuencode(uenvironustart_responseuStringIOustdoutuhukuv((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyudemo_app�s	
 cCs&|||f|�}|j|�|S(uACreate a new WSGI server listening on `host` and `port` for `app`(uset_app(uhostuportuappuserver_classu
handler_classuserver((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyumake_server�s
u__main__ui@uServing HTTP onuportiu...uhttp://localhost:8000/xyz?abc(!u__doc__uhttp.serveruBaseHTTPRequestHandleru
HTTPServerusysuurllib.parseuurllibuwsgiref.handlersu
SimpleHandleruplatformupython_implementationu__version__u__all__userver_versionuversionusplitusys_versionusoftware_versionu
ServerHandleru
WSGIServeruWSGIRequestHandlerudemo_appumake_serveru__name__uhttpdusocketugetsocknameusauprintu
webbrowseruopenuhandle_requestuserver_close(((u:/opt/alt/python33/lib64/python3.3/wsgiref/simple_server.pyu<module>s.
B