� ���g���P�ddlZddlmZGd�d��ZGd�de��ZdS)�N)�get_static_filec�*�eZdZdZ dd�Zd�Zd�ZdS)�WSGIAppa�WSGI application middleware for Engine.IO. This middleware dispatches traffic to an Engine.IO application. It can also serve a list of static files to the client, or forward unrelated HTTP traffic to another WSGI application. :param engineio_app: The Engine.IO server. Must be an instance of the ``engineio.Server`` class. :param wsgi_app: The WSGI app that receives all other traffic. :param static_files: A dictionary with static file mapping rules. See the documentation for details on this argument. :param engineio_path: The endpoint where the Engine.IO application should be installed. The default value is appropriate for most cases. Example usage:: import engineio import eventlet eio = engineio.Server() app = engineio.WSGIApp(eio, static_files={ '/': {'content_type': 'text/html', 'filename': 'index.html'}, '/index.html': {'content_type': 'text/html', 'filename': 'index.html'}, }) eventlet.wsgi.server(eventlet.listen(('', 8000)), app) N� engine.ioc���||_||_||_|j�d��sd|jz|_|j�d��s|xjdz c_|pi|_dS)N�/)� engineio_app�wsgi_app� engineio_path� startswith�endswith� static_files)�selfr r rr s �c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/engineio/middleware.py�__init__zWSGIApp.__init__"s���(��� �� �*����!�,�,�S�1�1� :�!$�t�'9�!9�D� ��!�*�*�3�/�/� &� � � �#� %� � �(�.�B�����c�j�d|vr!Gd�d��}||d��|d<|d}|�5|�|j��r|j�||��S|jrt ||j��nd}|r~t j�|d��rY|dd|d fg��t|dd ��5}|� ��gcddd��S#1swxYwYn|j �|� ||��S|� |��S) Nzgunicorn.socketc��eZdZd�Zd�ZdS)�WSGIApp.__call__.<locals>.Inputc��||_dS�N��socket)rrs rrz(WSGIApp.__call__.<locals>.Input.__init__6s ��"(�D�K�K�Krc��|jSrr)rs r� get_socketz*WSGIApp.__call__.<locals>.Input.get_socket9s ���;�&rN)�__name__� __module__� __qualname__rr�rr�Inputr5s2������)�)�)�'�'�'�'�'rr zeventlet.input� PATH_INFO�filenamez200 OK� Content-Type� content_type�rb) r r r �handle_requestrr�os�path�exists�open�readr � not_found)r�environ�start_responser r(� static_file�fs r�__call__zWSGIApp.__call__-s��� �� '� '� '� '� '� '� '� '� '� '�).��g�6G�.H�(I�(I�G�$� %��{�#�� � �����0B� C� C� ��$�3�3�G�^�L�L� L��$�/�/�$��0A�B�B�B�*.� �� >�r�w�~�~�k�*�.E�F�F� >����$�k�.�&A�B�C�E�E�E��+�j�1�4�8�8�&�A��F�F�H�H�:�&�&�&�&�&�&�&�&�&�&�&�&����&�&�&�&�&���*��}�}�W�n�=�=�=��~�~�n�-�-�-s�C7�7C;�>C;c�"�|ddg��dgS)Nz 404 Not Found)r#z text/plains Not Foundr)rr.s rr,zWSGIApp.not_foundMs �����)G�(H�I�I�I��~�r)NNr)rrr�__doc__rr1r,rrrrrs[��������8BF�*� /� /� /� /�.�.�.�@����rrc�(��eZdZdZ d�fd� Z�xZS)� MiddlewarezAThis class has been renamed to ``WSGIApp`` and is now deprecated.Nrc�P��t���|||���dS)N)r )�superr)rr r r � __class__s �rrzMiddleware.__init__Ts(��� ������x�}��M�M�M�M�Mr)Nr)rrrr3r� __classcell__)r8s@rr5r5RsS�������K�K�.2�*�N�N�N�N�N�N�N�N�N�Nrr5)r'�engineio.static_filesrrr5rrr�<module>r;s��� � � � �1�1�1�1�1�1�J�J�J�J�J�J�J�J�ZN�N�N�N�N��N�N�N�N�Nr
Memory