HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //proc/93580/root/lib/python3.10/wsgiref/__pycache__/simple_server.cpython-310.pyc
o

p̦i3�@s4dZddlmZmZddlZddlZddlmZddl	m
Z
dZgd�ZdeZ
e
�d	ej��dZe
d
eZGdd�de�ZGd
d�de�ZGdd�de�Zdd�Zeefdd�Zedkr�edde��'Zej��Zededdedd�ddlZe�d�e��Wd�dS1s�wYdSdS)a!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.
�)�BaseHTTPRequestHandler�
HTTPServerN)�
SimpleHandler)�python_implementationz0.2)�
WSGIServer�WSGIRequestHandler�demo_app�make_server�WSGIServer/�/� c@seZdZeZdd�ZdS)�
ServerHandlerc	Cs<z|j�|j�dd�d|j�Wt�|�dSt�|�w)Nr�r)�request_handler�log_request�status�split�
bytes_sentr�close��self�r�,/usr/lib/python3.10/wsgiref/simple_server.pyr s
�zServerHandler.closeN)�__name__�
__module__�__qualname__�software_version�server_softwarerrrrrr
sr
c@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)rz7BaseHTTPServer that implements the Python WSGI protocolNcCst�|�|��dS)z.Override server_bind to store the server name.N)r�server_bind�
setup_environrrrrr0s
zWSGIServer.server_bindcCsFi}|_|j|d<d|d<t|j�|d<d|d<d|d<d|d<dS)	N�SERVER_NAMEzCGI/1.1�GATEWAY_INTERFACE�SERVER_PORT��REMOTE_HOST�CONTENT_LENGTH�SCRIPT_NAME)�base_environ�server_name�str�server_port)r�envrrrr5s

zWSGIServer.setup_environcCs|jS�N��applicationrrrr�get_app?�zWSGIServer.get_appcCs
||_dSr,r-)rr.rrr�set_appBs
zWSGIServer.set_app)	rrr�__doc__r.rrr/r1rrrrr*s
rc@s,eZdZdeZdd�Zdd�Zdd�ZdS)	rr
cCsL|jj��}|j|d<|j|d<|j|d<d|jvr$|j�dd�\}}n|jd}}tj	�
|d�|d<||d	<|��}||jd
krF||d<|jd
|d<|j
�d
�dur]|j
��|d<n|j
d
|d<|j
�d�}|rp||d<|j
��D].\}}|�dd���}|��}||vr�qud||vr�|d|d|7<qu||d|<qu|S)N�SERVER_PROTOCOL�SERVER_SOFTWARE�REQUEST_METHOD�?rr#z
iso-8859-1�	PATH_INFO�QUERY_STRINGrr$�REMOTE_ADDRzcontent-type�CONTENT_TYPEzcontent-lengthr%�-�_�HTTP_�,)�serverr'�copy�request_version�server_version�command�pathr�urllib�parse�unquote�address_string�client_address�headers�get�get_content_type�items�replace�upper�strip)rr+rD�query�host�length�k�vrrr�get_environKs6



zWSGIRequestHandler.get_environcCstjSr,)�sys�stderrrrrr�
get_stderrpr0zWSGIRequestHandler.get_stderrcCs�|j�d�|_t|j�dkrd|_d|_d|_|�d�dS|��s$dSt	|j|j
|��|��dd�}||_
|�|j���dS)zHandle a single HTTP requestiir#i�NF)�multithread)�rfile�readline�raw_requestline�len�requestlinerArC�
send_error�
parse_requestr
�wfilerYrVr�runr?r/)r�handlerrrr�handless
�zWSGIRequestHandler.handleN)rrr�__version__rBrVrYrerrrrrGs
%rcCsrddlm}|�}td|d�t|d�t|���}|D]\}}t|dt|�|d�q|ddg�|���d�gS)	Nr)�StringIOzHello world!)�file�=z200 OK)zContent-Typeztext/plain; charset=utf-8zutf-8)�iorg�print�sortedrM�repr�getvalue�encode)�environ�start_responserg�stdout�hrTrUrrrr�s
rcCs|||f|�}|�|�|S)zACreate a new WSGI server listening on `host` and `port` for `app`)r1)rR�port�app�server_class�
handler_classr?rrrr	�s
r	�__main__r#i@zServing HTTP onrtrz...zhttp://localhost:8000/xyz?abc) r2�http.serverrrrW�urllib.parserE�wsgiref.handlersr�platformrrf�__all__rB�versionr�sys_versionrr
rrrr	r�httpd�socket�getsockname�sark�
webbrowser�open�handle_requestrrrr�<module>s4C
�	


"��