Your IP : 3.146.34.239


Current Path : /opt/alt/python313/lib64/python3.13/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/wsgiref/__pycache__/simple_server.cpython-313.pyc

�

1}g����SrSSKJrJr SSKrSSKrSSKJr SSK	J
r
 Sr/SQrS\-r
\
"5S	-\RR5S-r\
S
-\-r"SS\5r"S
S\5r"SS\5rSr\\4Sjr\S:Xaf\"SS\5r\R2R55r\"S\SS\SS5 SSKr\R<"S5 \R?5 SSS5 gg!,(df   g=f)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��\rSrSr\rSrSrg)�
ServerHandler�c���URRURRSS5SUR5 [
R"U5 g![
R"U5 f=f)Nr
�r)�request_handler�log_request�status�split�
bytes_sentr�close��selfs �</opt/alt/python313/lib64/python3.13/wsgiref/simple_server.pyr�ServerHandler.close sY��	&�� � �,�,����!�!�#�a�(��+�T�_�_�
�
����%��M����%�s�AA�A4�N)�__name__�
__module__�__qualname__�__firstlineno__�software_version�server_softwarer�__static_attributes__r�rrrs��&�O�&r%rc�4�\rSrSrSrSrSrSrSrSr	Sr
g)	r�*z7BaseHTTPServer that implements the Python WSGI protocolNc�P�[R"U5 UR5 g)z.Override server_bind to store the server name.N)r�server_bind�
setup_environrs rr)�WSGIServer.server_bind0s�����t�$����r%c��0=olURUS'SUS'[UR5US'SUS'SUS'SUS'g)	N�SERVER_NAMEzCGI/1.1�GATEWAY_INTERFACE�SERVER_PORT��REMOTE_HOST�CONTENT_LENGTH�SCRIPT_NAME)�base_environ�server_name�str�server_port)r�envs  rr*�WSGIServer.setup_environ5s\��"$�$���!�-�-��M��#,��� � ��!1�!1�2��M����M�� ������M�r%c��UR$�N��applicationrs r�get_app�WSGIServer.get_app?s�����r%c��Xlgr;r<)rr=s  r�set_app�WSGIServer.set_appBs��&�r%)r=r4)rrr r!�__doc__r=r)r*r>rAr$rr%rrr*s��A��K��
 � �'r%rc�0�\rSrSrS\-rSrSrSrSr	g)r�Grc�r�URRR5nURUS'URUS'UR
US'SUR;aURRSS5up#O
URSp2[RRUS5US'X1S	'URS
US'URRS5cURR5US
'OURSUS
'URRS5nU(aXAS'URR5H`upVUR!SS5R#5oVR%5nXQ;aM;SU-U;aUSU-==SU--
ss'MYXaSU-'Mb U$)N�SERVER_PROTOCOL�SERVER_SOFTWARE�REQUEST_METHOD�?rr0z
iso-8859-1�	PATH_INFO�QUERY_STRINGr�REMOTE_ADDRzcontent-type�CONTENT_TYPEzcontent-lengthr2�-�_�HTTP_�,)�serverr4�copy�request_version�server_version�command�pathr�urllib�parse�unquote�client_address�headers�get�get_content_type�items�replace�upper�strip)rr8rX�query�length�k�vs       r�get_environ�WSGIRequestHandler.get_environKs����k�k�&�&�+�+�-��!%�!5�!5����!%�!4�!4���� $�������$�)�)��������Q�/�J�D�����2��!�<�<�/�/��l�C��K��#�N��!�0�0��3��M���<�<���N�+�3�"&�,�,�"?�"?�"A�C���"&�,�,�~�">�C������!�!�"2�3���$*� �!��L�L�&�&�(�D�A��i�i��C� �&�&�(�A�G�G�I�!��x���q�y�C���G�A�I��#�a�%�'��!"�G�A�I��)��
r%c�"�[R$r;)�sys�stderrrs r�
get_stderr�WSGIRequestHandler.get_stderrls���z�z�r%c���URRS5Ul[UR5S:�a'SUlSUlSUlURS5 gUR5(dg[URURUR5UR5SS9nXl
URURR!55 g)zHandle a single HTTP requestiir0i�NF)�multithread)�rfile�readline�raw_requestline�len�requestlinerUrW�
send_error�
parse_requestr�wfilermrhr�runrSr>)r�handlers  r�handle�WSGIRequestHandler.handleos��� $�z�z�2�2�5�9����t�#�#�$�u�,�!�D��#%�D� ��D�L��O�O�C� ���!�!�#�#����J�J��
�
�D�O�O�$5�t�7G�7G�7I��
��#'�����D�K�K�'�'�)�*r%)rWrsrUruN)
rrr r!�__version__rVrhrmr{r$rr%rrrGs��"�[�0�N��B�+r%rc��SSKJn U"5n[SUS9 [US9 [UR	55nUHupV[US[U5US9 M U"SS/5 UR
5RS5/$)	Nr)�StringIOzHello world!)�file�=z200 OK)zContent-Typeztext/plain; charset=utf-8zutf-8)�ior�print�sortedr`�repr�getvalue�encode)�environ�start_responser�stdout�hrfrgs       rr	r	�su���
�Z�F�	�.�v�&�	�v���w�}�}���A����
�a��D��G�&�)���8�J�K�L��O�O��$�$�W�-�.�.r%c�<�U"X4U5nURU5 U$)zACreate a new WSGI server listening on `host` and `port` for `app`)rA)�host�port�app�server_class�
handler_classrSs      rr
r
�s#���4�,�
�
6�F�
�N�N�3���Mr%�__main__r0i@zServing HTTP onr�rz...zhttp://localhost:8000/xyz?abc) rC�http.serverrrrk�urllib.parserY�wsgiref.handlersr�platformrr}�__all__rV�versionr�sys_versionr"rrrr	r
r�httpd�socket�getsockname�sar��
webbrowser�open�handle_requestrr%r�<module>r�s��
�;�
��*�*���
I����,��#�%��+�c�k�k�.?�.?�.A�!�.D�D��!�C�'�+�5��
&�M�
&�'��'�:;+�/�;+�~	/�#-�<N���z��	�R��x�	(�E�
�\�\�
%�
%�
'��
���A����1��u�=�����7�8�
����
)�	(��	(�	(�s
�AC2�2
D

?>