File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/__pycache__/web.cpython-310.pyc
o
�N�g�� � @ s� d Z ddlmZmZmZ ddlZddlZddlZddlZ ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZ ddlmZ ddlZddlm Z ddlm!Z! ddlm"Z" dd lm#Z# dd
lm$Z$ ddlm%Z% ddl&m'Z'm(Z(m)Z) dd
lm*Z* ddlm+Z+ ddl,m-Z-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z< e6Z=e<r�ddl>m?Z@ ddlAmBZC ddlAmDZD nddl@Z@ddlCZCddlEmDZD zddlFZFeFjGeHe:ejIejf ZJW n
eK�y Y nw dZL dZM dZN dZO G dd� deP�ZQdd� ZRdd� ZSdd� ZTdd� ZUdd � ZVG d!d"� d"e5�ZWG d#d$� d$e3�ZXG d%d&� d&e#jY�ZZG d'd(� d(e[�Z\G d)d*� d*e[�Z]G d+d,� d,e\�Z^G d-d.� d.eQ�Z_G d/d0� d0eQ�Z`G d1d2� d2eQ�ZaG d3d4� d4eQ�ZbG d5d6� d6eP�ZcG d7d8� d8ec�Zdd9d:� ZeG d;d<� d<eP�ZfG d=d>� d>ef�ZgG d?d@� d@ef�ZhG dAdB� dBef�ZiG dCdD� dDeP�Zjeke
dE��r�e
jlZmndFdG� Zm d^dHdI�Zne�odJ�ZpdKdL� Zq M d_dNdO�ZrdPdQ� ZsdRdS� ZtdTdU� ZudVdW� ZvdXdY� ZwdZd[� Zxd\d]� ZydS )`a� ``tornado.web`` provides a simple web framework with asynchronous
features that allow it to scale to large numbers of open connections,
making it ideal for `long polling
<http://en.wikipedia.org/wiki/Push_technology#Long_polling>`_.
Here is a simple "Hello, world" example app:
.. testcode::
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
if __name__ == "__main__":
application = tornado.web.Application([
(r"/", MainHandler),
])
application.listen(8888)
tornado.ioloop.IOLoop.current().start()
.. testoutput::
:hide:
See the :doc:`guide` for additional information.
Thread-safety notes
-------------------
In general, methods on `RequestHandler` and elsewhere in Tornado are
not thread-safe. In particular, methods such as
`~RequestHandler.write()`, `~RequestHandler.finish()`, and
`~RequestHandler.flush()` must only be called from the main thread. If
you use multiple threads it is important to use `.IOLoop.add_callback`
to transfer control back to the main thread before finishing the
request.
� )�absolute_import�division�print_functionN)�isclass)�BytesIO)�Future)�escape)�gen)�httputil)�iostream)�locale)�
access_log�app_log�gen_log)�
stack_context)�template)�utf8�_unicode)�
AnyMatches�DefaultHostMatches�HostMatches�ReversibleRouter�Rule�ReversibleRuleRouter�URLSpec)�
ObjectDict�raise_exc_info�unicode_type�_websocket_mask�PY3)� urlencode� � c sN e Zd ZdZdZi Ze�� Ze �
d�Z� fdd�Zdd� Z
edd � �Zd
d� Zdd
� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd�d#d$�Zd%d&� Zd'd(� Zd)d*� Zd+d,� Z e �
d-�Z!d.d/� Z"e#� Z$e$d0fd1d2�Z%d�d3d4�Z&e$d0fd5d6�Z'd�d7d8�Z(e$d0fd9d:�Z)d�d;d<�Z*d�d=d>�Z+d�d?d@�Z,d�dAdB�Z-edCdD� �Z.d�dEdF�Z/ G "d�dHdI�Z0d�dJdK�Z1d�dLdM�Z2d�dOdP�Z3d�dQdR�Z4 S "d�dTdU�Z5d�dVdW�Z6d�dYdZ�Z7d[d\� Z8d]d^� Z9d_d`� Z:dadb� Z;dcdd� Z<dedf� Z=dgdh� Z>didj� Z?dkdl� Z@d�dmdn�ZAd�dodp�ZBdqdr� ZCd�dtdu�ZDdvdw� ZEedxdy� �ZFeFjGdzdy� �ZFd{d|� ZHd�d~d�ZIed�d�� �ZJeJjGd�d�� �ZJd�d�� ZKd�d�� ZLd�d�� ZMed�d�� �ZNd�d�� ZOd�d�� ZPd�d�� ZQd�d�� ZRd�d�d��ZSd�d�d��ZTd�d�� ZUd�d�� ZVd�d�� ZWd�d�� ZXd�d�� ZYeZj[d�d�� �Z\d�d�� Z]d�d�� Z^d�d�� Z_d�d�� Z`d�d�� Zad�d�� Zbd�d�� Zcd�d�� Zd� ZeS )��RequestHandlerz�Base class for HTTP request handlers.
Subclasses must define at least one of the methods defined in the
"Entry points" section below.
)�GET�HEAD�POSTZDELETE�PATCH�PUT�OPTIONSz[\x00-\x08\x0e-\x1f]c s� t t� ��� |� _|� _d� _d� _d� _d � _d � _ d � _
d � _d � _t
� fdd�|j�� D ��� _t� |j�� jd<