
    i                     B    S SK r S SKJr   " S S5      r " S S\5      rg)    N)get_static_filec                   2    \ rS rSrSr  SS jrS rS rSrg)	WSGIApp   aO  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)
Nc                    Xl         X l        X@l        U R                  R                  S5      (       d  SU R                  -   U l        U R                  R	                  S5      (       d  U =R                  S-  sl        U=(       d    0 U l        g )N/)engineio_appwsgi_appengineio_path
startswithendswithstatic_files)selfr	   r
   r   r   s        P/home/admin/cozy_coffee/venv/lib/python3.13/site-packages/engineio/middleware.py__init__WSGIApp.__init__"   sr    ( *!!,,S11!$t'9'9!9D!!**3//#%(.B    c                 b   SU;   a   " S S5      nU" US   5      US'   US   nUb;  UR                  U R                  5      (       a  U R                  R                  X5      $ U R                  (       a  [        X@R                  5      OS nU(       a`  [        R                  R                  US   5      (       a9  U" SSUS	   4/5        [        US   S
5       nUR                  5       /sS S S 5        $ U R                  b  U R                  X5      $ U R                  U5      $ ! , (       d  f       N= f)Nzgunicorn.socketc                        \ rS rSrS rS rSrg)WSGIApp.__call__.<locals>.Input5   c                     Xl         g Nsocket)r   r   s     r   r   (WSGIApp.__call__.<locals>.Input.__init__6   s    "(Kr   c                     U R                   $ r   r   )r   s    r   
get_socket*WSGIApp.__call__.<locals>.Input.get_socket9   s    ;;&r   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__ r   r   Inputr   5   s    )'r   r&   zeventlet.input	PATH_INFOfilenamez200 OKContent-Typecontent_typerb)r   r   r	   handle_requestr   r   ospathexistsopenreadr
   	not_found)r   environstart_responser&   r.   static_filefs          r   __call__WSGIApp.__call__-   s   '' ' ).g6G.H(IG$%{#0B0B C C$$33GLL $$ *$0A0AB*. rww~~k*.EFF$k.&ABCE +j148AFFH: 98*}}W==~~n--	 98s   D  
D.c                     U" SS/5        S/$ )Nz404 Not Found)r)   z
text/plains	   Not Foundr%   )r   r4   s     r   r2   WSGIApp.not_foundM   s    )G(HI~r   )r	   r   r   r
   )NN	engine.io)	r    r!   r"   r#   __doc__r   r7   r2   r$   r%   r   r   r   r      s!    8 BF*	/.@r   r   c                   4   ^  \ rS rSrSr  SU 4S jjrSrU =r$ )
MiddlewareR   zAThis class has been renamed to ``WSGIApp`` and is now deprecated.c                 "   > [         TU ]  XUS9  g )N)r   )superr   )r   r	   r
   r   	__class__s       r   r   Middleware.__init__T   s    }Mr   r%   )Nr;   )r    r!   r"   r#   r<   r   r$   __classcell__)rB   s   @r   r>   r>   R   s    K.2*N Nr   r>   )r-   engineio.static_filesr   r   r>   r%   r   r   <module>rF      s&    	 1J JZN Nr   