| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/tornado/__pycache__/ |
Upload File : |
�
��b" � �� � d Z ddlZddlmZ ddlZddlmZ ddlmZ ddlmZ ddl m
Z
mZmZm
Z
mZmZmZ ddlmZ ddl Z e j rdd l mZ dd
lmZ dedefd
�Z G d� de� � Zej ZdS )a WSGI support for the Tornado web framework.
WSGI is the Python standard for web servers, and allows for interoperability
between Tornado and other Python web frameworks and servers.
This module provides WSGI support via the `WSGIContainer` class, which
makes it possible to run applications using other WSGI frameworks on
the Tornado HTTP server. The reverse is not supported; the Tornado
`.Application` and `.RequestHandler` classes are designed for use with
the Tornado `.HTTPServer` and cannot be used in a generic WSGI
container.
� N)�BytesIO)�escape)�httputil)�
access_log)�List�Tuple�Optional�Callable�Any�Dict�Text)�
TracebackType)�Type)�WSGIApplication�s�returnc �Z � t | t � � sJ �| � d� � S )N�latin1)�
isinstance�bytes�decode)r s �./usr/lib/python3/dist-packages/tornado/wsgi.py�to_wsgi_strr 3 s* � ��a��������8�8�H���� c � � e Zd ZdZdd�Zdej ddfd�Zedej de e
ef fd �� � Zd
e
dej ddfd�ZdS )
�
WSGIContainera� Makes a WSGI-compatible function runnable on Tornado's HTTP server.
.. warning::
WSGI is a *synchronous* interface, while Tornado's concurrency model
is based on single-threaded asynchronous execution. This means that
running a WSGI app with Tornado's `WSGIContainer` is *less scalable*
than running the same app in a multi-threaded WSGI server like
``gunicorn`` or ``uwsgi``. Use `WSGIContainer` only when there are
benefits to combining Tornado and WSGI in the same process that
outweigh the reduced scalability.
Wrap a WSGI function in a `WSGIContainer` and pass it to `.HTTPServer` to
run it. For example::
def simple_app(environ, start_response):
status = "200 OK"
response_headers = [("Content-type", "text/plain")]
start_response(status, response_headers)
return [b"Hello world!\n"]
async def main():
container = tornado.wsgi.WSGIContainer(simple_app)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen(8888)
await asyncio.Event().wait()
asyncio.run(main())
This class is intended to let other frameworks (Django, web.py, etc)
run on the Tornado HTTP server and I/O loop.
The `tornado.web.FallbackHandler` class is often useful for mixing
Tornado and WSGI apps in the same server. See
https://github.com/bdarnell/django-tornado-demo for a complete example.
�wsgi_application�WSGIAppTyper Nc � � || _ d S �N)r )�selfr s r �__init__zWSGIContainer.__init__^ s � � 0����r �requestc � ��� i �g � ddt dt t t t f dt t dt t t t
f dt t gt f f��fd�
}| � t � |� � |� � } �� |� � d�
�� � }t |d� � r|� � � n*# t |d� � r|� � � w w xY w�st! d � � ��d � d
d� � \ }}t% |� � }�d }t'