ó
    <ÕÎiá4 ã                   óv  • S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
rSSKJr  SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSK J!r!J"r"  SSKJ#r#  SSKJ$r$  SS	K%J&r&  SS
KJ'r'  SSKJ(r(  SSKJ)r)  SSK*J+r+J,r,J-r-  SSKJ.r.  SSK/J0r0J1r1  SSK2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:  SSK;J<r<J=r=J>r>  \9r?SSK@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrN  SSKJOrO  SSK@r@\@R                   (       a  SSK@JQrQ  \C\R\=\S\R¨                  \R                  4   rU\C\V\R\A\S\V4   \A\S\R4   4   rWSrX SrY SrZ Sr[  " S S5      r\\\" 5       r]\R¼                  " S5      r_ " S S\`5      ra\L" S\aS9rbS\K\b   S\K\b   4S  jrcS\K\a   S\d4S! jreS"\HS#\D\ES      4   S\HS#\D\ES      4   4S$ jrfS"\HS#\D\ES      4   S\HS#\D\ES      4   4S% jrg " S& S'\85      rh " S( S)\65      ri " S* S+\'RÔ                  5      rk " S, S-\l5      rm " S. S/\l5      rn " S0 S1\m5      ro " S2 S3\a5      rp " S4 S5\a5      rq " S6 S7\a5      rr " S8 S9\a5      rs " S: S;\`5      rt " S< S=\t5      ruS"\HS#\D\ES      4   S\HS#\D\ES      4   4S> jrv " S? S@\`5      rw " SA SB\w5      rx " SC SD\w5      ry " SE SF\w5      rz " SG SH\`5      r{   S_SI\WSJ\VSK\C\V\R4   SL\D\S   SM\D\H/ \|4      SN\D\S   S\R4SO jjr}\R¼                  " SP5      r~SK\RS\S4SQ jr   S`SI\WSJ\VSK\CS\V\R4   SR\|SM\D\H/ \|4      SS\D\S   S\D\R   4ST jjr€SI\C\V\R4   SJ\VSK\RSR\|SM\H/ \|4   S\D\R   4SU jr�SK\RS\F\S\R\R\R\R4   4SV jr‚SI\WSJ\VSK\RSR\|SM\H/ \|4   S\D\R   4SW jrƒSK\C\V\R4   S\D\S   4SX jr„SI\C\V\R4   SY\C\V\R4   S\R4SZ jr…SI\C\V\R4   S[\RS\R4S\ jr†S]\VS\d4S^ jr‡g)aaP  ``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 asyncio
    import tornado

    class MainHandler(tornado.web.RequestHandler):
        def get(self):
            self.write("Hello, world")

    async def main():
        application = tornado.web.Application([
            (r"/", MainHandler),
        ])
        application.listen(8888)
        await asyncio.Event().wait()

    if __name__ == "__main__":
        asyncio.run(main())

.. 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, or to limit your use of other threads to
`.IOLoop.run_in_executor` and ensure that your callbacks running in
the executor do not refer to Tornado objects.

é    N)Úisclass)ÚBytesIO)Ú	urlencode)ÚFutureÚ"future_set_result_unless_cancelled)Úescape)Úgen)Ú
HTTPServer)Úhttputil)Úiostream)Úlocale)Ú
access_logÚapp_logÚgen_log)Útemplate)Úutf8Ú_unicode)Ú
AnyMatchesÚDefaultHostMatchesÚHostMatchesÚReversibleRouterÚRuleÚReversibleRuleRouterÚURLSpecÚ	_RuleList)Ú
ObjectDictÚunicode_typeÚ_websocket_mask)ÚDictÚAnyÚUnionÚOptionalÚ	AwaitableÚTupleÚListÚCallableÚIterableÚ	GeneratorÚTypeÚTypeVarÚcastÚoverload)ÚTracebackType)ÚSeté   é   c                   ó   • \ rS rSrSrg)Ú_ArgDefaultMarkeré°   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r4   ó    Ú-/usr/lib/python3/dist-packages/tornado/web.pyr2   r2   °   s   † Úr:   r2   z"(?:[\t ]|[\x21-\x7E]|[\x80-\xFF])+c                   ó@  ^ • \ rS rSrSrSr0 r\R                  " 5       r	\
R                  " S5      rSrSrSrSrSSS	\R$                  S
\SS4U 4S jjrS�S jr\r \S\\\4   4S j5       rS\S
\SS4S jr\r\r\r\r\r \r!\r"S\#\$S      4S jr%S�S jr&S�S jr'S�S jr(S�S jr)SŽS\*S\#\   SS4S jjr+S\*4S jr,S\S\-SS4S jr.S\S\-SS4S jr/S\SS4S jr0\
R                  " S5      r1S\-S\4S  jr2\3S�S\S"\S#\4S\4S$ jj5       r5\3\6S!4S\S"\7S#\4S\4S% jj5       r5\3 S�S\S"SS#\4S\#\   4S& jj5       r5\6S!4S\S"\8S\\74   S#\4S\#\   4S' jjr5S�S\S#\4S\9\   4S( jjr:\6S!4S\S"\8S\\74   S#\4S\#\   4S) jjr;S�S\S#\4S\9\   4S* jjr<\6S!4S\S"\8S\\74   S#\4S\#\   4S+ jjr=S�S\S#\4S\9\   4S, jjr> S�S\S"\8S\\74   S-\\\9\?   4   S#\4S\#\   4
S. jjr@ S�S\S-\\\9\?   4   S#\4S\9\   4S/ jjrASŽS\?S\#\   S\4S0 jjrB\S\\\CRˆ                  RŠ                  4   4S1 j5       rDSŽS\S"\#\   S\#\   4S2 jjrF    S�SSSSS3.S\S\8\\?4   S4\#\   S5\#\8\G\H\IR’                  4      S6\S7\#\G   S8\#\*   S9\4S:\4S;\#\   S
\SS4S< jjjrJS\S
\SS4S= jrKS
\SS4S> jrL  S‘S\S\8\\?4   S7\#\G   S?\#\*   S
\SS4S@ jjrM\MrN SŽS\S\8\\?4   S?\#\*   S\?4SA jjrO   S’S\S\#\   SB\GSC\#\*   S\#\?   4
SD jjrP\PrQ SŽS\S\#\   S\#\*   4SE jjrR\RrS S“SF\SG\4SH\#\*   SS4SI jjrTSJ\8\\?\U4   SS4SK jrVSL\S
\SSM4SN jrWSO\X\   S\4SP jrYSQ\X\?   S\?4SR jrZSS\X\   S\4ST jr[SU\X\?   S\?4SV jr\SL\S
\S\?4SW jr]S\\\4   4SX jr^SY\S\_RÀ                  4SZ jraS”S[\4SSM4S\ jjrbSŽSJ\#\8\\?\U4      SSM4S] jjrcS\dRÊ                  4S^ jrfS�S_ jrgS•S\*S
\SS4S` jjrhS\*S
\SS4Sa jri\S\jRÖ                  RØ                  4Sb j5       rk\kRÚ                  S\jRÖ                  RØ                  SS4Sc j5       rkS\#\jRÖ                  RØ                     4Sd jrnS–S"\S\jRÖ                  RØ                  4Se jjro\S\4Sf j5       rp\pRÚ                  S\SS4Sg j5       rpS\4Sh jrqS\4Si jrrS\#\   4Sj jrs\S\?4Sk j5       rtS\H\#\*   \?\G4   4Sl jruSm\S\H\#\*   \#\?   \#\G   4   4Sn jrvS�So jrwS\4Sp jrx SŽS6\Sq\#\4   S
\S\4Sr jjryS—S\Ss\SS4St jjrzS\S\S\4Su jr{S\#\   4Sv jr|S�Sw jr}S\44Sx jr~Sy\9Sz   S\?S
\?SS4S{ jrSJ\?S\#\$S      4S| jr€S�S} jr�S\4S~ jr‚S\ƒSS4S€ jr„S�S‚S\#\ƒ   Sƒ\#\…   SS4S„ jr†S\S…\‡S†   S\ˆS‡\4   4Sˆ jr‰S‰\ˆS‡\4   S\ˆS‡\4   4SŠ jrŠS�S‹ jr‹SŒrŒU =r�$ )˜ÚRequestHandleréº   a.  Base class for HTTP request handlers.

Subclasses must define at least one of the methods defined in the
"Entry points" section below.

Applications should not construct `RequestHandler` objects
directly and subclasses should not override ``__init__`` (override
`~RequestHandler.initialize` instead).

)ÚGETÚHEADÚPOSTÚDELETEÚPATCHÚPUTÚOPTIONSz[\x00-\x08\x0e-\x1f]FNÚapplicationÚApplicationÚrequestÚkwargsÚreturnc                 ó.  >^ • [         TT ]  5         UT l        UT l        ST l        ST l        ST l        S T l        [        U 4S jUR                  R                  5        5       5      T l        [        T UR                  5      T R                  S'   T R                  S   T R                  S'   T R                  5         T R                  R                  c   eT R                  R                  R!                  T R"                  5        T R$                  " S0 UD6  g )NFTc              3   óN   >#   • U  H  u  pUTR                  U5      4v •  M     g 7f©N)Ú
_ui_method)Ú.0ÚnÚmÚselfs      €r;   Ú	<genexpr>Ú*RequestHandler.__init__.<locals>.<genexpr>á   s%   øé € ð 
Ú0N©¨ˆQ�—‘ Ó"Õ#Ò0Nùs   ƒ"%Ú_tt_modulesÚmodulesr4   )ÚsuperÚ__init__rF   rH   Ú_headers_writtenÚ	_finishedÚ_auto_finishÚ_prepared_futurer   Ú
ui_methodsÚitemsÚuiÚ_UIModuleNamespaceÚ
ui_modulesÚclearÚ
connectionÚset_close_callbackÚon_connection_closeÚ
initialize)rR   rF   rH   rI   Ú	__class__s   `   €r;   rX   ÚRequestHandler.__init__Ó   së   ù€ ô 	‰ÑÔà&ˆÔØˆŒØ %ˆÔØˆŒØ ˆÔØ $ˆÔÜô 
Ø0;×0FÑ0F×0LÑ0LÔ0Nó
ó 
ˆŒô "4°D¸+×:PÑ:PÓ!Qˆ�‰�ÑØ!ŸW™W ]Ñ3ˆ�‰�	ÑØ�
‰
ŒØ�|‰|×&Ñ&Ñ2Ð2Ð2à�‰×Ñ×2Ñ2Ø×$Ñ$ô	
ð 	�ŠÑ!˜&Ó!r:   c                 ó   • g rM   r4   ©rR   s    r;   Ú_initializeÚRequestHandler._initializeó   ó   € Ør:   c                 ó.   • U R                   R                  $ )z@An alias for `self.application.settings <Application.settings>`.)rF   Úsettingsrj   s    r;   ro   ÚRequestHandler.settings
  s   € ð ×Ñ×(Ñ(Ð(r:   Úargsc                 ó   • [        S5      e)Né•  )Ú	HTTPError©rR   rq   rI   s      r;   Ú_unimplemented_methodÚ$RequestHandler._unimplemented_method  s   € Ü˜‹nÐr:   c                 ó   • g)a�  Called at the beginning of a request before  `get`/`post`/etc.

Override this method to perform common initialization regardless
of the request method.

Asynchronous support: Use ``async def`` or decorate this method with
`.gen.coroutine` to make it asynchronous.
If this method returns an  ``Awaitable`` execution will not proceed
until the ``Awaitable`` is done.

.. versionadded:: 3.1
   Asynchronous support.
Nr4   rj   s    r;   ÚprepareÚRequestHandler.prepare  s   € ð 	r:   c                 ó   • g)zñCalled after the end of a request.

Override this method to perform cleanup, logging, etc.
This method is a counterpart to `prepare`.  ``on_finish`` may
not produce any output, as it is called after the response
has been sent to the client.
Nr4   rj   s    r;   Ú	on_finishÚRequestHandler.on_finish*  ó   € ð 	r:   c                 óF  • [        U R                  5      (       a‡  U R                  R                  R	                  5       (       d]  U R                  R                  R                  [        R                  " 5       5        U R                  R                  R                  5         ggg)aö  Called in async handlers if the client closed the connection.

Override this to clean up resources associated with
long-lived connections.  Note that this method is called only if
the connection was closed during asynchronous processing; if you
need to do cleanup after every request override `on_finish`
instead.

Proxies may keep a connection open for a time (perhaps
indefinitely) after the client has gone away, so this method
may not be called promptly after the end user closes their
connection.
N)	Ú_has_stream_request_bodyrg   rH   Ú_body_futureÚdoneÚset_exceptionr   ÚStreamClosedErrorÚ	exceptionrj   s    r;   re   Ú"RequestHandler.on_connection_close4  sm   € ô $ D§N¡N×3Ñ3Ø—<‘<×,Ñ,×1Ñ1×3Ñ3Ø—‘×)Ñ)×7Ñ7¼×8RÒ8RÓ8TÔUØ—‘×)Ñ)×3Ñ3Õ5ð 4ð 4r:   c                 ó  • [         R                  " S[        R                  -  S[         R                  " [
        R
                  " 5       5      S.5      U l        U R                  5         / U l        SU l	        [         R                  S   U l        g)z1Resets all headers and content for this response.zTornadoServer/%sztext/html; charset=UTF-8)ÚServerúContent-TypeÚDateéÈ   N)r   ÚHTTPHeadersÚtornadoÚversionÚformat_timestampÚtimeÚ_headersÚset_default_headersÚ_write_bufferÚ_status_codeÚ	responsesÚ_reasonrj   s    r;   rb   ÚRequestHandler.clearG  sl   € ä ×,Ò,à,¬w¯©Ñ>Ø :Ü ×1Ò1´$·)²)³+Ó>ñó
ˆŒð 	× Ñ Ô"ØˆÔØˆÔÜ×)Ñ)¨#Ñ.ˆ�r:   c                 ó   • g)a  Override this to set HTTP headers at the beginning of the request.

For example, this is the place to set a custom ``Server`` header.
Note that setting such headers in the normal flow of request
processing may not do what you want, since headers may be reset
during error handling.
Nr4   rj   s    r;   r’   Ú"RequestHandler.set_default_headersU  r~   r:   Ústatus_codeÚreasonc                 óÜ   • Xl         Ub>  SU;   d  [        R                  U5      (       d  Sn[        R                  " U5      U l        g[        R                  R                  US5      U l        g)aæ  Sets the status code for our response.

:arg int status_code: Response status code.
:arg str reason: Human-readable reason phrase describing the status
    code (for example, the "Not Found" in ``HTTP/1.1 404 Not Found``).
    Normally determined automatically from `http.client.responses`; this
    argument should only be used if you need to use a non-standard
    status code.

.. versionchanged:: 5.0

   No longer validates that the response code is in
   `http.client.responses`.
NÚ<ÚUnknown)	r”   Úreason_phrase_reÚ	fullmatchr   Ú
native_strr–   r   r•   Úget)rR   rš   r›   s      r;   Ú
set_statusÚRequestHandler.set_status_  s[   € ð (ÔØÑØ�f‹}Ô$4×$>Ñ$>¸v×$FÑ$Fð #�Ü!×,Ò,¨VÓ4ˆD�Lä#×-Ñ-×1Ñ1°+¸yÓIˆD�Lr:   c                 ó   • U R                   $ )z)Returns the status code for our response.)r”   rj   s    r;   Ú
get_statusÚRequestHandler.get_status|  s   € à× Ñ Ð r:   ÚnameÚvaluec                 ó@   • U R                  U5      U R                  U'   g)z¼Sets the given response header name and value.

All header values are converted to strings (`datetime` objects
are formatted according to the HTTP specification for the
``Date`` header).

N)Ú_convert_header_valuer‘   ©rR   r¨   r©   s      r;   Ú
set_headerÚRequestHandler.set_header€  s   € ð #×8Ñ8¸Ó?ˆ�‰�dÒr:   c                 óX   • U R                   R                  XR                  U5      5        g)z™Adds the given response header and value.

Unlike `set_header`, `add_header` may be called multiple times
to return multiple values for the same header.
N)r‘   Úaddr«   r¬   s      r;   Ú
add_headerÚRequestHandler.add_headerŠ  s!   € ð 	�‰×Ñ˜$× :Ñ :¸5Ó AÕBr:   c                 ó>   • XR                   ;   a  U R                   U	 gg)z”Clears an outgoing header, undoing a previous `set_header` call.

Note that this method does not apply to multi-valued headers
set by `add_header`.
N)r‘   )rR   r¨   s     r;   Úclear_headerÚRequestHandler.clear_header’  s   € ð —=‘=Ó Ø—‘˜dÑ#ð !r:   z[\x00-\x1f]c                 ó¾  • [        U[        5      (       a  UnO”[        U[        5      (       a  UR                  S5      nOm[        U[        R
                  5      (       a  [        U5      $ [        U[        R                  5      (       a  [        R                  " U5      $ [        SU-  5      e[        R                  R                  U5      (       a  [        SU5      eU$ )NÚlatin1zUnsupported header value %rzUnsafe header value %r)Ú
isinstanceÚstrÚbytesÚdecodeÚnumbersÚIntegralÚdatetimer   r�   Ú	TypeErrorr=   Ú_INVALID_HEADER_CHAR_REÚsearchÚ
ValueError)rR   r©   Úretvals      r;   r«   Ú$RequestHandler._convert_header_value�  s±   € ô
 �eœS×!Ñ!Ø‰FÜ˜œu×%Ñ%ð —\‘\ (Ó+‰FÜ˜œw×/Ñ/×0Ñ0ä�u“:ÐÜ˜œx×0Ñ0×1Ñ1Ü×,Ò,¨UÓ3Ð3äÐ9¸EÑAÓBÐBô ×1Ñ1×8Ñ8¸×@Ñ@ÜÐ5°vÓ>Ð>Øˆr:   TÚdefaultÚstripc                 ó   • g rM   r4   ©rR   r¨   rÅ   rÆ   s       r;   Úget_argumentÚRequestHandler.get_argumentµ  ó   € àr:   c                 ó   • g rM   r4   rÈ   s       r;   rÉ   rÊ   ¹  ó   € ð 	r:   c                 ó   • g rM   r4   rÈ   s       r;   rÉ   rÊ   ¿  rÍ   r:   c                 óP   • U R                  XU R                  R                  U5      $ )aB  Returns the value of the argument with the given name.

If default is not provided, the argument is considered to be
required, and we raise a `MissingArgumentError` if it is missing.

If the argument appears in the request more than once, we return the
last value.

This method searches both the query and body arguments.
)Ú_get_argumentrH   Ú	argumentsrÈ   s       r;   rÉ   rÊ   Å  s#   € ð  ×!Ñ! $°·±×1GÑ1GÈÓOÐOr:   c                 ó|   • [        U[        5      (       d   eU R                  XR                  R                  U5      $ )z¦Returns a list of the arguments with the given name.

If the argument is not present, returns an empty list.

This method searches both the query and body arguments.
)r¸   ÚboolÚ_get_argumentsrH   rÑ   ©rR   r¨   rÆ   s      r;   Úget_argumentsÚRequestHandler.get_arguments×  s4   € ô ˜%¤×&Ñ&Ð&Ð&à×"Ñ" 4¯©×)?Ñ)?ÀÓGÐGr:   c                 óP   • U R                  XU R                  R                  U5      $ )a2  Returns the value of the argument with the given name
from the request body.

If default is not provided, the argument is considered to be
required, and we raise a `MissingArgumentError` if it is missing.

If the argument appears in the url more than once, we return the
last value.

.. versionadded:: 3.2
)rÐ   rH   Úbody_argumentsrÈ   s       r;   Úget_body_argumentÚ RequestHandler.get_body_argumentæ  s#   € ð" ×!Ñ! $°·±×1LÑ1LÈeÓTÐTr:   c                 óN   • U R                  XR                  R                  U5      $ )z‰Returns a list of the body arguments with the given name.

If the argument is not present, returns an empty list.

.. versionadded:: 3.2
)rÔ   rH   rÙ   rÕ   s      r;   Úget_body_argumentsÚ!RequestHandler.get_body_argumentsù  s!   € ð ×"Ñ" 4¯©×)DÑ)DÀeÓLÐLr:   c                 óP   • U R                  XU R                  R                  U5      $ )a:  Returns the value of the argument with the given name
from the request query string.

If default is not provided, the argument is considered to be
required, and we raise a `MissingArgumentError` if it is missing.

If the argument appears in the url more than once, we return the
last value.

.. versionadded:: 3.2
)rÐ   rH   Úquery_argumentsrÈ   s       r;   Úget_query_argumentÚ!RequestHandler.get_query_argument  s#   € ð" ×!Ñ! $°·±×1MÑ1MÈuÓUÐUr:   c                 óN   • U R                  XR                  R                  U5      $ )zŠReturns a list of the query arguments with the given name.

If the argument is not present, returns an empty list.

.. versionadded:: 3.2
)rÔ   rH   rà   rÕ   s      r;   Úget_query_argumentsÚ"RequestHandler.get_query_arguments  s!   € ð ×"Ñ" 4¯©×)EÑ)EÀuÓMÐMr:   Úsourcec                 ó~   • U R                  XUS9nU(       d"  [        U[        5      (       a  [        U5      eU$ US   $ )N)rÆ   éÿÿÿÿ)rÔ   r¸   r2   ÚMissingArgumentError)rR   r¨   rÅ   ræ   rÆ   rq   s         r;   rÐ   ÚRequestHandler._get_argument  sC   € ð ×"Ñ" 4°uÐ"Ð=ˆÞÜ˜'Ô#4×5Ñ5Ü*¨4Ó0Ð0ØˆNØ�B‰xˆr:   c                 ó  • / nUR                  U/ 5       Ho  nU R                  XQS9n[        U[        5      (       a   [        R
                  R                  SU5      nU(       a  UR                  5       nUR                  U5        Mq     U$ )N©r¨   Ú )	r¢   Údecode_argumentr¸   r   r=   Ú_remove_control_chars_regexÚsubrÆ   Úappend)rR   r¨   ræ   rÆ   ÚvaluesÚvÚss          r;   rÔ   ÚRequestHandler._get_arguments,  sy   € ð ˆØ—‘˜D "Ö%ˆAØ×$Ñ$ QÐ$Ð2ˆAÜ˜!œ\×*Ñ*ô #×>Ñ>×BÑBÀ3ÈÓJ�ÞØ—G‘G“I�Ø�M‰M˜!Öñ &ð ˆr:   c           
      óv   •  [        U5      $ ! [         a!    [        SSU=(       d    S< SUSS < 35      ef = f)aÖ  Decodes an argument from the request.

The argument has been percent-decoded and is now a byte string.
By default, this method decodes the argument as utf-8 and returns
a unicode string, but this may be overridden in subclasses.

This method is used as a filter for both `get_argument()` and for
values extracted from the url and passed to `get()`/`post()`/etc.

The name of the argument is provided if known, but may be None
(e.g. for unnamed groups in the url regex).
é�  zInvalid unicode in Úurlú: Né(   )r   ÚUnicodeDecodeErrorrt   )rR   r©   r¨   s      r;   rî   ÚRequestHandler.decode_argument;  sC   € ð	Ü˜E“?Ð"øÜ!ó 	ÜÙ°D·M¸E²MÀ5ÈÈ"Â:ÐNóð ð	ús   ‚
 �+8c                 ó.   • U R                   R                  $ )zJAn alias for
`self.request.cookies <.httputil.HTTPServerRequest.cookies>`.)rH   Úcookiesrj   s    r;   rþ   ÚRequestHandler.cookiesO  s   € ð �|‰|×#Ñ#Ð#r:   c                 ó¬   • U R                   R                  b<  XR                   R                  ;   a#  U R                   R                  U   R                  $ U$ )a  Returns the value of the request cookie with the given name.

If the named cookie is not present, returns ``default``.

This method only returns cookies that were present in the request.
It does not see the outgoing cookies set by `set_cookie` in this
handler.
)rH   rþ   r©   )rR   r¨   rÅ   s      r;   Ú
get_cookieÚRequestHandler.get_cookieU  sC   € ð �<‰<×ÑÑ+°¿¹×8LÑ8LÓ0LØ—<‘<×'Ñ'¨Ñ-×3Ñ3Ð3Øˆr:   )Úmax_ageÚhttponlyÚsecureÚsamesiteÚdomainÚexpiresÚpathÚexpires_daysr  r  r  r  c                óÖ  • [         R                  " U5      n[         R                  " U5      n[        R                  " SX-   5      (       a  [	        SU< SU< 35      e[        U S5      (       d#  [        R                  R                  5       U l	        XR                  ;   a  U R                  U	 X R                  U'   U R                  U   nU(       a  X<S'   UbS  U(       dL  [        R                  R                  [        R                  R                  5      [        R                  " US9-   nU(       a  [        R                   " U5      US'   U(       a  X\S	'   U(       a  [#        U5      US
'   U(       a  SUS'   U	(       a  SUS'   U
(       a  X¬S'   U(       aT  UR%                  5        H	  u  pÞXìU'   M     [&        R(                  " S[+        UR-                  5       5       S3[.        5        gg)a  Sets an outgoing cookie name/value with the given options.

Newly-set cookies are not immediately visible via `get_cookie`;
they are not present until the next request.

Most arguments are passed directly to `http.cookies.Morsel` directly.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
for more information.

``expires`` may be a numeric timestamp as returned by `time.time`,
a time tuple as returned by `time.gmtime`, or a
`datetime.datetime` object. ``expires_days`` is provided as a convenience
to set an expiration time in days from today (if both are set, ``expires``
is used).

.. deprecated:: 6.3
   Keyword arguments are currently accepted case-insensitively.
   In Tornado 7.0 this will be changed to only accept lowercase
   arguments.
z[\x00-\x20]zInvalid cookie rù   Ú_new_cookier  N©Údaysr  r	  zmax-ageTr  r  r  z$Deprecated arguments to set_cookie: z (should be lowercase))r   r¡   ÚrerÁ   rÂ   ÚhasattrÚhttprþ   ÚSimpleCookier  r¾   ÚnowÚtimezoneÚutcÚ	timedeltar   r�   r¹   r^   ÚwarningsÚwarnÚsetÚkeysÚDeprecationWarning)rR   r¨   r©   r  r  r	  r
  r  r  r  r  rI   ÚmorselÚkró   s                  r;   Ú
set_cookieÚRequestHandler.set_cookieb  sž  € ôJ × Ò  Ó&ˆÜ×!Ò! %Ó(ˆÜ�9Š9�^ T¡\×2Ñ2å»ºeÐDÓEÐEÜ�t˜]×+Ñ+ä—‘×)Ñ)Ó+ð Ôð ×#Ñ#Ó#Ø× Ñ  Ð&Ø!&×Ñ˜ÑØ×!Ñ! $Ñ'ˆÞØ%�8ÑØÑ#®GÜ×'Ñ'×+Ñ+¬H×,=Ñ,=×,AÑ,AÓBÄX×EWÒEWØ!ñFñ ˆGö Ü (× 9Ò 9¸'Ó BˆF�9ÑÞØ!�6‰NÞä # G£ˆF�9ÑÞð "&ˆF�:ÑÞØ#ˆF�8ÑÞØ!)�:ÑÞð Ÿ™ž‘�Ø�q“	ñ 'ä�MŠMØ6´s¸6¿;¹;»=Ó7IÐ6Jð K(ð (ä"õð r:   c                 ó  • S H  nX2;   d  M
  [        SU S35      e   [        R                  R                  [        R                  R                  5      [        R
                  " SS9-
  nU R                  " U4SUS.UD6  g)	aƒ  Deletes the cookie with the given name.

This method accepts the same arguments as `set_cookie`, except for
``expires`` and ``max_age``. Clearing a cookie requires the same
``domain`` and ``path`` arguments as when it was set. In some cases the
``samesite`` and ``secure`` arguments are also required to match. Other
arguments are ignored.

Similar to `set_cookie`, the effect of this method will not be
seen until the following request.

.. versionchanged:: 6.3

   Now accepts all keyword arguments that ``set_cookie`` does.
   The ``samesite`` and ``secure`` flags have recently become
   required for clearing ``samesite="none"`` cookies.
)r  r  z3clear_cookie() got an unexpected keyword argument 'Ú'im  r  Ú )r©   r  N)r¿   r¾   r  r  r  r  r  )rR   r¨   rI   Úexcluded_argr  s        r;   Úclear_cookieÚRequestHandler.clear_cookieµ  s‚   € ó$ 3ˆLØÕ%ÜØIÈ,ÈÐWXÐYóð ñ 3ô
 ×#Ñ#×'Ñ'¬×(9Ñ(9×(=Ñ(=Ó>Ä×ASÒASØñB
ñ 
ˆð 	�Š˜ÐB B°ÑB¸6ÓBr:   c                 ód   • U R                   R                   H  nU R                  " U40 UD6  M     g)aÓ  Attempt to delete all the cookies the user sent with this request.

See `clear_cookie` for more information on keyword arguments. Due to
limitations of the cookie protocol, it is impossible to determine on the
server side which values are necessary for the ``domain``, ``path``,
``samesite``, or ``secure`` arguments, this method can only be
successful if you consistently use the same values for these arguments
when setting cookies.

Similar to `set_cookie`, the effect of this method will not be seen
until the following request.

.. versionchanged:: 3.2

   Added the ``path`` and ``domain`` parameters.

.. versionchanged:: 6.3

   Now accepts all keyword arguments that ``set_cookie`` does.

.. deprecated:: 6.3

   The increasingly complex rules governing cookies have made it
   impossible for a ``clear_all_cookies`` method to work reliably
   since all we know about cookies are their names. Applications
   should generally use ``clear_cookie`` one at a time instead.
N)rH   rþ   r$  )rR   rI   r¨   s      r;   Úclear_all_cookiesÚ RequestHandler.clear_all_cookiesÑ  s+   € ð8 —L‘L×(Ô(ˆDØ×Ò˜dÑ- fÔ-ò )r:   rŽ   c           	      óL   • U R                   " UU R                  XUS94SU0UD6  g)a-  Signs and timestamps a cookie so it cannot be forged.

You must specify the ``cookie_secret`` setting in your Application
to use this method. It should be a long, random sequence of bytes
to be used as the HMAC secret for the signature.

To read a cookie set with this method, use `get_signed_cookie()`.

Note that the ``expires_days`` parameter sets the lifetime of the
cookie in the browser, but is independent of the ``max_age_days``
parameter to `get_signed_cookie`.
A value of None limits the lifetime to the current browser session.

Secure cookies may contain arbitrary byte values, not just unicode
strings (unlike regular cookies)

Similar to `set_cookie`, the effect of this method will not be
seen until the following request.

.. versionchanged:: 3.2.1

   Added the ``version`` argument.  Introduced cookie version 2
   and made it the default.

.. versionchanged:: 6.3

   Renamed from ``set_secure_cookie`` to ``set_signed_cookie`` to
   avoid confusion with other uses of "secure" in cookie attributes
   and prefixes. The old name remains as an alias.
)rŽ   r
  N)r  Úcreate_signed_value)rR   r¨   r©   r
  rŽ   rI   s         r;   Úset_signed_cookieÚ RequestHandler.set_signed_cookieð  s;   € ðL 	�ŠØØ×$Ñ$ T¸'Ð$ÐBñ	
ð &ð	
ð ó		
r:   c                 ó0  • U R                  SS5        U R                  R                  S   nSn[        U[        5      (       aJ  U R                  R                  R                  S5      c  [        S5      eU R                  R                  S   n[        XAX#US9$ )ak  Signs and timestamps a string so it cannot be forged.

Normally used via set_signed_cookie, but provided as a separate
method for non-cookie uses.  To decode a value not stored
as a cookie use the optional value argument to get_signed_cookie.

.. versionchanged:: 3.2.1

   Added the ``version`` argument.  Introduced cookie version 2
   and made it the default.
Úcookie_secretúsecure cookiesNÚkey_versionz5key_version setting must be used for secret_key dicts)rŽ   r0  )Úrequire_settingrF   ro   r¸   Údictr¢   Ú	Exceptionr*  )rR   r¨   r©   rŽ   Úsecretr0  s         r;   r*  Ú"RequestHandler.create_signed_value  s�   € ð 	×Ñ˜_Ð.>Ô?Ø×!Ñ!×*Ñ*¨?Ñ;ˆØˆÜ�fœd×#Ñ#Ø×Ñ×(Ñ(×,Ñ,¨]Ó;ÑCÜÐ WÓXÐXØ×*Ñ*×3Ñ3°MÑBˆKä"Ø˜%¸kñ
ð 	
r:   Úmax_age_daysÚmin_versionc                 ó–   • U R                  SS5        Uc  U R                  U5      n[        U R                  R                  S   UUUUS9$ )aš  Returns the given signed cookie if it validates, or None.

The decoded cookie value is returned as a byte string (unlike
`get_cookie`).

Similar to `get_cookie`, this method only returns cookies that
were present in the request. It does not see outgoing cookies set by
`set_signed_cookie` in this handler.

.. versionchanged:: 3.2.1

   Added the ``min_version`` argument.  Introduced cookie version 2;
   both versions 1 and 2 are accepted by default.

 .. versionchanged:: 6.3

   Renamed from ``get_secure_cookie`` to ``get_signed_cookie`` to
   avoid confusion with other uses of "secure" in cookie attributes
   and prefixes. The old name remains as an alias.

r.  r/  )r6  r7  )r1  r  Údecode_signed_valuerF   ro   )rR   r¨   r©   r6  r7  s        r;   Úget_signed_cookieÚ RequestHandler.get_signed_cookie9  sU   € ð8 	×Ñ˜_Ð.>Ô?Ø‰=Ø—O‘O DÓ)ˆEÜ"Ø×Ñ×%Ñ% oÑ6ØØØ%Ø#ñ
ð 	
r:   c                 ól   • U R                  SS5        Uc  U R                  U5      nUc  g[        U5      $ )aF  Returns the signing key version of the secure cookie.

The version is returned as int.

.. versionchanged:: 6.3

   Renamed from ``get_secure_cookie_key_version`` to
   ``set_signed_cookie_key_version`` to avoid confusion with other
   uses of "secure" in cookie attributes and prefixes. The old name
   remains as an alias.

r.  r/  N)r1  r  Úget_signature_key_versionr¬   s      r;   Úget_signed_cookie_key_versionÚ,RequestHandler.get_signed_cookie_key_versionb  s;   € ð 	×Ñ˜_Ð.>Ô?Ø‰=Ø—O‘O DÓ)ˆEØ‰=ØÜ(¨Ó/Ð/r:   rø   Ú	permanentÚstatusc                 ó   • U R                   (       a  [        S5      eUc  U(       a  SOSnO'[        U[        5      (       a  SUs=::  a  S::  d   e   eU R	                  U5        U R                  S[        U5      5        U R                  5         g)a  Sends a redirect to the given (optionally relative) URL.

If the ``status`` argument is specified, that value is used as the
HTTP status code; otherwise either 301 (permanent) or 302
(temporary) is chosen based on the ``permanent`` argument.
The default is 302 (temporary).
z/Cannot redirect after headers have been writtenNi-  i.  i,  i�  ÚLocation)rY   r3  r¸   Úintr£   r­   r   Úfinish)rR   rø   r@  rA  s       r;   ÚredirectÚRequestHandler.redirectz  sv   € ð × × ÜÐMÓNÐNØ‰>Þ%‘S¨3‰Fä˜f¤c×*Ñ*¨s°fÕ/CÀÓ/CÐCÐCÐ/CÐCÐCØ�‰˜ÔØ�‰˜
¤D¨£IÔ.Ø�‰�r:   Úchunkc                 ó�  • U R                   (       a  [        S5      e[        U[        [        [
        45      (       d'  Sn[        U[        5      (       a  US-  n[        U5      e[        U[
        5      (       a(  [        R                  " U5      nU R                  SS5        [        U5      nU R                  R                  U5        g)av  Writes the given chunk to the output buffer.

To write the output to the network, use the `flush()` method below.

If the given chunk is a dictionary, we write it as JSON and set
the Content-Type of the response to be ``application/json``.
(if you want to send JSON as a different ``Content-Type``, call
``set_header`` *after* calling ``write()``).

Note that lists are not converted to JSON because of a potential
cross-site security vulnerability.  All JSON output should be
wrapped in a dictionary.  More details at
http://haacked.com/archive/2009/06/25/json-hijacking.aspx/ and
https://github.com/facebook/tornado/issues/1009
zCannot write() after finish()z5write() only accepts bytes, unicode, and dict objectsz|. Lists not accepted for security reasons; see http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.writer‰   zapplication/json; charset=UTF-8N)rZ   ÚRuntimeErrorr¸   rº   r   r2  Úlistr¿   r   Újson_encoder­   r   r“   rñ   )rR   rH  Úmessages      r;   ÚwriteÚRequestHandler.writeŽ  s£   € ð  �>�>ÜÐ>Ó?Ð?Ü˜%¤%¬´tÐ!<×=Ñ=ØMˆGÜ˜%¤×&Ñ&Øðfñ�ô ˜GÓ$Ð$Ü�eœT×"Ñ"Ü×&Ò& uÓ-ˆEØ�O‰O˜NÐ,MÔNÜ�U“ˆØ×Ñ×!Ñ! %Õ(r:   Útemplate_namezFuture[None]c                 ó¼  • U R                   (       a  [        S5      eU R                  " U40 UD6n/ n/ n/ n/ n/ n/ n	[        U S0 5      R	                  5        GH‡  n
U
R                  5       nU(       a  UR                  [        U5      5        U
R                  5       nU(       aG  [        U[        [        45      (       a  UR                  [        U5      5        OUR                  U5        U
R                  5       nU(       a  UR                  [        U5      5        U
R                  5       nU(       aG  [        U[        [        45      (       a  UR                  [        U5      5        OUR                  U5        U
R!                  5       nU(       a  UR                  [        U5      5        U
R#                  5       nU(       d  GMm  U	R                  [        U5      5        GMŠ     U(       a<  U R%                  U5      nUR'                  S5      nUSU [        U5      -   S-   UUS -   nU(       a3  U R)                  U5      nUR'                  S5      nUSU U-   S-   UUS -   nU(       a<  U R+                  U5      nUR-                  S5      nUSU [        U5      -   S-   UUS -   nU(       a3  U R/                  U5      nUR-                  S5      nUSU U-   S-   UUS -   nU(       a1  UR-                  S5      nUSU SR1                  U5      -   S-   UUS -   nU	(       a1  UR-                  S5      nUSU SR1                  U	5      -   S-   UUS -   nU R3                  U5      $ )aQ  Renders the template with the given arguments as the response.

``render()`` calls ``finish()``, so no other output methods can be called
after it.

Returns a `.Future` with the same semantics as the one returned by `finish`.
Awaiting this `.Future` is optional.

.. versionchanged:: 5.1

   Now returns a `.Future` instead of ``None``.
zCannot render() after finish()Ú_active_moduless   </body>Nó   
s   </head>r:   )rZ   rJ  Úrender_stringÚgetattrrò   Úembedded_javascriptrñ   r   Újavascript_filesr¸   r   rº   r   ÚextendÚembedded_cssÚ	css_filesÚ	html_headÚ	html_bodyÚrender_linked_jsÚrindexÚrender_embed_jsÚrender_linked_cssÚindexÚrender_embed_cssÚjoinrE  )rR   rP  rI   ÚhtmlÚjs_embedÚjs_filesÚ	css_embedrZ  Ú
html_headsÚhtml_bodiesÚmoduleÚ
embed_partÚ	file_partÚ	head_partÚ	body_partÚjsÚslocÚjs_bytesÚcssÚhlocÚ	css_bytess                        r;   ÚrenderÚRequestHandler.render®  s  € ð �>�>ÜÐ?Ó@Ð@Ø×!Ò! -Ñ:°6Ñ:ˆð ˆØˆØˆ	Øˆ	Øˆ
ØˆÜ˜dÐ$5°rÓ:×AÑA×CˆFØ×3Ñ3Ó5ˆJÞØ—‘¤ ZÓ 0Ô1Ø×/Ñ/Ó1ˆIÞÜ˜i¬,¼Ð)>×?Ñ?Ø—O‘O¤H¨YÓ$7Õ8à—O‘O IÔ.Ø×,Ñ,Ó.ˆJÞØ× Ñ ¤ jÓ!1Ô2Ø×(Ñ(Ó*ˆIÞÜ˜i¬,¼Ð)>×?Ñ?Ø×$Ñ$¤X¨iÓ%8Õ9à×$Ñ$ YÔ/Ø×(Ñ(Ó*ˆIÞØ×!Ñ!¤$ y£/Ô2Ø×(Ñ(Ó*ˆIß‰yØ×"Ñ"¤4¨	£?×3ñ1 Dö4 à×&Ñ& xÓ0ˆBØ—;‘;˜zÓ*ˆDØ˜˜�;¤ b£Ñ)¨EÑ1°D¸¸°KÑ?ˆDÞØ×+Ñ+¨HÓ5ˆHØ—;‘;˜zÓ*ˆDØ˜˜�; Ñ)¨EÑ1°D¸¸°KÑ?ˆDÞØ×(Ñ(¨Ó3ˆCØ—:‘:˜jÓ)ˆDØ˜˜�;¤ c£Ñ*¨UÑ2°T¸$¸%°[Ñ@ˆDÞØ×-Ñ-¨iÓ8ˆIØ—:‘:˜jÓ)ˆDØ˜˜�; Ñ*¨UÑ2°T¸$¸%°[Ñ@ˆDÞØ—:‘:˜jÓ)ˆDØ˜˜�; §¡¨*Ó!5Ñ5¸Ñ=ÀÀTÀUÀÑKˆDÞØ—:‘:˜jÓ)ˆDØ˜˜�; §¡¨+Ó!6Ñ6¸Ñ>ÀÀdÀeÀÑLˆDØ�{‰{˜4Ó Ð r:   rf  c                 óð   • / n[        5       nU HM  n[        U5      (       d  U R                  U5      nXC;  d  M+  UR                  U5        UR	                  U5        MO     SR                  S U 5       5      $ )z“Default method used to render the final js links for the
rendered webpage.

Override this method in a sub-classed controller to change the output.
r"  c              3   óZ   #   • U  H!  nS [         R                  " U5      -   S-   v •  M#     g7f)z<script src="z"" type="text/javascript"></script>N©r   Úxhtml_escape©rO   Úps     r;   rS   Ú2RequestHandler.render_linked_js.<locals>.<genexpr>	  s6   é € ð 
ò �ð Ü×!Ò! !Ó$ñ%à2ö3ò ùó   ‚)+©r  Úis_absoluteÚ
static_urlrñ   r°   rc  )rR   rf  ÚpathsÚunique_pathsr	  s        r;   r]  ÚRequestHandler.render_linked_jsù  su   € ð ˆÜ“uˆãˆDÜ˜t×$Ñ$Ø—‘ tÓ,�ØÕ'Ø—‘˜TÔ"Ø× Ñ  Ö&ñ ð �w‰wñ 
ñ ó	
ó 
ð 	
r:   re  c                 ó0   • SSR                  U5      -   S-   $ )z–Default method used to render the final embedded js for the
rendered webpage.

Override this method in a sub-classed controller to change the output.
s,   <script type="text/javascript">
//<![CDATA[
rS  s   
//]]>
</script>©rc  )rR   re  s     r;   r_  ÚRequestHandler.render_embed_js  s%   € ð >Ø�j‰j˜Ó"ñ#à#ñ$ð	
r:   rZ  c                 óð   • / n[        5       nU HM  n[        U5      (       d  U R                  U5      nXC;  d  M+  UR                  U5        UR	                  U5        MO     SR                  S U 5       5      $ )z”Default method used to render the final css links for the
rendered webpage.

Override this method in a sub-classed controller to change the output.
r"  c              3   óZ   #   • U  H!  nS [         R                  " U5      -   S-   v •  M#     g7f)z<link href="z$" type="text/css" rel="stylesheet"/>Nry  r{  s     r;   rS   Ú3RequestHandler.render_linked_css.<locals>.<genexpr>,  s3   é € ð 
ò �ð œV×0Ò0°Ó3Ñ3ð 71ö 1âùr~  r  )rR   rZ  r‚  rƒ  r	  s        r;   r`  Ú RequestHandler.render_linked_css  su   € ð ˆÜ“uˆãˆDÜ˜t×$Ñ$Ø—‘ tÓ,�ØÕ'Ø—‘˜TÔ"Ø× Ñ  Ö&ñ ð �w‰wñ 
ñ ó
ó 
ð 	
r:   rg  c                 ó0   • SSR                  U5      -   S-   $ )z—Default method used to render the final embedded css for the
rendered webpage.

Override this method in a sub-classed controller to change the output.
s   <style type="text/css">
rS  s	   
</style>r†  )rR   rg  s     r;   rb  ÚRequestHandler.render_embed_css2  s   € ð ,¨e¯j©j¸Ó.CÑCÀmÑSÐSr:   c                 óL  • U R                  5       nU(       dÔ  [        R                  " S5      nUR                  R                  nUR                  R                  U:X  aB  UR
                  b5  UR
                  nUR                  R                  U:X  a  UR
                  b  M5  UR                  R                  c   e[        R                  R                  UR                  R                  5      n[        R                     U[        R                  ;  a%  U R                  U5      nU[        R                  U'   O[        R                  U   nSSS5        WR                  U5      nU R                  5       nUR                  U5        UR                   " S0 UD6$ ! , (       d  f       NR= f)zªGenerate the given template with the given arguments.

We return the generated byte string (in utf8). To generate and
write a template as a response, use render() above.
r   Nr4   )Úget_template_pathÚsysÚ	_getframeÚf_codeÚco_filenameÚf_backÚosr	  Údirnamer=   Ú_template_loader_lockÚ_template_loadersÚcreate_template_loaderÚloadÚget_template_namespaceÚupdateÚgenerate)	rR   rP  rI   Útemplate_pathÚframeÚweb_fileÚloaderÚtÚ	namespaces	            r;   rT  ÚRequestHandler.render_string:  s8  € ð ×.Ñ.Ó0ˆÞÜ—M’M !Ó$ˆEØ—|‘|×/Ñ/ˆHØ—,‘,×*Ñ*¨hÓ6¸5¿<¹<Ñ;SØŸ™�ð —,‘,×*Ñ*¨hÓ6¸5¿<¹<Ó;Sà—<‘<×+Ñ+Ñ7Ð7Ð7ÜŸG™GŸO™O¨E¯L©L×,DÑ,DÓEˆMÜ×1Ó1Ø¤N×$DÑ$DÓDØ×4Ñ4°]ÓC�ØBH”×0Ñ0°Ò?ä'×9Ñ9¸-ÑH�÷ 2ð �K‰K˜Ó&ˆØ×/Ñ/Ó1ˆ	Ø×Ñ˜Ô Ø�zŠzÑ&˜IÑ&Ð&÷ 2Õ1ús   Ã<AFÆ
F#c                 ó&  • [        U U R                  U R                  U R                  U R                  R                  U R                  R
                  U R                  U R                  U R                  S9	nUR                  U R                  5        U$ )a  Returns a dictionary to be used as the default template namespace.

May be overridden by subclasses to add or modify values.

The results of this method will be combined with additional
defaults in the `tornado.template` module and keyword arguments
to `render` or `render_string`.
)	ÚhandlerrH   Úcurrent_userr   Ú_Úpgettextr�  Úxsrf_form_htmlÚreverse_url)r2  rH   r§  r   Ú	translater©  r�  rª  r«  rœ  r_   )rR   r£  s     r;   r›  Ú%RequestHandler.get_template_namespaceT  su   € ô ØØ—L‘LØ×*Ñ*Ø—;‘;Ø�k‰k×#Ñ#Ø—[‘[×)Ñ)Ø—‘Ø×.Ñ.Ø×(Ñ(ñ

ˆ	ð 	×Ñ˜Ÿ™Ô!ØÐr:   rž  c                 ó®   • U R                   R                  nSU;   a  US   $ 0 nSU;   a  US   US'   SU;   a  US   US'   [        R                  " U40 UD6$ )a-  Returns a new template loader for the given path.

May be overridden by subclasses.  By default returns a
directory-based loader on the given path, using the
``autoescape`` and ``template_whitespace`` application
settings.  If a ``template_loader`` application setting is
supplied, uses that instead.
Útemplate_loaderÚ
autoescapeÚtemplate_whitespaceÚ
whitespace)rF   ro   r   ÚLoader)rR   rž  ro   rI   s       r;   r™  Ú%RequestHandler.create_template_loaderk  ss   € ð ×#Ñ#×,Ñ,ˆØ Ó(ØÐ-Ñ.Ð.ØˆØ˜8Ó#ð $,¨LÑ#9ˆF�<Ñ Ø  HÓ,Ø#+Ð,AÑ#BˆF�<Ñ Ü�Š˜}Ñ7°Ñ7Ð7r:   Úinclude_footersc                 óÚ  • U R                   R                  c   eSR                  U R                  5      n/ U l        U R                  (       Gd  SU l        U R
                   H=  nUc   eUR                  U R                  U R                  X!5      u  U l        U l        nM?     U R                   R                  S:X  a  Sn[        U S5      (       aB  U R                  R                  5        H$  nU R                  SUR                  S5      5        M&     [        R                   " SU R                  U R"                  5      nU R                   R                  R%                  XPR                  U5      $ U R
                   H  nUR'                  X!5      nM     U R                   R                  S:w  a%  U R                   R                  R)                  U5      $ [+        5       nUR-                  S5        U$ )zÃFlushes the current output buffer to the network.

.. versionchanged:: 4.0
   Now returns a `.Future` if no callback is given.

.. versionchanged:: 6.0

   The ``callback`` argument was removed.
Nr:   Tr@   r  z
Set-Cookier"  )rH   rc   rc  r“   rY   Ú_transformsÚtransform_first_chunkr”   r‘   Úmethodr  r  rò   r±   ÚOutputStringr   ÚResponseStartLiner–   Úwrite_headersÚtransform_chunkrN  r   Ú
set_result)rR   rµ  rH  Ú	transformÚcookieÚ
start_lineÚfutures          r;   ÚflushÚRequestHandler.flush€  s¥  € ð �|‰|×&Ñ&Ñ2Ð2Ð2Ø—‘˜×+Ñ+Ó,ˆØˆÔØ×$×$Ð$Ø$(ˆDÔ!Ø!×-Ô-�	ØÑ(Ð(Ð(ð
 ×3Ñ3Ø×%Ñ% t§}¡}°eóñ	ØÔ%Ø”MÚñ .ð �|‰|×"Ñ" fÓ,Ø�ô
 �t˜]×+Ñ+Ø"×.Ñ.×5Ñ5Ö7�FØ—O‘O L°&×2EÑ2EÀdÓ2KÖLñ 8ô "×3Ò3°B¸×8IÑ8IÈ4Ï<É<ÓXˆJØ—<‘<×*Ñ*×8Ñ8ØŸM™M¨5óð ð "×-Ô-�	Ø!×1Ñ1°%ÓI’ñ .ð �|‰|×"Ñ" fÓ,Ø—|‘|×.Ñ.×4Ñ4°UÓ;Ð;ä›�Ø×!Ñ! $Ô'Ø�r:   c                 ó  • U R                   (       a  [        S5      eUb  U R                  U5        U R                  (       Gd  U R                  S:X  ag  U R
                  R                  S;   aM  SU R                  ;  a=  U R                  5         U R                  5       (       a  / U l
        U R                  S5        U R                  S;   d  SU R                  s=::  a  S:  a9  O  O6U R                  (       a   S	U R                  -  5       eU R                  5         O>S
U R                  ;  a.  [        S U R                   5       5      nU R                  S
U5        U R
                  R                  c   eU R
                  R                  R!                  S5        U R#                  SS9nU R
                  R                  R%                  5         U R'                  5         SU l         U R)                  5         U R+                  5         U$ )aü  Finishes this response, ending the HTTP request.

Passing a ``chunk`` to ``finish()`` is equivalent to passing that
chunk to ``write()`` and then calling ``finish()`` with no arguments.

Returns a `.Future` which may optionally be awaited to track the sending
of the response to the client. This `.Future` resolves when all the response
data has been sent, and raises an error if the connection is closed before all
data can be sent.

.. versionchanged:: 5.1

   Now returns a `.Future` instead of ``None``.
zfinish() called twiceNr‹   ©r?   r@   ÚEtagé0  )éÌ   rÈ  éd   zCannot send body with %súContent-Lengthc              3   ó8   #   • U  H  n[        U5      v •  M     g 7frM   )Úlen)rO   Úparts     r;   rS   Ú(RequestHandler.finish.<locals>.<genexpr>Ù  s   é € Ð$NÒ;M°4¤S¨§Y YÒ;Mùs   ‚T)rµ  )rZ   rJ  rN  rY   r”   rH   r¹  r‘   Úset_etag_headerÚcheck_etag_headerr“   r£   Ú_clear_representation_headersÚsumr­   rc   rd   rÃ  rE  Ú_logr|   Ú_break_cycles)rR   rH  Úcontent_lengthrÂ  s       r;   rE  ÚRequestHandler.finish²  s–  € ð �>�>ÜÐ6Ó7Ð7àÑØ�J‰J�uÔð ×$×$Ð$à×!Ñ! SÓ(Ø—L‘L×'Ñ'¨?Ó:Ø $§-¡-Ó/à×$Ñ$Ô&Ø×)Ñ)×+Ñ+Ø)+�DÔ&Ø—O‘O CÔ(Ø× Ñ  JÓ.°3¸$×:KÑ:KÕ3QÈcÖ3QØ×-×-ð Ø.°×1BÑ1BÑBóÐ-ð ×2Ñ2Õ4Ø!¨¯©Ó6Ü!$Ñ$N¸4×;MÒ;MÓ$NÓ!N�Ø—‘Ð 0°.ÔAà�|‰|×&Ñ&Ñ2Ð2Ð2ð
 	�‰×Ñ×2Ñ2°4Ô8à—‘¨D�Ð1ˆØ�‰×Ñ×&Ñ&Ô(Ø�	‰	ŒØˆŒØ�‰ÔØ×ÑÔØˆr:   c                 óX   • SU l         U R                  R                  R                  5       $ )a  Take control of the underlying stream.

Returns the underlying `.IOStream` object and stops all
further HTTP processing. Intended for implementing protocols
like websockets that tunnel over an HTTP handshake.

This method is only supported when HTTP/1.1 is used.

.. versionadded:: 5.1
T)rZ   rH   rc   Údetachrj   s    r;   rÙ  ÚRequestHandler.detachë  s$   € ð ˆŒà�|‰|×&Ñ&×-Ñ-Ó/Ð/r:   c                 ó   • S U l         g rM   )r_   rj   s    r;   rÕ  ÚRequestHandler._break_cyclesú  s   € ð ˆ�r:   c                 ó†  • U R                   (       a:  [        R                  " S5        U R                  (       d   U R	                  5         ggU R                  5         UR                  S5      nSU;   a:  US   S   n[        U[        5      (       a  UR                  (       a  UR                  nU R                  XS	9   US
:w  a  U R                  " U40 UD6  U R                  (       d  U R	                  5         gg! [
         a    [        R                  " SSS9   gf = f! [
         a    [        R                  " SSS9   Nif = f)a   Sends the given HTTP error code to the browser.

If `flush()` has already been called, it is not possible to send
an error, so this method will simply terminate the response.
If output has been written but not yet flushed, it will be discarded
and replaced with the error page.

Override `write_error()` to customize the error page that is returned.
Additional keyword arguments are passed through to `write_error`.
z0Cannot send error response after headers writtenz Failed to flush partial responseT©Úexc_infoNr›   rß  r/   )r›   rÈ  z!Uncaught exception in write_error)rY   r   ÚerrorrZ   rE  r3  rb   r¢   r¸   rt   r›   r£   Úwrite_errorr   )rR   rš   rI   r›   r…   s        r;   Ú
send_errorÚRequestHandler.send_errorÿ  s  € ð × × Ü�MŠMÐLÔMØ—>—>ð
UØ—K‘K”Mñ Ø�
‰
Œà—‘˜HÓ%ˆØ˜ÓØ˜zÑ*¨1Ñ-ˆIÜ˜)¤Y×/Ñ/°I×4D×4DØ"×)Ñ)�Ø�‰˜ˆÑ3ð	NØ˜cÓ!Ø× Ò  Ñ7°Ò7ð �~�~Ø�K‰K�Mð øô! !ó UÜ—M’MÐ"DÈtÓTØðUûô ó 	NÜ�MŠMÐ=ÈÔMð	Nús#   ºC9 Â=D Ã9DÄDÄE Ä?E c                 ó\  • U R                   R                  S5      (       aW  SU;   aQ  U R                  SS5        [        R                  " US   6  H  nU R                  U5        M     U R                  5         gU R                  SU[        R                  " U R                  5      S.-  5        g)a�  Override to implement custom error pages.

``write_error`` may call `write`, `render`, `set_header`, etc
to produce output as usual.

If this error was caused by an uncaught exception (including
HTTPError), an ``exc_info`` triple will be available as
``kwargs["exc_info"]``.  Note that this exception may not be
the "current" exception for purposes of methods like
``sys.exc_info()`` or ``traceback.format_exc``.
Úserve_tracebackrß  r‰   ú
text/plainzS<html><title>%(code)d: %(message)s</title><body>%(code)d: %(message)s</body></html>)ÚcoderM  N)
ro   r¢   r­   Ú	tracebackÚformat_exceptionrN  rE  r   rz  r–   )rR   rš   rI   Úlines       r;   rá  ÚRequestHandler.write_error&  s�   € ð �=‰=×ÑÐ.×/Ñ/°JÀ&Ó4Hà�O‰O˜N¨LÔ9Ü!×2Ò2°F¸:Ñ4FÓG�Ø—
‘
˜4Ö ñ Hà�K‰K�Mà�K‰Kð<à&´6×3FÒ3FÀtÇ|Á|Ó3TÑUñVõr:   c                 óÖ   • [        U S5      (       dM  U R                  5       nUb  Xl        U R                  $ U R                  5       U l        U R                  (       d   eU R                  $ )a&  The locale for the current session.

Determined by either `get_user_locale`, which you can override to
set the locale based on, e.g., a user preference stored in a
database, or `get_browser_locale`, which uses the ``Accept-Language``
header.

.. versionchanged: 4.1
   Added a property setter.
Ú_locale)r  Úget_user_localerí  Úget_browser_locale)rR   Úlocs     r;   r   ÚRequestHandler.locale?  s]   € ô �t˜Y×'Ñ'Ø×&Ñ&Ó(ˆCØ‰Ø"”ð �|‰|Ðð  $×6Ñ6Ó8�”Ø—|—|Ð#�|Ø�|‰|Ðr:   c                 ó   • Xl         g rM   )rí  ©rR   r©   s     r;   r   rñ  T  s   € à�r:   c                 ó   • g)zûOverride to determine the locale from the authenticated user.

If None is returned, we fall back to `get_browser_locale()`.

This method should return a `tornado.locale.Locale` object,
most likely obtained via a call like ``tornado.locale.get("en")``
Nr4   rj   s    r;   rî  ÚRequestHandler.get_user_localeX  s   € ð r:   c                 óÎ  • SU R                   R                  ;   Ga  U R                   R                  S   R                  S5      n/ nU H©  nUR                  5       R                  S5      n[	        U5      S:”  aX  US   R                  5       R                  S5      (       a1   [        US   R                  5       SS 5      nUS:  a
  [        5       eOS
nUS:”  d  M“  UR                  US   U45        M«     U(       a8  UR                  S SS9  U Vs/ s H  owS   PM	     nn[        R                  " U6 $ [        R                  " U5      $ ! [        [        4 a    S	n N‹f = fs  snf )z‚Determines the user's locale from ``Accept-Language`` header.

See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
zAccept-LanguageÚ,Ú;r/   zq=r0   Nr   g        g      ð?c                 ó   • U S   $ )Nr/   r4   )Úpairs    r;   Ú<lambda>Ú3RequestHandler.get_browser_locale.<locals>.<lambda>x  s   € ¨d°1ªgr:   T)ÚkeyÚreverse)rH   ÚheadersÚsplitrÆ   rÍ  Ú
startswithÚfloatrÂ   r¿   rñ   Úsortr   r¢   )	rR   rÅ   Ú	languagesÚlocalesÚlanguageÚpartsÚscorerð  Úcodess	            r;   rï  Ú!RequestHandler.get_browser_localeb  sC  € ð
  §¡× 4Ñ 4Ô4ØŸ™×,Ñ,Ð->Ñ?×EÑEÀcÓJˆIØˆGÛ%�Ø Ÿ™Ó(×.Ñ.¨sÓ3�Ü�u“: “> e¨A¡h§n¡nÓ&6×&AÑ&AÀ$×&GÑ&Gð$Ü % e¨A¡h§n¡nÓ&6°q°rÐ&:Ó ;˜Ø  1›9Ü",£,Ð.ð %ð
  �EØ˜1•9Ø—N‘N E¨!¡H¨eÐ#4Ö5ñ &ö Ø—‘Ñ!5¸t�ÑDÙ+2Ó3ª7 C˜Qœ©7�Ð3Ü—z’z 5Ð)Ð)Ü�zŠz˜'Ó"Ð"øô '¬	Ð2ó $Ø #šð$üò 4s   Â!/E
ÄE"Å
EÅEc                 óf   • [        U S5      (       d  U R                  5       U l        U R                  $ )aí  The authenticated user for this request.

This is set in one of two ways:

* A subclass may override `get_current_user()`, which will be called
  automatically the first time ``self.current_user`` is accessed.
  `get_current_user()` will only be called once per request,
  and is cached for future access::

      def get_current_user(self):
          user_cookie = self.get_signed_cookie("user")
          if user_cookie:
              return json.loads(user_cookie)
          return None

* It may be set as a normal variable, typically from an overridden
  `prepare()`::

      @gen.coroutine
      def prepare(self):
          user_id_cookie = self.get_signed_cookie("user_id")
          if user_id_cookie:
              self.current_user = yield load_user(user_id_cookie)

Note that `prepare()` may be a coroutine while `get_current_user()`
may not, so the latter form is necessary if loading the user requires
asynchronous operations.

The user object may be any type of the application's choosing.
Ú_current_user)r  Úget_current_userr  rj   s    r;   r§  ÚRequestHandler.current_user}  s/   € ô@ �t˜_×-Ñ-Ø!%×!6Ñ!6Ó!8ˆDÔØ×!Ñ!Ð!r:   c                 ó   • Xl         g rM   )r  ró  s     r;   r§  r  ¡  s   € à"Õr:   c                 ó   • g)zbOverride to determine the current user from, e.g., a cookie.

This method may not be a coroutine.
Nr4   rj   s    r;   r  ÚRequestHandler.get_current_user¥  s   € ð
 r:   c                 óX   • U R                  SS5        U R                  R                  S   $ )zuOverride to customize the login URL based on the request.

By default, we use the ``login_url`` application setting.
Ú	login_urlz@tornado.web.authenticated)r1  rF   ro   rj   s    r;   Úget_login_urlÚRequestHandler.get_login_url¬  s,   € ð
 	×Ñ˜[Ð*FÔGØ×Ñ×(Ñ(¨Ñ5Ð5r:   c                 óL   • U R                   R                  R                  S5      $ )z±Override to customize template path for each handler.

By default, we use the ``template_path`` application setting.
Return None to load templates relative to the calling file.
rž  )rF   ro   r¢   rj   s    r;   r�  Ú RequestHandler.get_template_path´  s!   € ð ×Ñ×(Ñ(×,Ñ,¨_Ó=Ð=r:   c                 óæ  • [        U S5      (       GdT  U R                  5       u  pnU R                  R                  SS5      nU R                  R                  S0 5      nUS:X  a  [        R
                  " U5      U l        O�US:X  a}  [        R                  " S5      nSR                  S[        R
                  " U5      [        R
                  " [        Xb5      5      [        [        [        U5      5      5      /5      U l        O[        S	U5      eUcU  U R                  (       a  S
U;  a  SUS
'   U R                  R                  SS5      nU R                   " XpR                  40 UD6  U R                  $ )aÿ  The XSRF-prevention token for the current user/session.

To prevent cross-site request forgery, we set an '_xsrf' cookie
and include the same '_xsrf' value as an argument with all POST
requests. If the two do not match, we reject the form submission
as a potential forgery.

See http://en.wikipedia.org/wiki/Cross-site_request_forgery

This property is of type `bytes`, but it contains only ASCII
characters. If a character string is required, there is no
need to base64-encode it; just decode the byte string as
UTF-8.

.. versionchanged:: 3.2.2
   The xsrf token will now be have a random mask applied in every
   request, which makes it safe to include the token in pages
   that are compressed.  See http://breachattack.com for more
   information on the issue fixed by this change.  Old (version 1)
   cookies will be converted to version 2 when this method is called
   unless the ``xsrf_cookie_version`` `Application` setting is
   set to 1.

.. versionchanged:: 4.3
   The ``xsrf_cookie_kwargs`` `Application` setting may be
   used to supply additional cookie options (which will be
   passed directly to `set_cookie`). For example,
   ``xsrf_cookie_kwargs=dict(httponly=True, secure=True)``
   will set the ``secure`` and ``httponly`` flags on the
   ``_xsrf`` cookie.
Ú_xsrf_tokenÚxsrf_cookie_versionr0   Úxsrf_cookie_kwargsr/   é   ó   |ó   2zunknown xsrf cookie version %dr
  é   Úxsrf_cookie_nameÚ_xsrf)r  Ú_get_raw_xsrf_tokenro   r¢   ÚbinasciiÚb2a_hexr  r•  Úurandomrc  r   r   r¹   rD  rÂ   r§  r  )rR   rŽ   ÚtokenÚ	timestampÚoutput_versionÚcookie_kwargsÚmaskÚcookie_names           r;   Ú
xsrf_tokenÚRequestHandler.xsrf_token¼  s7  € ôB �t˜]×+Ò+Ø(,×(@Ñ(@Ó(BÑ%ˆG˜IØ!Ÿ]™]×.Ñ.Ð/DÀaÓHˆNØ ŸM™M×-Ñ-Ð.BÀBÓGˆMØ Ó"Ü#+×#3Ò#3°EÓ#:�Õ Ø 1Ó$Ü—z’z !“}�Ø#'§9¡9àÜ ×(Ò(¨Ó.Ü ×(Ò(¬¸Ó)EÓFÜœS¤ Y£Ó0Ó1ð	ó$�Õ ô !Ð!AÀ>ÓRÐRØ‰Ø×$×$¨¸}Ó)LØ46�M .Ñ1Ø"Ÿm™m×/Ñ/Ð0BÀGÓL�Ø—’ ×-=Ñ-=ÑOÀÒOØ×ÑÐr:   c                 ó^  • [        U S5      (       d‘  U R                  R                  SS5      nU R                  U5      nU(       a  U R	                  U5      u  p4nOSu  p4nUc-  Sn[
        R                  " S5      n[        R                  " 5       nUc   eUc   eX4U4U l        U R                  $ )an  Read or generate the xsrf token in its raw form.

The raw_xsrf_token is a tuple containing:

* version: the version of the cookie from which this token was read,
  or None if we generated a new token in this request.
* token: the raw token data; random (non-ascii) bytes.
* timestamp: the time this token was generated (will not be accurate
  for version 1 cookies)
Ú_raw_xsrf_tokenr   r!  ©NNNNé   )	r  ro   r¢   r  Ú_decode_xsrf_tokenr•  r%  r�   r/  )rR   r+  rÀ  rŽ   r&  r'  s         r;   r"  Ú"RequestHandler._get_raw_xsrf_tokenö  s¬   € ô �tÐ.×/Ñ/ØŸ-™-×+Ñ+Ð,>ÀÓHˆKØ—_‘_ [Ó1ˆFÞØ,0×,CÑ,CÀFÓ,KÑ)�¡	à,<Ñ)� 	Ø‰}Ø�ÜŸ
š
 2›�Ü ŸIšI›K�	ØÑ$Ð$Ð$ØÑ(Ð(Ð(Ø$+°IÐ#>ˆDÔ Ø×#Ñ#Ð#r:   rÀ  c                 ó¢  •  [         R                  [        U5      5      nU(       a–  [        UR	                  S5      5      nUS:X  ak  UR                  S5      u  pEpg[        R                  " [        U5      5      n[        U[        R                  " [        U5      5      5      n	[        U5      n
X9U
4$ [        S5      eSn [        R                  " [        U5      5      n	[        [        R                  " 5       5      n
X9U
4$ ! [        R                  [        4 a    [        U5      n	 NIf = f! [         a    [        R                  " SSS9   gf = f)	zOConvert a cookie string into a the tuple form returned by
_get_raw_xsrf_token.
r/   r0   Ú|zUnknown xsrf cookie versionz(Uncaught exception in _decode_xsrf_tokenTrÞ  r0  )Ú_signed_value_version_reÚmatchr   rD  Úgroupr   r#  Úa2b_hexr   r3  ÚErrorr¿   r�   r   Údebug)rR   rÀ  rQ   rŽ   r¨  Úmask_strÚmasked_tokenÚtimestamp_strr*  r&  r'  s              r;   r2  Ú!RequestHandler._decode_xsrf_token  s  € ð	$Ü(×.Ñ.¬t°F«|Ó<ˆAæÜ˜aŸg™g a›j›/�Ø˜a“<Ø?E¿|¹|ÈCÓ?PÑ<�A ä#×+Ò+¬D°«NÓ;�DÜ+¨D´(×2BÒ2BÄ4ÈÓCUÓ2VÓW�EÜ # MÓ 2�IØ"¨9Ð4Ð4ô $Ð$AÓBÐBà�ð)Ü$×,Ò,¬T°&«\Ó:�Eô  ¤§	¢	£Ó,�	Ø¨	Ð2Ð2øô	 !Ÿ™¬	Ð2ó )Ü  ›L’Eð)ûô
 ó 	$ä�MŠMÐDÈtÒTÙ#ð	$ús<   ‚B/D, Â2D, Ã D Ã!D, Ä%D)Ä&D, Ä(D)Ä)D, Ä,EÅEc                 óæ  • U R                  SS5      =(       dQ    U R                  R                  R                  S5      =(       d%    U R                  R                  R                  S5      nU(       d  [	        SS5      eU R                  U5      u  p!nU R                  5       u  p#nU(       d  [	        SS5      e[        R                  " [        U5      [        U5      5      (       d  [	        SS5      eg)	a�  Verifies that the ``_xsrf`` cookie matches the ``_xsrf`` argument.

To prevent cross-site request forgery, we set an ``_xsrf``
cookie and include the same value as a non-cookie
field with all ``POST`` requests. If the two do not match, we
reject the form submission as a potential forgery.

The ``_xsrf`` value may be set as either a form field named ``_xsrf``
or in a custom HTTP header named ``X-XSRFToken`` or ``X-CSRFToken``
(the latter is accepted for compatibility with Django).

See http://en.wikipedia.org/wiki/Cross-site_request_forgery

.. versionchanged:: 3.2.2
   Added support for cookie version 2.  Both versions 1 and 2 are
   supported.
r!  NzX-XsrftokenzX-Csrftokené“  z"'_xsrf' argument missing from POSTz#'_xsrf' argument has invalid formatz(XSRF cookie does not match POST argument)
rÉ   rH   rÿ  r¢   rt   r2  r"  ÚhmacÚcompare_digestr   )rR   r&  r¨  Úexpected_tokens       r;   Úcheck_xsrf_cookieÚ RequestHandler.check_xsrf_cookie5  sÎ   € ð2 ×Ñ˜g tÓ,÷ 7Ø�|‰|×#Ñ#×'Ñ'¨Ó6÷7à�|‰|×#Ñ#×'Ñ'¨Ó6ð 	ö
 Ü˜CÐ!EÓFÐFØ×-Ñ-¨eÓ4‰ˆ�!Ø#×7Ñ7Ó9Ñˆ˜1ÞÜ˜CÐ!FÓGÐGÜ×"Ò"¤4¨£;´°^Ó0D×EÑEÜ˜CÐ!KÓLÐLð Fr:   c                 óN   • S[         R                  " U R                  5      -   S-   $ )a²  An HTML ``<input/>`` element to be included with all POST forms.

It defines the ``_xsrf`` input value, which we check on all POST
requests to prevent cross-site request forgery. If you have set
the ``xsrf_cookies`` application setting, you must include this
HTML within all of your HTML forms.

In a template, this method should be called with ``{% module
xsrf_form_html() %}``

See `check_xsrf_cookie()` above for more information.
z)<input type="hidden" name="_xsrf" value="z"/>)r   rz  r,  rj   s    r;   rª  ÚRequestHandler.xsrf_form_html[  s+   € ð 8Ü×!Ò! $§/¡/Ó2ñ3àñð	
r:   Úinclude_hostc                 ó:  • U R                  SS5        U R                  R                  S[        5      R                  nUc  [        U SS5      nU(       a1  U R                  R                  S-   U R                  R                  -   nOSnXT" U R                  U40 UD6-   $ )aJ  Returns a static URL for the given relative static file path.

This method requires you set the ``static_path`` setting in your
application (which specifies the root directory of your static
files).

This method returns a versioned url (by default appending
``?v=<signature>``), which allows the static files to be
cached indefinitely.  This can be disabled by passing
``include_version=False`` (in the default implementation;
other static file implementations are not required to support
this, but they may support other options).

By default this method returns URLs relative to the current
host, but if ``include_host`` is true the URL returned will be
absolute.  If this handler has an ``include_host`` attribute,
that value will be used as the default for all `static_url`
calls that do not pass ``include_host`` as a keyword argument.

Ústatic_pathr�  Ústatic_handler_classrI  Fz://r"  )	r1  ro   r¢   ÚStaticFileHandlerÚmake_static_urlrU  rH   ÚprotocolÚhost)rR   r	  rI  rI   Úget_urlÚbases         r;   r�  ÚRequestHandler.static_urln  s’   € ð. 	×Ñ˜]¨LÔ9Ø—-‘-×#Ñ#Ø"Ô$5ó
ç
‰/ð 	ð ÑÜ" 4¨¸Ó?ˆLæØ—<‘<×(Ñ(¨5Ñ0°4·<±<×3DÑ3DÑD‰DàˆDà�g˜dŸm™m¨TÑ<°VÑ<Ñ<Ð<r:   Úfeaturec                 ó~   • U R                   R                  R                  U5      (       d  [        SU< SU< 35      eg)z<Raises an exception if the given app setting is not defined.zYou must define the 'z%' setting in your application to use N)rF   ro   r¢   r3  )rR   r¨   rT  s      r;   r1  ÚRequestHandler.require_setting”  s;   € à×Ñ×(Ñ(×,Ñ,¨T×2Ñ2Ýã+/²ð:óð ð 3r:   c                 ó<   • U R                   R                  " U/UQ76 $ )z$Alias for `Application.reverse_url`.)rF   r«  )rR   r¨   rq   s      r;   r«  ÚRequestHandler.reverse_urlœ  s   € à×Ñ×+Ò+¨DÐ8°4Ò8Ð8r:   c                 óš   • [         R                  " 5       nU R                   H  nUR                  U5        M     SUR	                  5       -  $ )zæComputes the etag header to be used for this request.

By default uses a hash of the content written so far.

May be overridden to provide custom etag implementations,
or may return None to disable tornado's default etag support.
z"%s")ÚhashlibÚsha1r“   rœ  Ú	hexdigest)rR   ÚhasherrÎ  s      r;   Úcompute_etagÚRequestHandler.compute_etag   s?   € ô —’“ˆØ×&Ô&ˆDØ�M‰M˜$Öñ 'à˜×(Ñ(Ó*Ñ*Ð*r:   c                 óP   • U R                  5       nUb  U R                  SU5        gg)zÇSets the response's Etag header using ``self.compute_etag()``.

Note: no header will be set if ``compute_etag()`` returns ``None``.

This method is called automatically when the request is finished.
NrÇ  )r^  r­   )rR   Úetags     r;   rÐ  ÚRequestHandler.set_etag_header­  s+   € ð × Ñ Ó"ˆØÑØ�O‰O˜F DÕ)ð r:   c           	      óv  • [        U R                  R                  SS5      5      n[        R                  " S[        U R
                  R                  R                  SS5      5      5      nU(       a  U(       d  gSnUS   S:X  a  SnU$ S	[        S
[        4S jnU H  nU" U5      U" U5      :X  d  M  Sn  U$    U$ )aD  Checks the ``Etag`` header against requests's ``If-None-Match``.

Returns ``True`` if the request's Etag matches and a 304 should be
returned. For example::

    self.set_etag_header()
    if self.check_etag_header():
        self.set_status(304)
        return

This method is called automatically when the request is finished,
but may be called earlier for applications that override
`compute_etag` and want to do an early check for ``If-None-Match``
before completing the request.  The ``Etag`` header should be set
(perhaps with `set_etag_header`) before calling this method.
rÇ  r"  s   \*|(?:W/)?"[^"]*"úIf-None-MatchFr   ó   *TÚxrJ   c                 ó<   • U R                  S5      (       a  U SS  $ U $ )Ns   W/r0   ©r  )rf  s    r;   ÚvalÚ-RequestHandler.check_etag_header.<locals>.val×  s!   € Ø !§¡¨U× 3Ñ 3�q˜˜�uÐ:¸Ð:r:   )r   r‘   r¢   r  ÚfindallrH   rÿ  rº   )rR   Úcomputed_etagÚetagsr7  ri  ra  s         r;   rÑ  Ú RequestHandler.check_etag_header¸  s¼   € ô" ˜TŸ]™]×.Ñ.¨v°rÓ:Ó;ˆô —
’
Ø!¤4¨¯©×(<Ñ(<×(@Ñ(@ÀÐRTÓ(UÓ#Vó
ˆö ¦EØàˆØ�‰8�tÓØˆEð ˆð;”uð ;¤ô ;ó �Ù�t“9¡ MÓ 2Õ2Ø �EØØˆñ	 ð ˆr:   Ú
transformsÚOutputTransformc              �   óP  ^ #   • UT l          T R                  R                  T R                  ;  a  [	        S5      e[        T R                  5      (       d   T R                  R                  5         U Vs/ s H  nT R                  U5      PM     snT l        [        U 4S jUR                  5        5       5      T l        T R                  R                  S;  a:  T R                  R                   R#                  S5      (       a  T R%                  5         T R'                  5       nUb
  UI Sh  v•N nT R(                  b  [+        T R(                  S5        T R,                  (       a  g[        T R                  5      (       a   T R                  R.                  I Sh  v•N   [5        T T R                  R                  R7                  5       5      nU" T R                  0 T R                  D6nUb
  UI Sh  v•N nT R8                  (       a#  T R,                  (       d  T R;                  5         ggg! [        R                   a  n[	        SSU-  5      UeSnAff = fs  snf  GN0 NÄ! [0        R2                   a     gf = f N‰! [<         a�  n T R?                  U5        O%! [<         a    [@        RB                  " SS	S
9   Of = fSnO! Snf = fT R(                  bD  T R(                  RE                  5       (       d   T R(                  RG                  S5         SnAg SnAg SnAgSnAff = f7f)z7Executes this request with the given output transforms.rs   r÷   zInvalid body: %sNc              3   óJ   >#   • U  H  u  pUTR                  X!S 94v •  M     g7f)rì   N)rî   )rO   r  ró   rR   s      €r;   rS   Ú*RequestHandler._execute.<locals>.<genexpr>ñ  s)   øé € ð $ÚCQ¹¸!��D×(Ñ(¨Ð(Ð3Õ4Â>ùs   ƒ #)r?   r@   rE   Úxsrf_cookieszException in exception handlerTrÞ  )$r·  rH   r¹  ÚSUPPORTED_METHODSrt   r€   rg   Ú_parse_bodyr   ÚHTTPInputErrorrî   Ú	path_argsr2  r^   Úpath_kwargsrF   ro   r¢   rE  ry   r\   r   rZ   r�   r   r„   rU  Úlowerr[   rE  r3  Ú_handle_request_exceptionr   rà  r‚   r¾  )rR   ro  rq   rI   ÚeÚargÚresultr¹  s   `       r;   Ú_executeÚRequestHandler._executeà  s¤  øé € ð &ˆÔð>	7Ø�|‰|×"Ñ"¨$×*@Ñ*@Ó@Ü “nÐ$ô ,¨D¯N©N×;Ñ;ðHØ—L‘L×,Ñ,Ô.ñ DHÓHÂ4¸C˜d×2Ñ2°3Ö7Á4ÑHˆDŒNÜ#ô $ØCIÇ<Á<Ä>ó$ó  ˆDÔð
 �|‰|×"Ñ"ð +ó ð ×"Ñ"×+Ñ+×/Ñ/°×?Ñ?Ø×&Ñ&Ô(à—\‘\“^ˆFØÑ!Ø%Ÿ�Ø×$Ñ$Ñ0ô 3°4×3HÑ3HÈ$ÔOØ�~�~Øä'¨¯©×7Ñ7ð
ØŸ,™,×3Ñ3×3Ð3ô ˜T 4§<¡<×#6Ñ#6×#<Ñ#<Ó#>Ó?ˆFÙ˜TŸ^™^Ð@¨t×/?Ñ/?Ñ@ˆFØÑ!Ø%Ÿ�Ø× × ¨¯¯Ø—‘•ð *8Ð øôQ  ×.Ñ.ó HÜ# CÐ);¸aÑ)?Ó@ÀaÐGûðHüò Iò &ñ 4øÜ×1Ñ1ó Ùðúñ &øô ó 	7ðØ×.Ñ.¨qÕ1øÜó OÜ—’Ð>ÈÔNðOúð ‘ø˜‘úØ×$Ñ$Ñ0¸×9NÑ9N×9SÑ9S×9UÑ9Uð ×%Ñ%×0Ñ0°×6Ñ6ô	 :VÔ0ûð	7üsò   ƒL&ŒA	I< ÁH* Á0I< Á4IÂBI< Ä+IÄ,8I< Å$L&Å%I< Æ I  ÆIÆI  ÆAI< Ç0I:Ç16I< È'L&È*IÈ>IÉIÉ	I< ÉI  É I7É4I< É5L&É6I7É7I< É<
L#ÊJÊKÊJ;Ê8KÊ:J;Ê;KÊ>LËKËA
LÌL&ÌL#Ì#L&c                 ó   • [        5       e)z�Implement this method to handle streamed request data.

Requires the `.stream_request_body` decorator.

May be a coroutine for flow control.
©ÚNotImplementedError)rR   rH  s     r;   Údata_receivedÚRequestHandler.data_received%  s   € ô "Ó#Ð#r:   c                 ó:   • U R                   R                  U 5        g)zºLogs the current request.

Sort of deprecated since this functionality was moved to the
Application, but left in place for the benefit of existing apps
that have overridden this method.
N)rF   Úlog_requestrj   s    r;   rÔ  ÚRequestHandler._log.  s   € ð 	×Ñ×$Ñ$ TÕ*r:   c                 ó–   • U R                   R                  < SU R                   R                  < SU R                   R                  < S3$ )Nrí   ú (Ú))rH   r¹  ÚuriÚ	remote_iprj   s    r;   Ú_request_summaryÚRequestHandler._request_summary7  s3   € à�L‰L×ÔØ�L‰L×ÔØ�L‰L×"Ô"ð
ð 	
r:   r|  c                 ó  • [        U[        5      (       a+  U R                  (       d  U R                  " UR                  6   g  U R
                  " [        R                  " 5       6   U R                  (       a  g [        U[        5      (       a.  U R                  UR                  [        R                  " 5       S9  g U R                  S[        R                  " 5       S9  g ! [         a    [        R                  " SSS9   Nšf = f)NzError in exception loggerTrÞ  éô  )r¸   ÚFinishrZ   rE  rq   Úlog_exceptionr�  rß  r3  r   rà  rt   râ  rš   )rR   r|  s     r;   r{  Ú(RequestHandler._handle_request_exception>  s²   € Ü�aœ× Ñ à—>—>Ø—’˜QŸV™VÑ$Øð	FØ×Ò¤§¢£Ñ/ð
 �>�>ð Ü�aœ×#Ñ#Ø�O‰O˜AŸM™M´C·L²L³NˆOÒCà�O‰O˜C¬#¯,ª,«.ˆOÒ9øô ó 	Fô �MŠMÐ5ÀÔEð	Fús   Á"C ÃC?Ã>C?ÚtypzOptional[Type[BaseException]]Útbc                 óf  • [        U[        5      (       ak  UR                  (       aY  SUR                  -   nUR                  U R	                  5       /[        UR                  5      -   n[        R                  " U/UQ76   gg[        R                  " SU R	                  5       U R                  XU4S9  g)a  Override to customize logging of uncaught exceptions.

By default logs instances of `HTTPError` as warnings without
stack traces (on the ``tornado.general`` logger), and all
other exceptions as errors with stack traces (on the
``tornado.application`` logger).

.. versionadded:: 3.1
z%d %s: zUncaught exception %s
%rrÞ  N)r¸   rt   Úlog_messagerš   rŽ  rK  rq   r   Úwarningr   rà  rH   )rR   r•  r©   r–  Úformatrq   s         r;   r“  ÚRequestHandler.log_exceptionT  s“   € ô �eœY×'Ñ'Ø× × Ø" U×%6Ñ%6Ñ6�Ø×)Ñ)¨4×+@Ñ+@Ó+BÐCÄdÈ5Ï:É:ÓFVÑV�Ü—’ Ð.¨Ô.ð !ô
 �MŠMØ+Ø×%Ñ%Ó'Ø—‘Ø bÐ)ó	r:   rj  ÚUIModule.c                 ó,   ^ ^^• S[         4UUU 4S jjnU$ )NrJ   c                  óÀ   >• [        TS5      (       d  0 Tl        TTR                  ;  a  T" T5      TR                  T'   TR                  T   R                  " U 0 UD6nU$ )NrR  )r  rR  ru  )rq   rI   Úrenderedrj  r¨   rR   s      €€€r;   ru  Ú)RequestHandler._ui_module.<locals>.renderq  s`   ø€ Ü˜4Ð!2×3Ñ3Ø')�Ô$Ø˜4×/Ñ/Ó/Ù-3°D«\�×$Ñ$ TÑ*Ø×+Ñ+¨DÑ1×8Ò8¸$ÐIÀ&ÑIˆHØˆOr:   )r¹   )rR   r¨   rj  ru  s   ``` r;   Ú
_ui_moduleÚRequestHandler._ui_modulep  s   ú€ ð	¤s÷ 	ñ 	ð ˆr:   r¹  c                 ó   ^ ^• UU 4S j$ )Nc                  ó   >• T" T/U Q70 UD6$ rM   r4   )rq   rI   r¹  rR   s     €€r;   rû  Ú+RequestHandler._ui_method.<locals>.<lambda>|  s   ø€ ¡v¨dÐ'D°TÒ'D¸VÒ'Dr:   r4   )rR   r¹  s   ``r;   rN   ÚRequestHandler._ui_method{  s	   ù€ ÝDÐDr:   c                 ó@   • / SQnU H  nU R                  U5        M     g )N)úContent-EncodingzContent-Languager‰   )r´   )rR   rÿ  Úhs      r;   rÒ  Ú,RequestHandler._clear_representation_headers~  s"   € ò KˆÛˆAØ×Ñ˜aÖ ò r:   )rR  r[   r  rZ   r‘   rY   rí  r  r\   r/  r–   r”   r·  r“   r  rF   rx  ry  rH   r_   ©rJ   NrM   ©T)NNÚ/N)r  N)Né   N)FN)F)r‘  )Úen_US)zthis feature)Žr5   r6   r7   r8   Ú__doc__ru  r˜  Ú	threadingÚLockr—  r  Úcompilerï   Ú_stream_request_bodyr·  rx  ry  r   ÚHTTPServerRequestr    rX   rk   rf   Úpropertyr   r¹   ro   rv   Úheadr¢   ÚpostÚdeleteÚpatchÚputÚoptionsr"   r#   ry   r|   re   rb   r’   rD  r£   r¦   Ú_HeaderTypesr­   r±   r´   rÀ   r«   r,   rÓ   rÉ   Ú_ARG_DEFAULTr2   r!   r%   rÖ   rÚ   rÝ   rá   rä   rº   rÐ   rÔ   rî   r  rþ   ÚMorselr  r  r$   r¾   r  r$  r'  r+  Úset_secure_cookier*  r:  Úget_secure_cookier>  Úget_secure_cookie_key_versionrF  r2  rN  ru  r'   r]  r_  r`  rb  rT  r›  r   Ú
BaseLoaderr™  rÃ  rE  r   ÚIOStreamrÙ  rÕ  râ  rá  r�   r   ÚLocaleÚsetterrî  rï  r§  r  r  r�  r,  r"  r2  rE  rª  r�  r1  r«  r^  rÐ  rÑ  r  r„  rÔ  rŽ  ÚBaseExceptionr{  r-   r“  r)   r&   r¡  rN   rÒ  r9   Ú__classcell__©rg   s   @r;   r=   r=   º   si  ø† ñ	ð UÐàÐØ%ŸNšNÓ,ÐØ"$§*¢*Ð-DÓ"EÐà Ðð €KØ€IØ€Kð"à"ð"ð ×+Ñ+ð"ð ð	"ð
 
÷"ô@ð €Jðð& ð)˜$˜s C˜x™.ó )ó ð)ð¨3ð ¸#ð À$ô ð !€DØ
€CØ €DØ"€FØ!€EØ
€CØ#€Gð˜ )¨D¡/Ñ2ô ô ô6ô&/ôñJ cð J°8¸C±=ð JÈDõ Jð:!˜Cô !ð@˜sð @¨<ð @¸Dô @ðC˜sð C¨<ð C¸Dô Cð$ ð $¨ô $ð !Ÿjšj¨Ó8Ðð¨<ð ¸Cô ð0 ñ ð ¨sð ¸4ð È3ô ó ðð à6BÐRVñØðØ"3ðØKOðà	ôó ðð
 à6:ñØðØ"&ðØ/3ðà	�#‰ôó ðð 8DØñ	PàðPð �t˜SÐ"3Ð3Ñ4ðPð ð	Pð
 
�#‰õPñ$H #ð H¨dð H¸dÀ3¹iõ Hð$ 8DØñ	UàðUð �t˜SÐ"3Ð3Ñ4ðUð ð	Uð
 
�#‰õUñ&M sð M°4ð MÀ4ÈÁ9õ Mð 8DØñ	VàðVð �t˜SÐ"3Ð3Ñ4ðVð ð	Vð
 
�#‰õVñ&N¨ð N°Dð NÀDÈÁIõ Nð ñàðð �t˜SÐ"3Ð3Ñ4ðð �S˜$˜u™+Ð%Ñ&ð	ð
 ðð 
�#‰õð HLñØðØ!% c¨4°©;Ð&6Ñ!7ðØ@Dðà	ˆc‰õñ Uð °(¸3±-ð È3õ ð( ð$˜˜c 4§<¡<×#6Ñ#6Ð6Ñ7ó $ó ð$ñ
˜sð ¨X°c©]ð ÀhÈsÁmõ ð" !%ØDHØØ(,ðQð "&ØØØ"&òQàðQð �S˜%�ZÑ ðQð ˜‘ð	Qð
 ˜%  u¨h×.?Ñ.?Ð ?Ñ@ÑAðQð ðQð ˜u‘oðQð ˜#‘ðQð ðQð ðQð ˜3‘-ðQð ðQð 
öQðfC ð C°ð C¸ô Cð8.¨#ð .°$ô .ðF )+Ø!%ñ+
àð+
ð �S˜%�ZÑ ð+
ð ˜u‘oð	+
ð
 ˜#‘ð+
ð ð+
ð 
õ+
ðZ *Ðð MQñ
Øð
Ø % c¨5 jÑ 1ð
Ø<DÀS¹Mð
à	õ
ð:  $Ø Ø%)ñ%
àð%
ð ˜‰}ð%
ð ð	%
ð
 ˜c‘]ð%
ð 
�%‰õ%
ðN *Ðð 15ñ0Øð0Ø (¨¡ð0à	�#‰õ0ð, %BÐ!ð JNñØðØ#'ðØ9AÀ#¹ðà	õð()˜5  e¨TÐ!1Ñ2ð )°tô )ð@I! Cð I!°3ð I!¸>ô I!ðV
¨°#©ð 
¸3ô 
ð.

¨°©ð 

¸Eô 

ð
¨8°C©=ð 
¸Sô 
ð,T¨(°5©/ð T¸eô Tð'¨3ð '¸#ð 'À%ô 'ð4¨¨S°#¨X©ô ð.8°Cð 8¸H×<OÑ<Oô 8ñ*0 Tð 0°nõ 0ñd7˜H U¨3°°tÐ+;Ñ%<Ñ=ð 7Èõ 7ðr0˜×)Ñ)ô 0ôñ
% cð %¸3ð %À4õ %ðN sð °cð ¸dô ð2 ð˜Ÿ™×-Ñ-ó ó ðð( ‡]�]ð˜GŸN™N×1Ñ1ð °dó ó ðð ¨'¯.©.×*?Ñ*?Ñ!@ô ñ#¨#ð #¸G¿N¹N×<QÑ<Qõ #ð6 ð!"˜có !"ó ð!"ðF ×Ñð# #ð #¨$ó #ó ð#ð #ô ð6˜sô 6ð> 8¨C¡=ô >ð ð7 ˜Eó 7 ó ð7 ðr$ U¨8°C©=¸%ÀÐ+FÑ%Gô $ð6"$Øð"$à	ˆx˜‰}˜h u™o¨x¸©Ð>Ñ	?ô"$ôH$MðL
 ô 
ð( 9=ñ$=Øð$=Ø'/°¡~ð$=ØHKð$=à	õ$=ñL Cð °#ð È4õ ð9 ð 9¨Cð 9°Cô 9ð+˜h s™mô +ô	*ð& 4ô &ðPC7ØÐ0Ñ1ðC7Ø:?ðC7ØKPðC7à	ôC7ðJ$ 5ð $¨X°iÀ±oÑ-Fô $ô+ð
 #ô 
ð:¨=ð :¸Tô :ð,à,ðð ˜Ñ&ðð �]Ñ#ð	ð
 
ôð8	˜sð 	¨D°Ñ,<ð 	ÀÈ#ÈsÈ(ÑASô 	ðE ¨#¨s¨(Ñ!3ð E¸ÀÀcÀÑ8Jô E÷!ò !r:   r=   Ú_RequestHandlerType)ÚboundÚclsrJ   c                 óV   • [        U [        5      (       d  [        SU 5      eSU l        U $ )a×  Apply to `RequestHandler` subclasses to enable streaming body support.

This decorator implies the following changes:

* `.HTTPServerRequest.body` is undefined, and body arguments will not
  be included in `RequestHandler.get_argument`.
* `RequestHandler.prepare` is called when the request headers have been
  read instead of after the entire body has been read.
* The subclass must define a method ``data_received(self, data):``, which
  will be called zero or more times as data is available.  Note that
  if the request has an empty body, ``data_received`` may not be called.
* ``prepare`` and ``data_received`` may return Futures (such as via
  ``@gen.coroutine``, in which case the next method will not be called
  until those futures have completed.
* The regular HTTP method (``post``, ``put``, etc) will be called after
  the entire body has been read.

See the `file receiver demo <https://github.com/tornadoweb/tornado/tree/stable/demos/file_upload/>`_
for example usage.
ú+expected subclass of RequestHandler, got %rT©Ú
issubclassr=   r¿   r´  ©rÌ  s    r;   Ústream_request_bodyrÒ  Œ  s,   € ô* �cœ>×*Ñ*ÜÐEÀsÓKÐKØ#€CÔØ€Jr:   c                 ó\   • [        U [        5      (       d  [        SU 5      eU R                  $ )NrÎ  rÏ  rÑ  s    r;   r€   r€   §  s)   € Ü�cœ>×*Ñ*ÜÐEÀsÓKÐKØ×#Ñ#Ð#r:   r¹  .c                 óv   ^ • [         R                  " T 5      S[        S[        [        S      4U 4S jj5       nU$ )a  Use this decorator to remove trailing slashes from the request path.

For example, a request to ``/foo/`` would redirect to ``/foo`` with this
decorator. Your request handler mapping should use a regular expression
like ``r'/foo/*'`` in conjunction with using the decorator.
rR   rJ   Nc                 ó¤  >• U R                   R                  R                  S5      (       aš  U R                   R                  S;   au  U R                   R                  R	                  S5      nU(       aH  U R                   R
                  (       a  USU R                   R
                  -   -  nU R                  USS9  g O[        S5      eT" U /UQ70 UD6$ ©Nr­  rÆ  Ú?T©r@  é”  )rH   r	  Úendswithr¹  ÚrstripÚqueryrF  rt   ©rR   rq   rI   rŒ  r¹  s       €r;   ÚwrapperÚremoveslash.<locals>.wrapper·  s®   ø€ ð �<‰<×Ñ×%Ñ% c×*Ñ*Ø�|‰|×"Ñ" oÓ5Ø—l‘l×'Ñ'×.Ñ.¨sÓ3�ÞØ—|‘|×)×)Ø˜s T§\¡\×%7Ñ%7Ñ7Ñ7˜Ø—M‘M #°�MÑ6Øð	 ô   “nÐ$Ù�dÐ,˜TÒ, VÑ,Ð,r:   ©Ú	functoolsÚwrapsr=   r"   r#   ©r¹  rÞ  s   ` r;   Úremoveslashrä  ­  s@   ø€ ô ‡_‚_�VÓð-Üð-ä	”)˜D‘/Ñ	"ö-ó ð-ð €Nr:   c                 óv   ^ • [         R                  " T 5      S[        S[        [        S      4U 4S jj5       nU$ )a  Use this decorator to add a missing trailing slash to the request path.

For example, a request to ``/foo`` would redirect to ``/foo/`` with this
decorator. Your request handler mapping should use a regular expression
like ``r'/foo/?'`` in conjunction with using the decorator.
rR   rJ   Nc                 ó|  >• U R                   R                  R                  S5      (       d†  U R                   R                  S;   aa  U R                   R                  S-   nU R                   R                  (       a  USU R                   R                  -   -  nU R                  USS9  g [        S5      eT" U /UQ70 UD6$ rÖ  )rH   r	  rÚ  r¹  rÜ  rF  rt   rÝ  s       €r;   rÞ  Úaddslash.<locals>.wrapperÔ  sž   ø€ ð �|‰|× Ñ ×)Ñ)¨#×.Ñ.Ø�|‰|×"Ñ" oÓ5Ø—l‘l×'Ñ'¨#Ñ-�Ø—<‘<×%×%Ø˜3 §¡×!3Ñ!3Ñ3Ñ3�CØ—‘˜c¨T�Ñ2ØÜ˜C“.Ð Ù�dÐ,˜TÒ, VÑ,Ð,r:   rà  rã  s   ` r;   Úaddslashrè  Ê  s@   ø€ ô ‡_‚_�VÓð-Üð-ä	”)˜D‘/Ñ	"ö-ó ð-ð €Nr:   c            	       ó®   ^ • \ rS rSrSr SSSS\\   SS4U 4S jjjrS	\S\4U 4S
 jjr	S\
S\R                  S\
S\\R                     4U 4S jjrSrU =r$ )Ú_ApplicationRouteriå  aÛ  Routing implementation used internally by `Application`.

Provides a binding between `Application` and `RequestHandler`.
This implementation extends `~.routing.ReversibleRuleRouter` in a couple of ways:
    * it allows to use `RequestHandler` subclasses as `~.routing.Rule` target and
    * it allows to use a list/tuple of rules as `~.routing.Rule` target.
    ``process_rule`` implementation will substitute this list with an appropriate
    `_ApplicationRouter` instance.
NrF   rG   ÚrulesrJ   c                 ó^   >• [        U[        5      (       d   eXl        [        TU ]  U5        g rM   )r¸   rG   rF   rW   rX   )rR   rF   rë  rg   s      €r;   rX   Ú_ApplicationRouter.__init__ð  s+   ø€ ô ˜+¤{×3Ñ3Ð3Ð3Ø&ÔÜ‰Ñ˜Õr:   Úrulec                 óº   >• [         TU ]  U5      n[        UR                  [        [
        45      (       a%  [        U R                  UR                  5      Ul        U$ rM   )rW   Úprocess_ruler¸   ÚtargetrK  Útuplerê  rF   )rR   rî  rg   s     €r;   rð  Ú_ApplicationRouter.process_rule÷  sI   ø€ Ü‰wÑ# DÓ)ˆä�d—k‘k¤D¬% =×1Ñ1Ü,Ø× Ñ  $§+¡+óˆDŒKð ˆr:   rñ  rH   Útarget_paramsc                 óª   >• [        U5      (       a2  [        U[        5      (       a  U R                  R                  " X!40 UD6$ [
        TU ]  " X40 UD6$ rM   )r   rÐ  r=   rF   Úget_handler_delegaterW   Úget_target_delegate)rR   rñ  rH   rô  rg   s       €r;   r÷  Ú&_ApplicationRouter.get_target_delegate  sU   ø€ ô �6�?‰?œz¨&´.×AÑAØ×#Ñ#×8Ò8ØñØ#0ñð ô ‰wÒ*¨6ÑL¸mÑLÐLr:   )rF   rM   )r5   r6   r7   r8   r°  r"   r   rX   r   rð  r    r   rµ  ÚHTTPMessageDelegater÷  r9   rÈ  rÉ  s   @r;   rê  rê  å  sŠ   ø† ñð HLñ Ø(ð Ø19¸)Ñ1Dð à	÷ ð  ð ð ¨$÷ ðMØðMØ$,×$>Ñ$>ðMØQTðMà	�(×.Ñ.Ñ	/÷Mõ Mr:   rê  c                   ó@  • \ rS rSrSr   S-S\\   S\\   S\\\	S         S\
S	S4
S
 jjr S.\R                  \R                  R                   SSS.S\S\\   S\R$                  S\S\\   S\S\
S	\4S jjjrS\S\S	S4S jrS\	S   S	S4S jrS\
S	S4S jrS\
S	S4S jrS\R6                  S	\\S      4S jrS\R6                  S\
S	S 4S! jr   S-S\R6                  S"\	\   S#\\ \\
4      S$\\\!      S%\\ \\!4      S	S 4S& jjr"S'\S(\
S	\4S) jr#S*\S	S4S+ jr$S,r%g)/rG   i  a½  A collection of request handlers that make up a web application.

Instances of this class are callable and can be passed directly to
HTTPServer to serve the application::

    application = web.Application([
        (r"/", MainPageHandler),
    ])
    http_server = httpserver.HTTPServer(application)
    http_server.listen(8080)

The constructor for this class takes in a list of `~.routing.Rule`
objects or tuples of values corresponding to the arguments of
`~.routing.Rule` constructor: ``(matcher, target, [target_kwargs], [name])``,
the values in square brackets being optional. The default matcher is
`~.routing.PathMatches`, so ``(regexp, target)`` tuples can also be used
instead of ``(PathMatches(regexp), target)``.

A common routing target is a `RequestHandler` subclass, but you can also
use lists of rules as a target, which create a nested routing configuration::

    application = web.Application([
        (HostMatches("example.com"), [
            (r"/", MainPageHandler),
            (r"/feed", FeedHandler),
        ]),
    ])

In addition to this you can use nested `~.routing.Router` instances,
`~.httputil.HTTPMessageDelegate` subclasses and callables as routing targets
(see `~.routing` module docs for more information).

When we receive requests, we iterate over the list in order and
instantiate an instance of the first request class whose regexp
matches the request path. The request class can be specified as
either a class object or a (fully-qualified) name.

A dictionary may be passed as the third element (``target_kwargs``)
of the tuple, which will be used as keyword arguments to the handler's
constructor and `~RequestHandler.initialize` method. This pattern
is used for the `StaticFileHandler` in this example (note that a
`StaticFileHandler` can be installed automatically with the
static_path setting described below)::

    application = web.Application([
        (r"/static/(.*)", web.StaticFileHandler, {"path": "/var/www"}),
    ])

We support virtual hosts with the `add_handlers` method, which takes in
a host regular expression as the first argument::

    application.add_handlers(r"www\.myhost\.com", [
        (r"/article/([0-9]+)", ArticleHandler),
    ])

If there's no match for the current request's host, then ``default_host``
parameter value is matched against host regular expressions.


.. warning::

   Applications that do not use TLS may be vulnerable to :ref:`DNS
   rebinding <dnsrebinding>` attacks. This attack is especially
   relevant to applications that only listen on ``127.0.0.1`` or
   other private networks. Appropriate host patterns must be used
   (instead of the default of ``r'.*'``) to prevent this risk. The
   ``default_host`` argument must not be used in applications that
   may be vulnerable to DNS rebinding.

You can serve static files by sending the ``static_path`` setting
as a keyword argument. We will serve those files from the
``/static/`` URI (this is configurable with the
``static_url_prefix`` setting), and we will serve ``/favicon.ico``
and ``/robots.txt`` from the same directory.  A custom subclass of
`StaticFileHandler` can be specified with the
``static_handler_class`` setting.

.. versionchanged:: 4.5
   Integration with the new `tornado.routing` module.

NÚhandlersÚdefault_hostro  rp  ro   rJ   c                 ó  • UcS  / U l         UR                  S5      (       d  UR                  S5      (       a  U R                   R                  [        5        OX0l         X l        X@l        [        [        [        S.U l	        0 U l
        U R                  UR                  S0 5      5        U R                  UR                  S0 5      5        U R
                  R                  S5      (       a˜  U R
                  S   n[        U=(       d    / 5      nUR                  SS5      nUR                  S	[        5      nUR                  S
0 5      nXXS'   [        R                   " U5      S-   SS4 H  n	UR#                  SX—U45        M     U R
                  R                  S5      (       ap  U R
                  R%                  SS5        U R
                  R%                  SS5        U R
                  R%                  SS5        U R
                  R%                  SS5        ['        X5      U l        ['        U [+        [-        5       U R(                  5      /5      U l        U R
                  R                  S5      (       a  SSKJn
  U
R5                  5         g g )NÚcompress_responseÚgzip)Úlinkifyrª  ÚTemplatera   r]   rK  Ústatic_url_prefixú/static/rL  Ústatic_handler_argsr	  z(.*)z/(favicon\.ico)z/(robots\.txt)r   r;  Ú
autoreloadTÚcompiled_template_cacheFÚstatic_hash_cacherå  )r  )ro  r¢   rñ   ÚGZipContentEncodingrü  ro   Ú_linkifyÚ_xsrf_form_htmlÚTemplateModulera   r]   Ú_load_ui_modulesÚ_load_ui_methodsrK  rM  r  r   ÚinsertÚ
setdefaultrê  Úwildcard_routerr   r   Údefault_routerr�   r  Ústart)rR   rû  rü  ro  ro   r	  r  rL  r  Úpatternr  s              r;   rX   ÚApplication.__init___  s  € ð ÑØ ˆDŒOØ�|‰|Ð/×0Ñ0°H·L±LÀ×4HÑ4HØ—‘×&Ñ&Ô':Ô;øà(ŒOØ(ÔØ ŒäÜ-Ü&ñ
ˆŒð
 ˆŒØ×Ñ˜hŸl™l¨<¸Ó<Ô=Ø×Ñ˜hŸl™l¨<¸Ó<Ô=Ø�=‰=×Ñ˜]×+Ñ+Ø—=‘= Ñ/ˆDÜ˜HŸN¨Ó+ˆHØ (§¡Ð-@À*Ó MÐØ#+§<¡<Ø&Ô(9ó$Ð ð #+§,¡,Ð/DÀbÓ"IÐØ*. Ñ'ä—	’	Ð+Ó,¨wÑ6Ø"Ø!ó�ð
 —‘  GÐCVÐ#WÖXñð �=‰=×Ñ˜W×%Ñ%Ø�M‰M×$Ñ$ \°4Ô8Ø�M‰M×$Ñ$Ð%>ÀÔFØ�M‰M×$Ñ$Ð%8¸%Ô@Ø�M‰M×$Ñ$Ð%6¸Ô=ä1°$ÓAˆÔÜ0Ø”4œ
› d×&:Ñ&:Ó;Ð<ó
ˆÔð
 �=‰=×Ñ˜\×*Ñ*Ý*à×ÑÕð +r:   F)ÚfamilyÚbacklogÚflagsÚ
reuse_portÚportÚaddressr  r  r  r  rI   c          	      óF   • [        U 40 UD6nUR                  UUUUUUS9  U$ )a&  Starts an HTTP server for this application on the given port.

This is a convenience alias for creating an `.HTTPServer` object and
calling its listen method.  Keyword arguments not supported by
`HTTPServer.listen <.TCPServer.listen>` are passed to the `.HTTPServer`
constructor.  For advanced uses (e.g. multi-process mode), do not use
this method; create an `.HTTPServer` and call its
`.TCPServer.bind`/`.TCPServer.start` methods directly.

Note that after calling this method you still need to call
``IOLoop.current().start()`` (or run within ``asyncio.run``) to start
the server.

Returns the `.HTTPServer` object.

.. versionchanged:: 4.3
   Now returns the `.HTTPServer` object.

.. versionchanged:: 6.2
   Added support for new keyword arguments in `.TCPServer.listen`,
   including ``reuse_port``.
)r  r  r  r  r  )r
   Úlisten)	rR   r  r  r  r  r  r  rI   Úservers	            r;   r  ÚApplication.listen—  s>   € ôB ˜DÑ+ FÑ+ˆØ�‰ØØØØØØ!ð 	ñ 	
ð ˆr:   Úhost_patternÚhost_handlersc                 ó  • [        U5      n[        U[        X5      5      nU R                  R                  R                  SU5        U R                  b2  U R                  R                  [        XR                  5      U4/5        gg)z¢Appends the given handlers to our handler list.

Host patterns are processed sequentially in the order they were
added. All matching patterns will be considered.
rè   N)r   r   rê  r  rë  r  rü  r  Ú	add_rulesr   r  )rR   r  r   Úhost_matcherrî  s        r;   Úadd_handlersÚApplication.add_handlersÃ  sw   € ô # <Ó0ˆÜ�LÔ"4°TÓ"IÓJˆà×Ñ×!Ñ!×(Ñ(¨¨TÔ2à×ÑÑ(Ø× Ñ ×*Ñ*Ü$ T×+DÑ+DÓEÀ}ÐUÐVõð )r:   Útransform_classc                 ó:   • U R                   R                  U5        g rM   )ro  rñ   )rR   r&  s     r;   Úadd_transformÚApplication.add_transformÓ  s   € Ø�‰×Ñ˜Õ/r:   Úmethodsc                 óÜ  ^• [        T[        R                  5      (       a.  U R                  [	        U4S j[        T5       5       5      5        g [        T[        5      (       a  T H  nU R                  U5        M     g TR                  5        HZ  u  p4UR                  S5      (       a  M  [        US5      (       d  M0  US   R                  5       US   :X  d  ML  X@R                  U'   M\     g )Nc              3   ó>   >#   • U  H  o[        TU5      4v •  M     g 7frM   ©rU  )rO   rP   r*  s     €r;   rS   Ú/Application._load_ui_methods.<locals>.<genexpr>Ø  ó   øé € Ð&VÊÀA¬7°7¸AÓ+>Õ'?Êùó   ƒr¨  Ú__call__r   )r¸   ÚtypesÚ
ModuleTyper  r2  ÚdirrK  r^   r  r  rz  r]   )rR   r*  rQ   r¨   Úfns    `   r;   r  ÚApplication._load_ui_methodsÖ  sª   ø€ Ü�gœu×/Ñ/×0Ñ0Ø×!Ñ!¤$Ô&VÌÈWÌÓ&VÓ"VÕWÜ˜¤×&Ñ&Û�Ø×%Ñ% aÖ(ò ð $ŸM™MžO‘�àŸ™¨×,Ó,Ü  J×/Ó/Ø˜Q™Ÿ™›¨4°©7Õ2à,.—O‘O DÓ)ò ,r:   rV   c                 óÎ  ^• [        T[        R                  5      (       a.  U R                  [	        U4S j[        T5       5       5      5        g [        T[        5      (       a  T H  nU R                  U5        M     g [        T[        5      (       d   eTR                  5        H+  u  p4 [        U[        5      (       a  X@R                  U'   M+  M-     g ! [         a     M=  f = f)Nc              3   ó>   >#   • U  H  o[        TU5      4v •  M     g 7frM   r-  )rO   rP   rV   s     €r;   rS   Ú/Application._load_ui_modules.<locals>.<genexpr>ç  r/  r0  )r¸   r2  r3  r  r2  r4  rK  r^   rÐ  rœ  ra   r¿   )rR   rV   rQ   r¨   rÌ  s    `   r;   r  ÚApplication._load_ui_moduleså  s¶   ø€ Ü�gœu×/Ñ/×0Ñ0Ø×!Ñ!¤$Ô&VÌÈWÌÓ&VÓ"VÕWÜ˜¤×&Ñ&Û�Ø×%Ñ% aÖ(ò ô ˜g¤t×,Ñ,Ð,Ð,Ø$Ÿ]™]ž_‘	�ðÜ! #¤x×0Ñ0Ø03Ÿ™¨Ó-ñ 1ò -øô !ó Úðús   Â,#CÃ
C$Ã#C$rH   c                 óD   • U R                  U5      nUR                  5       $ rM   )Úfind_handlerÚexecute)rR   rH   Ú
dispatchers      r;   r1  ÚApplication.__call__ô  s#   € ð ×&Ñ& wÓ/ˆ
Ø×!Ñ!Ó#Ð#r:   Ú_HandlerDelegatec                 ó<  • U R                   R                  U5      nUb  [        SU5      $ U R                  R	                  S5      (       a:  U R                  UU R                  S   U R                  R	                  S0 5      5      $ U R                  U[        SS05      $ )Nr@  Údefault_handler_classÚdefault_handler_argsrš   rÙ  )r  r<  r+   ro   r¢   rö  ÚErrorHandler)rR   rH   rI   Úroutes       r;   r<  ÚApplication.find_handlerû  s™   € ð ×#Ñ#×0Ñ0°Ó9ˆØÑÜÐ*¨EÓ2Ð2à�=‰=×ÑÐ4×5Ñ5Ø×,Ñ,ØØ—‘Ð5Ñ6Ø—‘×!Ñ!Ð"8¸"Ó=óð ð ×(Ñ(¨´,ÀÐPSÐ@TÓUÐUr:   Útarget_classÚtarget_kwargsrx  ry  c                 ó   • [        XX#XE5      $ )a%  Returns `~.httputil.HTTPMessageDelegate` that can serve a request
for application and `RequestHandler` subclass.

:arg httputil.HTTPServerRequest request: current HTTP request.
:arg RequestHandler target_class: a `RequestHandler` class.
:arg dict target_kwargs: keyword arguments for ``target_class`` constructor.
:arg list path_args: positional arguments for ``target_class`` HTTP method that
    will be executed while handling a request (``get``, ``post`` or any other).
:arg dict path_kwargs: keyword arguments for ``target_class`` HTTP method.
)r@  )rR   rH   rG  rH  rx  ry  s         r;   rö  Ú Application.get_handler_delegate	  s   € ô$  Ø˜<¸	ó
ð 	
r:   r¨   rq   c                 ób   • U R                   R                  " U/UQ76 nUb  U$ [        SU-  5      e)a  Returns a URL path for handler named ``name``

The handler must be added to the application as a named `URLSpec`.

Args will be substituted for capturing groups in the `URLSpec` regex.
They will be converted to strings if necessary, encoded as utf8,
and url-escaped.
z%s not found in named urls)r  r«  ÚKeyError)rR   r¨   rq   Úreversed_urls       r;   r«  ÚApplication.reverse_url!	  s<   € ð ×*Ñ*×6Ò6°tÐC¸dÒCˆØÑ#ØÐäÐ3°dÑ:Ó;Ð;r:   r¦  c                 óŒ  • SU R                   ;   a  U R                   S   " U5        gUR                  5       S:  a  [        R                  nO5UR                  5       S:  a  [        R                  nO[        R
                  nSUR                  R                  5       -  nU" SUR                  5       UR                  5       U5        g)zùWrites a completed HTTP request to the logs.

By default writes to the python root logger.  To change
this behavior either subclass Application and override this method,
or pass a function in the application settings dictionary as
``log_function``.
Úlog_functionNr÷   r‘  g     @�@z%d %s %.2fms)	ro   r¦   r   Úinfor™  rà  rH   Úrequest_timerŽ  )rR   r¦  Ú
log_methodrR  s       r;   r‡  ÚApplication.log_request0	  s¢   € ð ˜TŸ]™]Ó*Ø�M‰M˜.Ò)¨'Ô2ØØ×ÑÓ #Ó%Ü#Ÿ™‰JØ×ÑÓ! CÓ'Ü#×+Ñ+‰Jä#×)Ñ)ˆJØ §¡× <Ñ <Ó >Ñ>ˆÙØØ×ÑÓ Ø×$Ñ$Ó&Øõ		
r:   )rü  r  ro   ro  r]   ra   r  r0  rM   )&r5   r6   r7   r8   r°  r"   r   r¹   r%   r)   r    rX   ÚsocketÚ	AF_UNSPECr�   ÚnetutilÚ_DEFAULT_BACKLOGrD  ÚAddressFamilyrÓ   r
   r  r$  r(  r  r  r   rµ  r#   r1  r<  r=   r   rº   rö  r«  r‡  r9   r4   r:   r;   rG   rG     s7  † ñPðh )-Ø&*Ø>Bñ	6à˜9Ñ%ð6ð ˜s‘mð6ð ˜T $Ð'8Ñ"9Ñ:Ñ;ð	6ð
 ð6ð 
õ6ðv "&ð*ð
 (.×'7Ñ'7Ø—‘×7Ñ7Ø#Ø ò*àð*ð ˜#‘ð*ð
 ×$Ñ$ð*ð ð*ð ˜‰}ð*ð ð*ð ð*ð 
ö*ðX¨ð ¸Yð È4ô ð 0¨TÐ2CÑ-Dð 0Èô 0ð/¨ð /°ô /ð¨ð °ô ð$Ø×1Ñ1ð$à	�)˜D‘/Ñ	"ô$ðVØ×1Ñ1ðVØ=@ðVà	ôVð( 37Ø+/Ø26ñ
à×+Ñ+ð
ð ˜>Ñ*ð
ð    S¨# X¡Ñ/ð	
ð
 ˜D ™KÑ(ð
ð ˜d 3¨ :Ñ.Ñ/ð
ð 
õ
ð,< ð <¨Cð <°Cô <ð
 >ð 
°d÷ 
r:   rG   c                   ó4  • \ rS rSrS\S\R                  S\\   S\	\
\\4      S\	\\      S\	\
\\4      SS	4S
 jrS\\R"                  \R$                  4   S\R&                  S\	\S	      4S jrS\S\	\S	      4S jrSS jrSS jrS\	\S	      4S jrSrg	)r@  iJ	  rF   rH   Úhandler_classÚhandler_kwargsrx  ry  rJ   Nc                 óì   • Xl         UR                  U l        X l        X0l        U=(       d    0 U l        U=(       d    / U l        U=(       d    0 U l        / U l        [        U R                  5      U l	        g rM   )
rF   rc   rH   r[  r\  rx  ry  Úchunksr€   rÒ  )rR   rF   rH   r[  r\  rx  ry  s          r;   rX   Ú_HandlerDelegate.__init__K	  sa   € ð 'ÔØ!×,Ñ,ˆŒØŒØ*ÔØ,×2°ˆÔØ"Ÿ bˆŒØ&×,¨"ˆÔØˆŒÜ#;¸D×<NÑ<NÓ#OˆÕ r:   rÁ  rÿ  c                 óx   • U R                   (       a)  [        5       U R                  l        U R	                  5       $ g rM   )rÒ  r   rH   r�   r=  )rR   rÁ  rÿ  s      r;   Úheaders_receivedÚ!_HandlerDelegate.headers_received^	  s*   € ð
 ×#×#Ü(.«ˆD�L‰LÔ%Ø—<‘<“>Ð!Ør:   Údatac                 ó’   • U R                   (       a  U R                  R                  U5      $ U R                  R	                  U5        g rM   )rÒ  r¦  r„  r^  rñ   )rR   rc  s     r;   r„  Ú_HandlerDelegate.data_receivedh	  s5   € Ø×#×#Ø—<‘<×-Ñ-¨dÓ3Ð3à�K‰K×Ñ˜tÔ$Ør:   c                 óÜ   • U R                   (       a!  [        U R                  R                  S 5        g SR	                  U R
                  5      U R                  l        U R                  5         g )Nr:   )rÒ  r   rH   r�   rc  r^  Úbodyr=  rj   s    r;   rE  Ú_HandlerDelegate.finisho	  sC   € Ø×#×#Ü.¨t¯|©|×/HÑ/HÈ$ÕOð !$§¡¨¯©Ó 5ˆD�L‰LÔØ�L‰L�Nr:   c                 ój   • U R                   (       a  U R                  R                  5         g S U l        g rM   )rÒ  r¦  re   r^  rj   s    r;   re   Ú$_HandlerDelegate.on_connection_closex	  s"   € Ø×#×#Ø�L‰L×,Ñ,Õ.àˆD�Kr:   c                 óø  • U R                   R                  R                  SS5      (       dN  [        R                     [        R
                  R                  5        H  nUR                  5         M     S S S 5        U R                   R                  R                  SS5      (       d:  U R                   R                  R                  S[        5      nUR                  5         U R                  " U R                   U R                  40 U R                  D6U l        U R                   R                   Vs/ s H  o3" U R                  5      PM     nnU R                  (       a  [        5       U R                  l        ["        R$                  " U R                  R&                  " U/U R(                  Q70 U R*                  D65      nUR-                  S 5        U R                  R                   $ ! , (       d  f       GNz= fs  snf )Nr  Tr  rL  c                 ó"   • U R                  5       $ rM   )r~  )Úfs    r;   rû  Ú*_HandlerDelegate.execute.<locals>.<lambda>�	  s
   € ¨¯©¬
r:   )rF   ro   r¢   r=   r—  r˜  rò   ÚresetrM  r[  rH   r\  r¦  ro  rÒ  r   r\   r	   Úconvert_yieldedr  rx  ry  Úadd_done_callback)rR   r¡  rL  r¢  ro  Úfuts         r;   r=  Ú_HandlerDelegate.execute~	  sƒ  € ð ×Ñ×(Ñ(×,Ñ,Ð-FÈ×MÑMÜ×5Ó5Ü,×>Ñ>×EÑEÖG�FØ—L‘L–Nñ H÷ 6ð ×Ñ×(Ñ(×,Ñ,Ð-@À$×GÑGØ#'×#3Ñ#3×#<Ñ#<×#@Ñ#@Ø&Ô(9ó$Ð ð !×&Ñ&Ô(à×)Ò)Ø×Ñ˜dŸl™lñ
Ø.2×.AÑ.Añ
ˆŒð 04×/?Ñ/?×/JÒ/JÓKÒ/J¨!�a˜Ÿ™–oÑ/Jˆ
ÐKà×#×#Ü,2«HˆD�L‰LÔ)ô ×!Ò!Ø�L‰L×!Ò! *ÐR¨t¯~©~ÒRÀ×AQÑAQÑRó
ˆð 	×ÑÑ2Ô3ð �|‰|×,Ñ,Ð,÷= 6Ö5üò Ls   ¼6G%Ä.G7Ç%
G4)
rF   r^  rc   r¦  r[  r\  rx  ry  rH   rÒ  r«  )r5   r6   r7   r8   rG   r   rµ  r)   r=   r"   r   r¹   r    r%   rº   rX   r!   ÚRequestStartLiner»  rŒ   r#   ra  r„  rE  re   r=  r9   r4   r:   r;   r@  r@  J	  s  † ðPà ðPð ×+Ñ+ðPð ˜NÑ+ð	Pð
 !  c¨3 h¡Ñ0ðPð ˜D ™KÑ(ðPð ˜d 3¨ :Ñ.Ñ/ðPð 
ôPð&à˜(×3Ñ3°X×5OÑ5OÐOÑPðð ×%Ñ%ðð 
�)˜D‘/Ñ	"ô	ð %ð ¨H°Y¸t±_Ñ,Eô ôôð#-˜ )¨D¡/Ñ2÷ #-r:   r@  c                   óR   • \ rS rSrSr  SS\S\\   S\S\SS4
S	 jjr	S\4S
 jr
Srg)rt   i¤	  a*  An exception that will turn into an HTTP error response.

Raising an `HTTPError` is a convenient alternative to calling
`RequestHandler.send_error` since it automatically ends the
current function.

To customize the response sent with an `HTTPError`, override
`RequestHandler.write_error`.

:arg int status_code: HTTP status code.  Must be listed in
    `httplib.responses <http.client.responses>` unless the ``reason``
    keyword argument is given.
:arg str log_message: Message to be written to the log for this error
    (will not be shown to the user unless the `Application` is in debug
    mode).  May contain ``%s``-style placeholders, which will be filled
    in with remaining positional parameters.
:arg str reason: Keyword-only argument.  The HTTP "reason" phrase
    to pass in the status line along with ``status_code`` (for example,
    the "Not Found" in ``HTTP/1.1 404 Not Found``).  Normally
    determined automatically from ``status_code``, but can be used
    to use a non-standard numeric code. This is not a general-purpose
    error message.
Nrš   r˜  rq   rI   rJ   c                 ó¤   • Xl         X l        X0l        UR                  SS 5      U l        U(       a   U(       d  UR                  SS5      U l        g g g )Nr›   Ú%z%%)rš   r˜  rq   r¢   r›   Úreplace)rR   rš   r˜  rq   rI   s        r;   rX   ÚHTTPError.__init__½	  sH   € ð 'ÔØ&ÔØŒ	Ø—j‘j ¨4Ó0ˆŒÞžtØ*×2Ñ2°3¸Ó=ˆDÕð  $ˆ;r:   c                 ó  • SU R                   U R                  =(       d*    [        R                  R	                  U R                   S5      4-  nU R
                  (       a"  US-   U R
                  U R                  -  -   S-   $ U$ )NzHTTP %d: %srž   rŠ  r‹  )rš   r›   r   r•   r¢   r˜  rq   )rR   rM  s     r;   Ú__str__ÚHTTPError.__str__Ë	  sr   € ØØ×ÑØ�K‰K×Nœ8×-Ñ-×1Ñ1°$×2BÑ2BÀIÓNð#
ñ 
ˆð ××Ø˜T‘> T×%5Ñ%5¸¿	¹	Ñ%AÑBÀSÑHÐHàˆNr:   )rq   r˜  r›   rš   )r‘  N)r5   r6   r7   r8   r°  rD  r"   r¹   r    rX   r{  r9   r4   r:   r;   rt   rt   ¤	  sT   † ñð4 Ø%)ñ>àð>ð ˜c‘]ð>ð ð	>ð
 ð>ð 
õ>ð˜÷ r:   rt   c                   ó   • \ rS rSrSrSrg)r’  iÖ	  ar  An exception that ends the request without producing an error response.

When `Finish` is raised in a `RequestHandler`, the request will
end (calling `RequestHandler.finish` if it hasn't already been
called), but the error-handling methods (including
`RequestHandler.write_error`) will not be called.

If `Finish()` was created with no arguments, the pending response
will be sent as-is. If `Finish()` was given an argument, that
argument will be passed to `RequestHandler.finish()`.

This can be a more convenient way to implement custom error pages
than overriding ``write_error`` (especially in library code)::

    if self.current_user is None:
        self.set_status(401)
        self.set_header('WWW-Authenticate', 'Basic realm="something"')
        raise Finish()

.. versionchanged:: 4.3
   Arguments passed to ``Finish()`` will be passed on to
   `RequestHandler.finish`.
r4   N)r5   r6   r7   r8   r°  r9   r4   r:   r;   r’  r’  Ö	  s   † ñò0 	r:   r’  c                   ó8   ^ • \ rS rSrSrS\SS4U 4S jjrSrU =r$ )ré   iò	  zÛException raised by `RequestHandler.get_argument`.

This is a subclass of `HTTPError`, so if it is uncaught a 400 response
code will be used instead of 500 (and a stack trace will not be logged).

.. versionadded:: 3.1
Úarg_namerJ   Nc                 ó8   >• [         TU ]  SSU-  5        Xl        g )Nr÷   zMissing argument %s)rW   rX   r  )rR   r  rg   s     €r;   rX   ÚMissingArgumentError.__init__û	  s   ø€ Ü‰Ñ˜Ð3°hÑ>Ô?Ø �r:   )r  )	r5   r6   r7   r8   r°  r¹   rX   r9   rÈ  rÉ  s   @r;   ré   ré   ò	  s    ø† ñð! ð !¨÷ !õ !r:   ré   c                   ó>   • \ rS rSrSrS\SS4S jrS
S jrS
S jrS	r	g)rD  i 
  zBGenerates an error response with ``status_code`` for all requests.rš   rJ   Nc                 ó&   • U R                  U5        g rM   )r£   )rR   rš   s     r;   rf   ÚErrorHandler.initialize
  s   € Ø�‰˜Õ$r:   c                 ó,   • [        U R                  5      erM   )rt   r”   rj   s    r;   ry   ÚErrorHandler.prepare
  s   € Ü˜×)Ñ)Ó*Ð*r:   c                 ó   • g rM   r4   rj   s    r;   rE  ÚErrorHandler.check_xsrf_cookie	
  rÍ   r:   r4   r«  )
r5   r6   r7   r8   r°  rD  rf   ry   rE  r9   r4   r:   r;   rD  rD   
  s"   † ÙLð% cð %¨dô %ô+÷r:   rD  c                   óH   • \ rS rSrSrSS\S\SS4S jjrS\S	\SS4S
 jr	Sr
g)ÚRedirectHandleri
  a  Redirects the client to the given URL for all GET requests.

You should provide the keyword argument ``url`` to the handler, e.g.::

    application = web.Application([
        (r"/oldpath", web.RedirectHandler, {"url": "/newpath"}),
    ])

`RedirectHandler` supports regular expression substitutions. E.g., to
swap the first and second parts of a path while preserving the remainder::

    application = web.Application([
        (r"/(.*?)/(.*?)/(.*)", web.RedirectHandler, {"url": "/{1}/{0}/{2}"}),
    ])

The final URL is formatted with `str.format` and the substrings that match
the capturing groups. In the above example, a request to "/a/b/c" would be
formatted like::

    str.format("/{1}/{0}/{2}", "a", "b", "c")  # -> "/b/a/c"

Use Python's :ref:`format string syntax <formatstrings>` to customize how
values are substituted.

.. versionchanged:: 4.5
   Added support for substitutions into the destination URL.

.. versionchanged:: 5.0
   If any query arguments are present, they will be copied to the
   destination URL.
rø   r@  rJ   Nc                 ó   • Xl         X l        g rM   )Ú_urlÚ
_permanent)rR   rø   r@  s      r;   rf   ÚRedirectHandler.initialize1
  s   € ØŒ	Ø#�r:   rq   rI   c                 ó4  • U R                   R                  " U0 UD6nU R                  R                  (       aH  [        R
                  " U[        [        R                  " U R                  R                  5      5      5      nU R                  X0R                  S9  g )NrØ  )
rŒ  rš  rH   rà   r   Ú
url_concatrK  Ú	qs_to_qslrF  r�  )rR   rq   rI   Úto_urls       r;   r¢   ÚRedirectHandler.get5
  sl   € Ø—‘×!Ò! 4Ð2¨6Ñ2ˆØ�<‰<×'×'ä×(Ò(ØÜ”X×'Ò'¨¯©×(DÑ(DÓEÓFóˆFð 	�‰�f¯©ˆÒ8r:   )r�  rŒ  r¬  )r5   r6   r7   r8   r°  r¹   rÓ   rf   r    r¢   r9   r4   r:   r;   rŠ  rŠ  
  s<   † ññ@$˜cð $¨dð $¸dõ $ð9˜ð 9¨ð 9°÷ 9r:   rŠ  c                   ó²  • \ rS rSrSrSr0 r\R                  " 5       r	S*S\
S\\
   SS4S jjr\S+S	 j5       rS\
S\S   4S
 jrS,S\
S\SS4S jjrS\\
   4S jrS+S jrS\4S jr\S\
S\
S\
4S j5       rS\
S\
S\\
   4S jr\ S-S\
S\\   S\\   S\\SS4   4S jj5       r\S\
S\
4S j5       rS\R<                  4S jrS\4S jr S\\!RB                     4S jr"S\
4S jr#S\
SS4S jr$S\
S\\!RB                     S\
S\4S  jr%\ S,S!\&\
\'4   S\
S"\S\
4S# jj5       r(S$\
S\
4S% jr)\S!\&\
\'4   S\
S\\
   4S& j5       r*\S'\
S\\
   4S( j5       r+S)r,g).rM  i@
  a…  A simple handler that can serve static content from a directory.

A `StaticFileHandler` is configured automatically if you pass the
``static_path`` keyword argument to `Application`.  This handler
can be customized with the ``static_url_prefix``, ``static_handler_class``,
and ``static_handler_args`` settings.

To map an additional path to this handler for a static data directory
you would add a line to your application like::

    application = web.Application([
        (r"/content/(.*)", web.StaticFileHandler, {"path": "/var/www"}),
    ])

The handler constructor requires a ``path`` argument, which specifies the
local root directory of the content to be served.

Note that a capture group in the regex is required to parse the value for
the ``path`` argument to the get() method (different than the constructor
argument above); see `URLSpec` for details.

To serve a file like ``index.html`` automatically when a directory is
requested, set ``static_handler_args=dict(default_filename="index.html")``
in your application settings, or add ``default_filename`` as an initializer
argument for your ``StaticFileHandler``.

To maximize the effectiveness of browser caching, this class supports
versioned urls (by default using the argument ``?v=``).  If a version
is given, we instruct the browser to cache this file indefinitely.
`make_static_url` (also available as `RequestHandler.static_url`) can
be used to construct a versioned url.

This handler is intended primarily for use in development and light-duty
file serving; for heavy traffic it will be more efficient to use
a dedicated static file server (such as nginx or Apache).  We support
the HTTP ``Accept-Ranges`` mechanism to return partial content (because
some browsers require this functionality to be present to seek in
HTML5 audio or video).

**Subclassing notes**

This class is designed to be extensible by subclassing, but because
of the way static urls are generated with class methods rather than
instance methods, the inheritance patterns are somewhat unusual.
Be sure to use the ``@classmethod`` decorator when overriding a
class method.  Instance methods may use the attributes ``self.path``
``self.absolute_path``, and ``self.modified``.

Subclasses should only override methods discussed in this section;
overriding other methods is error-prone.  Overriding
``StaticFileHandler.get`` is particularly problematic due to the
tight coupling with ``compute_etag`` and other methods.

To change the way static urls are generated (e.g. to match the behavior
of another server or CDN), override `make_static_url`, `parse_url_path`,
`get_cache_time`, and/or `get_version`.

To replace all interaction with the filesystem (e.g. to serve
static content from a database), override `get_content`,
`get_content_size`, `get_modified_time`, `get_absolute_path`, and
`validate_absolute_path`.

.. versionchanged:: 3.1
   Many of the methods for subclasses were added in Tornado 3.1.
i ÌNr	  Údefault_filenamerJ   c                 ó   • Xl         X l        g rM   )Úrootr•  )rR   r	  r•  s      r;   rf   ÚStaticFileHandler.initializeˆ
  s   € ØŒ	Ø 0Õr:   c                 ó^   • U R                      0 U l        S S S 5        g ! , (       d  f       g = frM   )Ú_lockÚ_static_hashesrÑ  s    r;   ro  ÚStaticFileHandler.resetŒ
  s   € à�Y‹YØ!#ˆCÔ÷ �YŽYús   �ž
,c                 ó"   • U R                  USS9$ )NF)Úinclude_body)r¢   ©rR   r	  s     r;   r·  ÚStaticFileHandler.head‘
  s   € Ø�x‰x˜¨5ˆxÐ1Ð1r:   rž  c              ƒ   ón  #   • U R                  U5      U l        AU R                  U R                  U R                  5      nU R	                  U R                  U5      U l        U R
                  c  g U R                  5       U l        U R                  5         U R                  5       (       a  U R                  S5        g S nU R                  R                  R                  S5      nU(       a  [        R                  " U5      nU R!                  5       nU(       aÆ  Uu  pxUb  US:  a  Xv-  nUS:  a  SnUb  Xv:¼  d  Ub  Xx:¼  d  US:X  a:  U R                  S5        U R#                  SS5        U R#                  SSU< 35        g Ub  X†:”  a  UnXh=(       d    UU=(       d    S-
  :w  a8  U R                  S	5        U R#                  S[        R$                  " XxU5      5        OS =pxUb  Ub  X‡-
  n	OUb  Un	O
Ub  Xg-
  n	OUn	U R#                  S
U	5        U(       ah  U R'                  U R
                  Xx5      n
[)        U
[*        5      (       a  U
/n
U
 H-  n U R-                  U5        U R/                  5       I S h  v•N   M/     g U R                  R4                  S:X  d   eg  N&! [0        R2                   a       g f = f7f)NrÈ  ÚRanger   i   r‰   ræ  zContent-Rangezbytes */éÎ   rË  r@   )Úparse_url_pathr	  Úget_absolute_pathr—  Úvalidate_absolute_pathÚabsolute_pathÚget_modified_timeÚmodifiedÚset_headersÚshould_return_304r£   rH   rÿ  r¢   r   Ú_parse_request_rangeÚget_content_sizer­   Ú_get_content_rangeÚget_contentr¸   rº   rN  rÃ  r   r„   r¹  )rR   r	  rž  r§  Úrequest_rangeÚrange_headerÚsizer  ÚendrÖ  ÚcontentrH  s               r;   r¢   ÚStaticFileHandler.get”
  sp  é € à×'Ñ'¨Ó-ˆŒ	ØØ×.Ñ.¨t¯y©y¸$¿)¹)ÓDˆØ!×8Ñ8¸¿¹ÀMÓRˆÔØ×ÑÑ%Øà×.Ñ.Ó0ˆŒØ×ÑÔà×!Ñ!×#Ñ#Ø�O‰O˜CÔ ØàˆØ—|‘|×+Ñ+×/Ñ/°Ó8ˆÞô %×9Ò9¸,ÓGˆMà×$Ñ$Ó&ˆÞØ&‰JˆEØÑ  U¨Q£YØ‘�Ø˜1“9Ø�EàÑ!Ø“] s¡¸5»<Ø˜“ð —‘ Ô$Ø—‘ °Ô=Ø—‘¡ÂÐ1GÔHØØ‰ 3£:ð �ð
 Ÿ˜t¨¯
°Ñ3Ó3Ø—‘ Ô$Ø—‘Ø#¤X×%@Ò%@ÀÈTÓ%Rôøð ÐˆEàÑ ¡Ø ™[‰NØ‰_Ø ‰NØÑØ!™\‰Nà!ˆNØ�‰Ð(¨.Ô9æØ×&Ñ& t×'9Ñ'9¸5ÓFˆGÜ˜'¤5×)Ñ)Ø"˜)�Û �ðØ—J‘J˜uÔ%ØŸ*™*›,×&Ò&ò !ð —<‘<×&Ñ&¨&Ó0Ð0Ñ0ñ	 'øÜ×1Ñ1ó Úðüs<   ‚I
J5É$JÉ1JÉ2JÉ6"J5ÊJÊJ2Ê.J5Ê1J2Ê2J5c                 ót   • U R                   c   eU R                  U R                   5      nU(       d  gSU< S3$ )z÷Sets the ``Etag`` header based on static url version.

This allows efficient ``If-None-Match`` checks against cached
versions, and sends the correct ``Etag`` for a partial response
(i.e. the same ``Etag`` as the full file).

.. versionadded:: 3.1
NÚ")r§  Ú_get_cached_version)rR   Úversion_hashs     r;   r^  ÚStaticFileHandler.compute_etagç
  s@   € ð ×!Ñ!Ñ-Ð-Ð-Ø×/Ñ/°×0BÑ0BÓCˆÞØð ã%Ð'Ð'r:   c                 óp  • U R                  SS5        U R                  5         U R                  b  U R                  SU R                  5        U R                  5       nU(       a  U R                  SU5        U R	                  U R
                  U R                  U5      nUS:”  az  U R                  S[        R                  R                  [        R                  R                  5      [        R                  " US9-   5        U R                  S	S
[        U5      -   5        U R                  U R
                  5        g)zMSets the content and caching headers on the response.

.. versionadded:: 3.1
zAccept-Rangesrº   NzLast-Modifiedr‰   r   ÚExpires)ÚsecondszCache-Controlzmax-age=)r­   rÐ  r©  Úget_content_typeÚget_cache_timer	  r¾   r  r  r  r  r¹   Úset_extra_headers)rR   Úcontent_typeÚ
cache_times      r;   rª  ÚStaticFileHandler.set_headersö
  sé   € ð
 	�‰˜¨Ô1Ø×ÑÔà�=‰=Ñ$Ø�O‰O˜O¨T¯]©]Ô;à×,Ñ,Ó.ˆÞØ�O‰O˜N¨LÔ9à×(Ñ(¨¯©°D·M±MÀ<ÓPˆ
Ø˜‹>Ø�O‰OØÜ×!Ñ!×%Ñ%¤h×&7Ñ&7×&;Ñ&;Ó<Ü×$Ò$¨ZÑ8ñ9ôð
 �O‰O˜O¨Z¼#¸j»/Ñ-IÔJà×Ñ˜tŸy™yÕ)r:   c                 ó¬  • U R                   R                  R                  S5      (       a  U R                  5       $ U R                   R                  R                  S5      nUbr  [        R
                  R                  U5      nUR                  c'  UR                  [        R                  R                  S9nU R                  c   eX R                  :¼  a  gg)zWReturns True if the headers indicate that we should return 304.

.. versionadded:: 3.1
rd  zIf-Modified-Since)ÚtzinfoTF)rH   rÿ  r¢   rÑ  ÚemailÚutilsÚparsedate_to_datetimerÅ  rx  r¾   r  r  r©  )rR   Ú	ims_valueÚif_sinces      r;   r«  Ú#StaticFileHandler.should_return_304  s®   € ð �<‰<×Ñ×#Ñ# O×4Ñ4Ø×)Ñ)Ó+Ð+ð —L‘L×(Ñ(×,Ñ,Ð-@ÓAˆ	ØÑ Ü—{‘{×8Ñ8¸ÓCˆHØ�‰Ñ&Ø#×+Ñ+´8×3DÑ3D×3HÑ3HÐ+ÐI�Ø—=‘=Ñ,Ð,Ð,ØŸ=™=Ó(Øàr:   r—  c                 ó~   • [         R                  R                  [         R                  R                  X5      5      nU$ )a¢  Returns the absolute location of ``path`` relative to ``root``.

``root`` is the path configured for this `StaticFileHandler`
(in most cases the ``static_path`` `Application` setting).

This class method may be overridden in subclasses.  By default
it returns a filesystem path, but other strings may be used
as long as they are unique and understood by the subclass's
overridden `get_content`.

.. versionadded:: 3.1
)r•  r	  Úabspathrc  )rÌ  r—  r	  rÍ  s       r;   r¥  Ú#StaticFileHandler.get_absolute_path&  s(   € ô —'‘'—/‘/¤"§'¡'§,¡,¨tÓ":Ó;ˆØˆr:   r§  c                 ó  • [         R                  R                  U5      nUR                  [         R                  R                  5      (       d  U[         R                  R                  -  nU[         R                  R                  -   R                  U5      (       d  [        SSU R                  5      e[         R                  R                  U5      (       a¾  U R                  b±  U R                  R                  R                  S5      (       d^  U R                  R                  R                  S5      (       a  [        SS5      eU R                  U R                  R                  S-   SS9  g[         R                  R                  X R                  5      n[         R                  R                  U5      (       d  [        S	5      e[         R                  R                  U5      (       d  [        SS
U R                  5      eU$ )aˆ  Validate and return the absolute path.

``root`` is the configured path for the `StaticFileHandler`,
and ``path`` is the result of `get_absolute_path`

This is an instance method called during request processing,
so it may raise `HTTPError` or use methods like
`RequestHandler.redirect` (return None after redirecting to
halt further processing).  This is where 404 errors for missing files
are generated.

This method may modify the path before returning it, but note that
any such modifications will not be understood by `make_static_url`.

In instance methods, this method's result is available as
``self.absolute_path``.

.. versionadded:: 3.1
rA  z"%s is not in root static directoryNr­  z//z-cannot redirect path with two initial slashesTrØ  rÙ  z%s is not a file)r•  r	  rÍ  rÚ  Úsepr  rt   Úisdirr•  rH   rF  rc  ÚexistsÚisfile)rR   r—  r§  s      r;   r¦  Ú(StaticFileHandler.validate_absolute_path7  sf  € ô0 �w‰w�‰˜tÓ$ˆØ�}‰}œRŸW™WŸ[™[×)Ñ)ð ”B—G‘G—K‘KÑˆDð ¤§¡§¡Ñ+×7Ñ7¸×=Ñ=Ü˜CÐ!EÀtÇyÁyÓQÐQÜ�7‰7�=‰=˜×'Ñ'¨D×,AÑ,AÑ,Mð —<‘<×$Ñ$×-Ñ-¨c×2Ñ2Ø—<‘<×$Ñ$×/Ñ/°×5Ñ5ô $ØÐLóð ð —‘˜dŸl™l×/Ñ/°#Ñ5À�ÑFØÜŸG™GŸL™L¨×8MÑ8MÓNˆMÜ�w‰w�~‰~˜m×,Ñ,Ü˜C“.Ð Ü�w‰w�~‰~˜m×,Ñ,Ü˜CÐ!3°T·Y±YÓ?Ð?ØÐr:   rÍ  r  r³  c              #   ó8  #   • [        US5       nUb  UR                  U5        Ub  X2=(       d    S-
  nOSn SnUb  XV:  a  UnUR                  U5      nU(       a  Ub  U[        U5      -  nUv •  OUb  US:X  d   e SSS5        gMQ  ! , (       d  f       g= f7f)a
  Retrieve the content of the requested resource which is located
at the given absolute path.

This class method may be overridden by subclasses.  Note that its
signature is different from other overridable class methods
(no ``settings`` argument); this is deliberate to ensure that
``abspath`` is able to stand on its own as a cache key.

This method should either return a byte string or an iterator
of byte strings.  The latter is preferred for large files
as it helps reduce memory fragmentation.

.. versionadded:: 3.1
ÚrbNr   i   )ÚopenÚseekÚreadrÍ  )rÌ  rÍ  r  r³  ÚfileÚ	remainingÚ
chunk_sizerH  s           r;   r¯  ÚStaticFileHandler.get_contentr  s§   é € ô$ �'˜4Ô  DØÑ Ø—	‘	˜%Ô Ø‰Ø§:¨AÑ.‘	à �	ØØ&�
ØÑ(¨YÓ-CØ!*�JØŸ	™	 *Ó-�ÞØ Ñ,Ø!¤S¨£ZÑ/˜	Ø“Kà Ñ,Ø(¨A›~Ð-˜~Ø÷' !Ð ñ ÷ !Õ üs#   ‚B�A/B	Á>	BÂB	Â	
BÂBc                 ó  • U R                  U5      n[        R                  " 5       n[        U[        5      (       a!  UR                  U5        UR                  5       $ U H  nUR                  U5        M     UR                  5       $ )zÎReturns a version string for the resource at the given path.

This class method may be overridden by subclasses.  The
default implementation is a SHA-512 hash of the file's contents.

.. versionadded:: 3.1
)r¯  rZ  Úsha512r¸   rº   rœ  r\  )rÌ  rÍ  rc  r]  rH  s        r;   Úget_content_versionÚ%StaticFileHandler.get_content_version™  so   € ð �‰˜wÓ'ˆÜ—’Ó!ˆÜ�dœE×"Ñ"Ø�M‰M˜$Ôð ×ÑÓ!Ð!ó �Ø—‘˜eÖ$ñ à×ÑÓ!Ð!r:   c                 ó¤   • U R                   c   e[        U S5      (       d%  [        R                  " U R                   5      U l        U R                  $ )NÚ_stat_result)r§  r  r•  Ústatrã  rj   s    r;   Ú_statÚStaticFileHandler._stat«  sD   € Ø×!Ñ!Ñ-Ð-Ð-Ü�t˜^×,Ñ,Ü "§¢¨×(:Ñ(:Ó ;ˆDÔØ× Ñ Ð r:   c                 ó:   • U R                  5       nUR                  $ )zõRetrieve the total size of the resource at the given path.

This method may be overridden by subclasses.

.. versionadded:: 3.1

.. versionchanged:: 4.0
   This method is now always called, instead of only when
   partial results are requested.
)rå  Úst_size)rR   Ústat_results     r;   r­  Ú"StaticFileHandler.get_content_size±  s   € ð —j‘j“lˆØ×"Ñ"Ð"r:   c                 ó¼   • U R                  5       n[        R                  R                  [        UR                  5      [        R
                  R                  5      nU$ )aH  Returns the time that ``self.absolute_path`` was last modified.

May be overridden in subclasses.  Should return a `~datetime.datetime`
object or None.

.. versionadded:: 3.1

.. versionchanged:: 6.4
   Now returns an aware datetime object instead of a naive one.
   Subclasses that override this method may return either kind.
)rå  r¾   ÚfromtimestamprD  Úst_mtimer  r  )rR   ré  r©  s      r;   r¨  Ú#StaticFileHandler.get_modified_time¿  sJ   € ð —j‘j“lˆô ×$Ñ$×2Ñ2Ü�×$Ñ$Ó%¤x×'8Ñ'8×'<Ñ'<ó
ˆð ˆr:   c                 ó†   • U R                   c   e[        R                  " U R                   5      u  pUS:X  a  gUb  gUb  U$ g)zXReturns the ``Content-Type`` header to be used for this request.

.. versionadded:: 3.1
rÿ  zapplication/gzipzapplication/octet-stream)r§  Ú	mimetypesÚ
guess_type)rR   Ú	mime_typeÚencodings      r;   r¾  Ú"StaticFileHandler.get_content_typeÙ  sV   € ð
 ×!Ñ!Ñ-Ð-Ð-Ü'×2Ò2°4×3EÑ3EÓFÑˆ	à�vÓØ%ð Ñ!Ø-ØÑ"ØÐð .r:   c                 ó   • g)z1For subclass to add extra headers to the responseNr4   rŸ  s     r;   rÀ  Ú#StaticFileHandler.set_extra_headersî  rË   r:   r©  rò  c                 óR   • SU R                   R                  ;   a  U R                  $ S$ )aH  Override to customize cache control behavior.

Return a positive number of seconds to make the result
cacheable for that amount of time or 0 to mark resource as
cacheable for an unspecified amount of time (subject to
browser heuristics).

By default returns cache expiry of 10 years for resources requested
with ``v`` argument.
ró   r   )rH   rÑ   ÚCACHE_MAX_AGE)rR   r	  r©  rò  s       r;   r¿  Ú StaticFileHandler.get_cache_timeò  s&   € ð &)¨D¯L©L×,BÑ,BÓ%Bˆt×!Ñ!ÐIÈÐIr:   ro   Úinclude_versionc                 ó„   • UR                  SS5      U-   nU(       d  U$ U R                  X5      nU(       d  U$ U< SU< 3$ )a­  Constructs a versioned url for the given path.

This method may be overridden in subclasses (but note that it
is a class method rather than an instance method).  Subclasses
are only required to implement the signature
``make_static_url(cls, settings, path)``; other keyword
arguments may be passed through `~RequestHandler.static_url`
but are not standard.

``settings`` is the `Application.settings` dictionary.  ``path``
is the static path being requested.  The url returned should be
relative to the current host.

``include_version`` determines whether the generated URL should
include the query string containing the version hash of the
file corresponding to the given ``path``.

r  r  z?v=)r¢   Úget_version)rÌ  ro   r	  rú  rø   r¹  s         r;   rN  Ú!StaticFileHandler.make_static_url  sC   € ð, �l‰lÐ.°
Ó;¸dÑBˆÞØˆJà—‘ xÓ6ˆÞØˆJã¢Ð.Ð.r:   Úurl_pathc                 ó–   • [         R                  R                  S:w  a*  UR                  S[         R                  R                  5      nU$ )zúConverts a static URL path into a filesystem path.

``url_path`` is the path component of the URL with
``static_url_prefix`` removed.  The return value should be
filesystem path relative to ``static_path``.

This is the inverse of `make_static_url`.
r­  )r•  r	  rÐ  rx  )rR   rþ  s     r;   r¤  Ú StaticFileHandler.parse_url_path!  s3   € ô �7‰7�;‰;˜#ÓØ×'Ñ'¨¬R¯W©W¯[©[Ó9ˆHØˆr:   c                 óN   • U R                  US   U5      nU R                  U5      $ )aÝ  Generate the version string to be used in static URLs.

``settings`` is the `Application.settings` dictionary and ``path``
is the relative location of the requested asset on the filesystem.
The returned value should be a string, or ``None`` if no version
could be determined.

.. versionchanged:: 3.1
   This method was previously recommended for subclasses to override;
   `get_content_version` is now preferred as it allows the base
   class to handle caching of the result.
rK  )r¥  r¸  )rÌ  ro   r	  Úabs_paths       r;   rü  ÚStaticFileHandler.get_version.  s,   € ð ×(Ñ(¨°-Ñ)@À$ÓGˆØ×&Ñ& xÓ0Ð0r:   r  c                 ó8  • U R                      U R                  nX;  a   U R                  U5      X!'   UR                  U5      nU(       a  UsS S S 5        $  S S S 5        g ! [         a    [        R
                  " SU5        S X!'    NTf = f! , (       d  f       g = f)NzCould not open static file %r)rš  r›  rà  r3  r   rà  r¢   )rÌ  r  ÚhashesÚhshs       r;   r¸  Ú%StaticFileHandler._get_cached_version?  s“   € à�Y‹YØ×'Ñ'ˆFØÓ%ð,Ø'*×'>Ñ'>¸xÓ'H�FÑ$ð —*‘*˜XÓ&ˆCÞØ÷ ‰Yð ÷ ð øô !ó ,Ü—M’MÐ"AÀ8ÔLØ'+�FÓ$ð,ú÷ ŒYð ús-   �B A ³BÁ %BÂBÂBÂBÂ
B)rã  r§  r•  r©  r	  r—  rM   r«  r¬  )NN)-r5   r6   r7   r8   r°  rø  r›  r±  r²  rš  r¹   r"   rf   Úclassmethodro  r#   r·  rÓ   r¢   r^  rª  r«  r¥  r¦  rD  r(   rº   r¯  rà  r•  ré  rå  r­  r¾   r¨  r¾  rÀ  r¿  r   r    rN  r¤  rü  r¸  r9   r4   r:   r;   rM  rM  @
  s•  † ñ@ðD %€Mà€NØ�NŠNÓ€Eñ1˜sð 1°h¸s±mð 1Ètõ 1ð ó$ó ð$ð2˜ð 2 ¨4¡ô 2ñQ1˜cð Q1°ð Q1Àõ Q1ðf(˜h s™mô (ô*ð4 4ô ð, ð Sð °ð ¸ó ó ðð 9¨3ð 9¸sð 9ÀxÐPSÁ}ô 9ðv àMQñ$Øð$Ø"*¨3¡-ð$Ø=EÀc¹]ð$à	�5˜$ Ð$Ñ	%ô$ó ð$ðL ð"¨#ð "°#ó "ó ð"ð"!�r—~‘~ô !ð# #ô #ð 8¨H×,=Ñ,=Ñ#>ô ð4. #ô .ð* cð ¨dô ðJØðJØ#+¨H×,=Ñ,=Ñ#>ðJØKNðJà	ôJð àJNñ/Ø˜C ˜H‘~ð/Ø-0ð/ØCGð/à	ô/ó ð/ð> sð ¨sô ð ð1 4¨¨S¨¡>ð 1¸ð 1ÀÈ#Áó 1ó ð1ð  ð¨3ð °8¸C±=ó ó ór:   rM  c                   óT   • \ rS rSrSrS\\R                  /S4   SS4S jrS	S jr	Sr
g)
ÚFallbackHandleriO  a  A `RequestHandler` that wraps another HTTP server callback.

The fallback is a callable object that accepts an
`~.httputil.HTTPServerRequest`, such as an `Application` or
`tornado.wsgi.WSGIContainer`.  This is most useful to use both
Tornado ``RequestHandlers`` and WSGI in the same server.  Typical
usage::

    wsgi_app = tornado.wsgi.WSGIContainer(
        django.core.handlers.wsgi.WSGIHandler())
    application = tornado.web.Application([
        (r"/foo", FooHandler),
        (r".*", FallbackHandler, dict(fallback=wsgi_app)),
    ])
ÚfallbackNrJ   c                 ó   • Xl         g rM   )r  )rR   r  s     r;   rf   ÚFallbackHandler.initialize`  s	   € ð !�r:   c                 óh   • U R                  U R                  5        SU l        U R                  5         g )NT)r  rH   rZ   r|   rj   s    r;   ry   ÚFallbackHandler.preparee  s#   € Ø�‰�d—l‘lÔ#ØˆŒØ�‰Õr:   )rZ   r  r«  )r5   r6   r7   r8   r°  r&   r   rµ  rf   ry   r9   r4   r:   r;   r
  r
  O  s4   † ñð !Ø  (×"<Ñ"<Ð!=¸tÐ!CÑDð!à	ô!÷
r:   r
  c                   ó¦   • \ rS rSrSrS\R                  SS4S jrS\S\R                  S	\
S
\S\\\R                  \
4   4
S jrS	\
S
\S\
4S jrSrg)rp  ik  zçA transform modifies the result of an HTTP request (e.g., GZip encoding)

Applications are not expected to create their own OutputTransforms
or interact with them directly; the framework chooses which transforms
(if any) to apply.
rH   rJ   Nc                 ó   • g rM   r4   ©rR   rH   s     r;   rX   ÚOutputTransform.__init__s  rm   r:   rš   rÿ  rH  Ú	finishingc                 ó
   • XU4$ rM   r4   )rR   rš   rÿ  rH  r  s        r;   r¸  Ú%OutputTransform.transform_first_chunkv  s   € ð  UÐ*Ð*r:   c                 ó   • U$ rM   r4   ©rR   rH  r  s      r;   r½  ÚOutputTransform.transform_chunk  s   € Øˆr:   r4   )r5   r6   r7   r8   r°  r   rµ  rX   rD  rŒ   rº   rÓ   r$   r¸  r½  r9   r4   r:   r;   rp  rp  k  s‡   † ñð × :Ñ :ð ¸tô ð+àð+ð ×%Ñ%ð+ð ð	+ð
 ð+ð 
ˆs�H×(Ñ(¨%Ð/Ñ	0ô+ð Uð °tð À÷ r:   rp  c                   óÔ   • \ rS rSrSr\" / SQ5      rSrSrS\	R                  SS4S	 jrS
\S\4S jrS\S\	R                   S\S\S\\\	R                   \4   4
S jrS\S\S\4S jrSrg)r  iƒ  a1  Applies the gzip content encoding to the response.

See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11

.. versionchanged:: 4.0
    Now compresses all mime types beginning with ``text/``, instead
    of just a whitelist. (the whitelist is still used for certain
    non-text mime types).
)zapplication/javascriptzapplication/x-javascriptzapplication/xmlzapplication/atom+xmlzapplication/jsonzapplication/xhtml+xmlzimage/svg+xmlé   i   rH   rJ   Nc                 óL   • SUR                   R                  SS5      ;   U l        g )Nrÿ  úAccept-Encodingr"  )rÿ  r¢   Ú	_gzippingr  s     r;   rX   ÚGZipContentEncoding.__init__¦  s    € Ø 7§?¡?×#6Ñ#6Ð7HÈ"Ó#MÑMˆ�r:   Úctypec                 óN   • UR                  S5      =(       d    XR                  ;   $ )Nztext/)r  ÚCONTENT_TYPES)rR   r   s     r;   Ú_compressible_typeÚ&GZipContentEncoding._compressible_type©  s!   € Ø×Ñ Ó(×G¨E×5GÑ5GÑ,GÐGr:   rš   rÿ  rH  r  c                 óp  • SU;   a  US==   S-  ss'   OSUS'   U R                   (       a|  [        UR                  SS5      5      R                  S5      S   nU R	                  U5      =(       a2    U(       + =(       d    [        U5      U R                  :¬  =(       a    SU;  U l         U R                   (       a|  S	US'   [        5       U l        [        R                  " S
U R                  U R                  S9U l        U R                  X45      nSU;   a"  U(       a  [        [        U5      5      US'   OUS	 XU4$ )NÚVaryz, Accept-Encodingr  r‰   r"  rø  r   r¨  rÿ  Úw)ÚmodeÚfileobjÚcompresslevelrË  )r  r   r¢   r   r#  rÍ  Ú
MIN_LENGTHr   Ú_gzip_valuerÿ  ÚGzipFileÚ
GZIP_LEVELÚ
_gzip_filer½  r¹   )rR   rš   rÿ  rH  r  r   s         r;   r¸  Ú)GZipContentEncoding.transform_first_chunk¬  s  € ð �WÓØ�F‹OÐ2Ñ2ŒOà/ˆG�F‰OØ�>�>Ü˜WŸ[™[¨¸Ó<Ó=×CÑCÀCÓHÈÑKˆEà×'Ñ'¨Ó.÷ 8Ø"”]×C¤c¨%£j°D·O±OÑ&C÷8à'¨wÑ6ð ŒNð
 �>�>Ø*0ˆGÐ&Ñ'Ü&›yˆDÔÜ"ŸmšmØ $×"2Ñ"2À$Ç/Á/ñˆDŒOð ×(Ñ(¨Ó:ˆEØ 7Ó*ö
 Ü03´C¸³J³�GÐ,Ò-àÐ 0Ð1Ø UÐ*Ð*r:   c                 óv  • U R                   (       a§  U R                  R                  U5        U(       a  U R                  R                  5         OU R                  R	                  5         U R
                  R                  5       nU R
                  R                  S5        U R
                  R                  S5        U$ )Nr   )	r  r/  rN  ÚcloserÃ  r,  ÚgetvalueÚtruncaterØ  r  s      r;   r½  Ú#GZipContentEncoding.transform_chunkÑ  s   € Ø�>�>Ø�O‰O×!Ñ! %Ô(ÞØ—‘×%Ñ%Õ'à—‘×%Ñ%Ô'Ø×$Ñ$×-Ñ-Ó/ˆEØ×Ñ×%Ñ% aÔ(Ø×Ñ×!Ñ! !Ô$Øˆr:   )r/  r,  r  )r5   r6   r7   r8   r°  r  r"  r.  r+  r   rµ  rX   r¹   rÓ   r#  rD  rŒ   rº   r$   r¸  r½  r9   r4   r:   r;   r  r  ƒ  sÀ   † ññ ò	
ó
€Mð €Jð €JðN × :Ñ :ð N¸tô NðH¨ð H°ô Hð#+àð#+ð ×%Ñ%ð#+ð ð	#+ð
 ð#+ð 
ˆs�H×(Ñ(¨%Ð/Ñ	0ô#+ðJ
 Uð 
°tð 
À÷ 
r:   r  c                 óv   ^ • [         R                  " T 5      S[        S[        [        S      4U 4S jj5       nU$ )a—  Decorate methods with this to require that the user be logged in.

If the user is not logged in, they will be redirected to the configured
`login url <RequestHandler.get_login_url>`.

If you configure a login url with a query parameter, Tornado will
assume you know what you're doing and use it as-is.  If not, it
will add a `next` parameter so the login page knows where to send
you once you're logged in.
rR   rJ   Nc                 óø  >• U R                   (       dÝ  U R                  R                  S;   a¸  U R                  5       nSU;  a�  [        R
                  R                  U5      R                  (       a  U R                  R                  5       nO/U R                  R                  c   eU R                  R                  nUS[        [        US95      -   -  nU R                  U5        g [        S5      eT" U /UQ70 UD6$ )NrÆ  r×  )ÚnextrA  )r§  rH   r¹  r  ÚurllibÚparseÚurlsplitÚschemeÚfull_urlrŒ  r   r2  rF  rt   )rR   rq   rI   rø   Únext_urlr¹  s        €r;   rÞ  Úauthenticated.<locals>.wrapperì  sË   ø€ ð × × Ø�|‰|×"Ñ" oÓ5Ø×(Ñ(Ó*�Ø˜c“>Ü—|‘|×,Ñ,¨SÓ1×8×8à#'§<¡<×#8Ñ#8Ó#:™à#Ÿ|™|×/Ñ/Ñ;Ð;Ð;Ø#'§<¡<×#3Ñ#3˜Ø˜3¤¬4°XÑ+>Ó!?Ñ?Ñ?�CØ—‘˜cÔ"ØÜ˜C“.Ð Ù�dÐ,˜TÒ, VÑ,Ð,r:   rà  rã  s   ` r;   Úauthenticatedr@  Þ  s@   ø€ ô ‡_‚_�VÓð-Üð-ä	”)˜D‘/Ñ	"ö-ó ð-ð& €Nr:   c                   óò   • \ rS rSrSrS\SS4S jr\S\4S j5       r	S\S	\S\
4S
 jrS\\
   4S jrS\\\
      4S jrS\\
   4S jrS\\\
      4S jrS\\
   4S jrS\\
   4S jrS\
S	\S\4S jrSrg)rœ  i  a  A re-usable, modular UI unit on a page.

UI modules often execute additional queries, and they can include
additional CSS and JavaScript that will be included in the output
page, which is automatically inserted on page render.

Subclasses of UIModule must override the `render` method.
r¦  rJ   Nc                 óv   • Xl         UR                  U l        UR                  U l        UR                  U l        g rM   )r¦  rH   r_   r   )rR   r¦  s     r;   rX   ÚUIModule.__init__  s(   € ØŒØ—‘ˆŒØ—*‘*ˆŒØ—n‘nˆ�r:   c                 ó.   • U R                   R                  $ rM   )r¦  r§  rj   s    r;   r§  ÚUIModule.current_user  s   € à�|‰|×(Ñ(Ð(r:   rq   rI   c                 ó   • [        5       e)z6Override in subclasses to return this module's output.r‚  ru   s      r;   ru  ÚUIModule.render  s   € ä!Ó#Ð#r:   c                 ó   • g)zBOverride to return a JavaScript string
to be embedded in the page.Nr4   rj   s    r;   rV  ÚUIModule.embedded_javascript  ó   € ð r:   c                 ó   • g)zÆOverride to return a list of JavaScript files needed by this module.

If the return values are relative paths, they will be passed to
`RequestHandler.static_url`; otherwise they will be used as-is.
Nr4   rj   s    r;   rW  ÚUIModule.javascript_files   ó   € ð r:   c                 ó   • g)zBOverride to return a CSS string
that will be embedded in the page.Nr4   rj   s    r;   rY  ÚUIModule.embedded_css(  rJ  r:   c                 ó   • g)zÂOverride to returns a list of CSS files required by this module.

If the return values are relative paths, they will be passed to
`RequestHandler.static_url`; otherwise they will be used as-is.
Nr4   rj   s    r;   rZ  ÚUIModule.css_files-  rM  r:   c                 ó   • g)zKOverride to return an HTML string that will be put in the <head/>
element.
Nr4   rj   s    r;   r[  ÚUIModule.html_head5  ó   € ð r:   c                 ó   • g)zVOverride to return an HTML string that will be put at the end of
the <body/> element.
Nr4   rj   s    r;   r\  ÚUIModule.html_body;  rT  r:   r	  c                 ó<   • U R                   R                  " U40 UD6$ )z.Renders a template and returns it as a string.)r¦  rT  )rR   r	  rI   s      r;   rT  ÚUIModule.render_stringA  s   € à�|‰|×)Ò)¨$Ñ9°&Ñ9Ð9r:   )r¦  r   rH   r_   )r5   r6   r7   r8   r°  r=   rX   r¶  r    r§  r¹   ru  r"   rV  r'   rW  rY  rZ  r[  r\  rº   rT  r9   r4   r:   r;   rœ  rœ    sÓ   † ñð% ð %°4ô %ð ð)˜có )ó ð)ð$˜Cð $¨3ð $°3ô $ð X¨c¡]ô ð
 (¨8°C©=Ñ"9ô ð˜h s™mô ð
˜8 H¨S¡MÑ2ô ð˜8 C™=ô ð˜8 C™=ô ð: #ð :°ð :¸÷ :r:   rœ  c                   ó*   • \ rS rSrS\S\S\4S jrSrg)r	  iF  ÚtextrI   rJ   c                 ó0   • [         R                  " U40 UD6$ rM   )r   r   )rR   rZ  rI   s      r;   ru  Ú_linkify.renderG  s   € Ü�~Š~˜dÑ- fÑ-Ð-r:   r4   N)r5   r6   r7   r8   r¹   r    ru  r9   r4   r:   r;   r	  r	  F  s   † ð.˜3ð .¨#ð .°#÷ .r:   r	  c                   ó"   • \ rS rSrS\4S jrSrg)r
  iK  rJ   c                 ó6   • U R                   R                  5       $ rM   )r¦  rª  rj   s    r;   ru  Ú_xsrf_form_html.renderL  s   € Ø�|‰|×*Ñ*Ó,Ð,r:   r4   N)r5   r6   r7   r8   r¹   ru  r9   r4   r:   r;   r
  r
  K  s   † ð-˜÷ -r:   r
  c                   óÆ   ^ • \ rS rSrSrS\SS4U 4S jjrS\S\S\	4S	 jr
S
\S\\   4S jrS\4S jrS\\   4S jrS\4S jrS\\   4S jrS\4S jrS\4S jrSrU =r$ )r  iP  a¸  UIModule that simply renders the given template.

{% module Template("foo.html") %} is similar to {% include "foo.html" %},
but the module version gets its own namespace (with kwargs passed to
Template()) instead of inheriting the outer template's namespace.

Templates rendered through this module also get access to UIModule's
automatic JavaScript/CSS features.  Simply call set_resources
inside the template and give it keyword arguments corresponding to
the methods on UIModule: {{ set_resources(js_files=static_url("my.js")) }}
Note that these resources are output once per template file, not once
per instantiation of the template, so they must not depend on
any arguments to the template.
r¦  rJ   Nc                 ó@   >• [         TU ]  U5        / U l        0 U l        g rM   )rW   rX   Ú_resource_listÚ_resource_dict)rR   r¦  rg   s     €r;   rX   ÚTemplateModule.__init__`  s    ø€ Ü‰Ñ˜Ô!à ˆÔØ ˆÕr:   r	  rI   c                 óN   ^ ^• S[         4UU 4S jjnT R                  " T4SU0UD6$ )NrJ   c                  ó¸   >• TTR                   ;  a+  TR                  R                  U 5        U TR                   T'   gTR                   T   U :w  a  [        S5      eg)NzCset_resources called with different resources for the same templater"  )rc  rb  rñ   rÂ   )rI   r	  rR   s    €€r;   Úset_resourcesÚ,TemplateModule.render.<locals>.set_resourcesg  sf   ø€ Ø˜4×.Ñ.Ó.Ø×#Ñ#×*Ñ*¨6Ô2Ø,2�×#Ñ# DÑ)ð ð ×&Ñ& tÑ,°Ó6Ü$ð:óð ð r:   rg  )r¹   rT  )rR   r	  rI   rg  s   ``  r;   ru  ÚTemplateModule.renderf  s1   ù€ ð
	¤s÷ 
	ð 
	ð ×!Ò! $ÑN°mÐNÀvÑNÐNr:   rý  c                 ó0   ^• U4S jU R                    5       $ )Nc              3   ó>   >#   • U  H  nTU;   d  M  UT   v •  M     g 7frM   r4   )rO   Úrrý  s     €r;   rS   Ú0TemplateModule._get_resources.<locals>.<genexpr>v  s   øé € Ð@Ò 3˜1°s¸a±x“��#–Ò 3ùs   ƒ
‘)rb  ©rR   rý  s    `r;   Ú_get_resourcesÚTemplateModule._get_resourcesu  s   ø€ Ü@ × 3Ò 3Ó@Ð@r:   c                 óB   • SR                  U R                  S5      5      $ )NÚ
rV  ©rc  ro  rj   s    r;   rV  Ú"TemplateModule.embedded_javascriptx  s   € Ø�y‰y˜×,Ñ,Ð-BÓCÓDÐDr:   c                 ó¸   • / nU R                  S5       HB  n[        U[        [        45      (       a  UR	                  U5        M1  UR                  U5        MD     U$ )NrW  ©ro  r¸   r   rº   rñ   rX  ©rR   r~  rm  s      r;   rW  ÚTemplateModule.javascript_files{  sN   € ØˆØ×$Ñ$Ð%7Ö8ˆAÜ˜!œl¬EÐ2×3Ñ3Ø—‘˜aÖ à—‘˜aÖ ñ	 9ð
 ˆr:   c                 óB   • SR                  U R                  S5      5      $ )Nrr  rY  rs  rj   s    r;   rY  ÚTemplateModule.embedded_css„  s   € Ø�y‰y˜×,Ñ,¨^Ó<Ó=Ð=r:   c                 ó¸   • / nU R                  S5       HB  n[        U[        [        45      (       a  UR	                  U5        M1  UR                  U5        MD     U$ )NrZ  rv  rw  s      r;   rZ  ÚTemplateModule.css_files‡  sM   € ØˆØ×$Ñ$ [Ö1ˆAÜ˜!œl¬EÐ2×3Ñ3Ø—‘˜aÖ à—‘˜aÖ ñ	 2ð
 ˆr:   c                 óB   • SR                  U R                  S5      5      $ )Nr"  r[  rs  rj   s    r;   r[  ÚTemplateModule.html_head�  ó   € Ø�w‰w�t×*Ñ*¨;Ó7Ó8Ð8r:   c                 óB   • SR                  U R                  S5      5      $ )Nr"  r\  rs  rj   s    r;   r\  ÚTemplateModule.html_body“  r  r:   )rc  rb  )r5   r6   r7   r8   r°  r=   rX   r¹   r    rº   ru  r'   ro  rV  rW  rY  rZ  r[  r\  r9   rÈ  rÉ  s   @r;   r  r  P  sª   ø† ñð! ð !°4÷ !ðO˜3ð O¨#ð O°%ô OðA #ð A¨(°3©-ô AðE Sô Eð (¨3¡-ô ð>˜cô >ð˜8 C™=ô ð9˜3ô 9ð9˜3÷ 9ò 9r:   r  c                   óv   • \ rS rSrSrS\S\\\\	   4   SS4S jr
S\S\S	\4   4S
 jrS\S\S	\4   4S jrSrg)r`   i—  zALazy namespace which creates UIModule proxies bound to a handler.r¦  ra   rJ   Nc                 ó   • Xl         X l        g rM   ©r¦  ra   )rR   r¦  ra   s      r;   rX   Ú_UIModuleNamespace.__init__š  s   € ð ŒØ$�r:   rý  .c                 óR   • U R                   R                  XR                  U   5      $ rM   )r¦  r¡  ra   rn  s     r;   Ú__getitem__Ú_UIModuleNamespace.__getitem__   s    € Ø�|‰|×&Ñ& s¯O©O¸CÑ,@ÓAÐAr:   c                 óX   •  X   $ ! [          a  n[        [        U5      5      eS nAff = frM   )rL  ÚAttributeErrorr¹   )rR   rý  r|  s      r;   Ú__getattr__Ú_UIModuleNamespace.__getattr__£  s.   € ð	)Ø‘9ÐøÜó 	)Ü ¤ Q£Ó(Ð(ûð	)ús   ‚ †
)�$¤)r„  )r5   r6   r7   r8   r°  r=   r   r¹   r)   rœ  rX   r&   r‡  r‹  r9   r4   r:   r;   r`   r`   —  sk   † ÙKð%Ø%ð%Ø37¸¸TÀ(¹^Ð8KÑ3Lð%à	ô%ðB˜sð B x°°S°Ñ'9ô Bð)˜sð ) x°°S°Ñ'9÷ )r:   r`   r4  r¨   r©   rŽ   Úclockr0  c           	      óœ  • Uc  [         nUc  [        R                  n[        [        [	        U" 5       5      5      5      n[
        R                  " [        U5      5      nUS:X  a8  [        U [        5      (       a   e[        XX&5      nSR                  X&U/5      nU$ US:X  až  S[        [        [        4   S[        4S jnSR                  SU" [        U=(       d    S5      5      U" U5      U" U5      U" U5      S	/5      n	[        U [        5      (       a  Uc   S
5       eUS:¼  d   S5       eX   n [        X	5      nX—-   $ [        SU-  5      e)Nr/   r  r0   rô   rJ   c                 óH   • [        S[        U 5      -  5      [        U 5      -   $ )Nz%d:)r   rÍ  )rô   s    r;   Úformat_fieldÚ)create_signed_value.<locals>.format_fieldÍ  s   € Ü˜¤ A£™Ó'¬$¨q«'Ñ1Ð1r:   r  r   r:   z2Key version must be set when sign key dict is usedz2Version must be at least 2 for key version supportzUnsupported version %d)ÚDEFAULT_SIGNED_VALUE_VERSIONr�   r   r¹   rD  Úbase64Ú	b64encoder¸   r2  Ú_create_signature_v1rc  r!   rº   Ú_create_signature_v2rÂ   )
r4  r¨   r©   rŽ   r�  r0  r'  Ú	signaturer�  Úto_signs
             r;   r*  r*  ª  sP  € ð �Ü.ˆØ�}Ü—	‘	ˆä”Sœ™U›W›Ó&Ó'€IÜ×ÒœT %›[Ó)€EØ�!ƒ|Ü˜f¤d×+Ñ+Ð+Ð+Ü(¨°uÓHˆ	Ø—	‘	˜5¨YÐ7Ó8ˆØˆØ	�A‹ð	2œE¤#¤u *Ñ-ð 	2´%ô 	2ð —)‘)àÙœS ×!1°Ó2Ó3Ù˜YÓ'Ù˜TÓ"Ù˜UÓ#Øðó	
ˆô �fœd×#Ñ#àÑ'ðDàCóDØ'à˜a“<ÐUÐ!UÓU�<ØÑ(ˆFä(¨Ó9ˆ	ØÑ"Ð"äÐ1°GÑ;Ó<Ð<r:   s   ^([1-9][0-9]*)\|(.*)$c                 óª   • [         R                  U 5      nUc  SnU$  [        UR                  S5      5      nUS:”  a  SnU$ ! [         a    Sn U$ f = f)Nr/   iç  )r6  r7  rD  r8  rÂ   )r©   rQ   rŽ   s      r;   Ú_get_versionrš  í  sk   € ô 	!×&Ñ& uÓ-€AØ�yØˆð €Nð	Ü˜!Ÿ'™' !›*“oˆGØ˜‹}ð �ð €Nøô ó 	Ø‰GØ€Nð	ús   ž"A ÁAÁAr6  r7  c                 ó&  • Uc  [         R                   nUc  [        nUS:”  a  [        SU-  5      eU(       d  g [        U5      n[	        U5      nXe:  a  g US:X  a$  [        U [        5      (       a   e[        XX#U5      $ US:X  a  [        XX#U5      $ g )Nr0   zUnsupported min_version %dr/   )	r�   Ú DEFAULT_SIGNED_VALUE_MIN_VERSIONrÂ   r   rš  r¸   r2  Ú_decode_signed_value_v1Ú_decode_signed_value_v2)r4  r¨   r©   r6  r�  r7  rŽ   s          r;   r9  r9    s™   € ð �}Ü—	‘	ˆØÑÜ6ˆØ�QƒÜÐ5¸ÑCÓDÐDÞØä�‹K€EÜ˜5Ó!€GàÓØØ�!ƒ|Ü˜f¤d×+Ñ+Ð+Ð+Ü& v°UÈ%ÓPÐPØ	�A‹Ü& v°UÈ%ÓPÐPàr:   c                 óV  • [        U5      R                  S5      n[        U5      S:w  a  g [        XUS   US   5      n[        R
                  " US   U5      (       d  [        R                  " SU5        g [        US   5      nXt" 5       US-  -
  :  a  [        R                  " SU5        g Xt" 5       S	-   :”  a  [        R                  " S
U5        g US   R                  S5      (       a  [        R                  " SU5        g  [        R                  " US   5      $ ! [         a     g f = f)Nr  é   r   r/   r0   zInvalid cookie signature %ré€Q zExpired cookie %ri€Þ( z1Cookie timestamp in future; possible tampering %ró   0zTampered cookie %r)r   r   rÍ  r•  rB  rC  r   r™  rD  r  r“  Ú	b64decoder3  )r4  r¨   r©   r6  r�  r  r—  r'  s           r;   r�  r�  #  s  € ô �‹K×Ñ˜dÓ#€EÜ
ˆ5ƒz�QƒØÜ$ V°5¸±8¸UÀ1¹XÓF€IÜ×Ò˜u Q™x¨×3Ñ3Ü�ŠÐ5°uÔ=ØÜ�E˜!‘H“€IØ�5“7˜\¨EÑ1Ñ1Ó1Ü�ŠÐ+¨UÔ3ØØ�5“7˜ZÑ'Ó'ô 	�ŠÐKÈUÔSØØˆQ�x×Ñ˜4× Ñ Ü�ŠÐ,¨eÔ4ØðÜ×Ò  a¡Ó)Ð)øÜó Ùðús   ÄD Ä
D(Ä'D(c                 ó´   • S[         S[        [         [         4   4S jnU SS  nU" U5      u  p2U" U5      u  pBU" U5      u  pRU" U5      u  pg[        U5      XEXg4$ )Nrô   rJ   c                 óŠ   • U R                  S5      u  pn[        U5      nUS U nX4US-    S:w  a  [        S5      eX4S-   S  nXS4$ )Nó   :r/   r  zmalformed v2 signed value field)Ú	partitionrD  rÂ   )rô   Úlengthr¨  ÚrestrP   Úfield_values         r;   Ú_consume_fieldÚ)_decode_fields_v2.<locals>._consume_fieldG  s\   € ØŸ+™+ dÓ+‰ˆ�4Ü�‹KˆØ˜2˜A�hˆð �A˜‘Eˆ?˜dÓ"ÜÐ>Ó?Ð?Ø˜‘E�Gˆ}ˆØÐ Ð r:   r0   )rº   r$   rD  )r©   r«  r©  r0  r'  Ú
name_fieldÚvalue_fieldÚ
passed_sigs           r;   Ú_decode_fields_v2r°  F  sp   € ð	!œ%ð 	!¤E¬%´¨,Ñ$7ô 	!ð ��ˆ9€DÙ& tÓ,Ñ€KÙ$ TÓ*�O€IÙ% dÓ+Ñ€JÙ,¨TÓ2Ñ€KÜˆ{Ó˜Y°KÐKÐKr:   c                 ó¬  •  [        U5      u  nnnnn	US [        U	5      *  n
[        U [        5      (       a   X   n [        X
5      n[        R                  " X›5      (       d  g U[        U5      :w  a  g [        U5      nXÄ" 5       US-  -
  :  a  g  [        R                  " U5      $ ! [         a     g f = f! [
         a     g f = f! [         a     g f = f)Nr¡  )r°  rÂ   rÍ  r¸   r2  rL  r–  rB  rC  r   rD  r“  r£  r3  )r4  r¨   r©   r6  r�  r0  Útimestamp_bytesr­  r®  r¯  Úsigned_stringÚexpected_sigr'  s                r;   rž  rž  Z  sõ   € ð	ô ˜eÓ$ñ	
ØØØØØð Ð,œS ›_Ð,Ð-€Mä�&œ$×Ñð	ØÑ(ˆFô (¨Ó>€LÜ×Ò˜z×8Ñ8ØØ”T˜$“ZÓØÜ�OÓ$€IØ�5“7˜\¨EÑ1Ñ1Ó1àðÜ×Ò Ó,Ð,øô) ó Ùðûô ó 	Ùð	ûô ó Ùðús4   ‚B& ¸B6 ÂC Â&
B3Â2B3Â6
CÃCÃ
CÃCc                 ó„   • [        U 5      n [        U 5      nUS:  a  g  [        U 5      u  n      nU$ ! [         a     g f = f)Nr0   )r   rš  r°  rÂ   )r©   rŽ   r0  r¨  s       r;   r=  r=  ‚  sU   € Ü�‹K€EÜ˜5Ó!€GØ�ƒ{ØðÜ"3°EÓ":Ñˆ�Q˜˜1˜að Ðøô ó Ùðús   Ÿ2 ²
?¾?r  c                 óÒ   • [         R                  " [        U 5      [        R                  S9nU H  nUR                  [        U5      5        M     [        UR                  5       5      $ ©N)Ú	digestmod)rB  Únewr   rZ  r[  rœ  r\  )r4  r  ÚhashrÎ  s       r;   r•  r•  �  sF   € Ü�8Š8”D˜“L¬G¯L©LÑ9€DÛˆØ�‰”D˜“JÖñ ä�—‘Ó Ó!Ð!r:   rô   c                 óÀ   • [         R                  " [        U 5      [        R                  S9nUR                  [        U5      5        [        UR                  5       5      $ r·  )rB  r¹  r   rZ  Úsha256rœ  r\  )r4  rô   rº  s      r;   r–  r–  –  s<   € Ü�8Š8”D˜“L¬G¯N©NÑ;€DØ‡K�K”�Q“ÔÜ�—‘Ó Ó!Ð!r:   r	  c                 ó.   ^ • [        U 4S jS 5       5      $ )Nc              3   óF   >#   • U  H  nTR                  U5      v •  M     g 7frM   rh  )rO   rf  r	  s     €r;   rS   Úis_absolute.<locals>.<genexpr>�  s   øé € ÐDÒ+C aˆt�‰˜q×!Ð!Ò+Cùs   ƒ!)r­  zhttp:zhttps:)Úany)r	  s   `r;   r€  r€  œ  s   ø€ ÜÔDÑ+CÓDÓDÐDr:   r0  )r®  NN)ˆr°  r“  r#  r¾   Úemail.utilsrÆ  rá  rÿ  rZ  rB  Úhttp.cookiesr  Úinspectr   Úior   rð  r¼   Úos.pathr•  r  rU  r�  r±  r�   r  r�   rè  r2  Úurllib.parser9  r   Útornado.concurrentr   r   r   r	   Útornado.httpserverr
   r   r   r   Útornado.logr   r   r   r   Útornado.escaper   r   Útornado.routingr   r   r   r   r   r   r   r   Útornado.utilr   r   r   rø   Útypingr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   ÚTYPE_CHECKINGr.   rº   rD  r½   r½  r¹   Ú_CookieSecretTypesÚ"MIN_SUPPORTED_SIGNED_VALUE_VERSIONÚ"MAX_SUPPORTED_SIGNED_VALUE_VERSIONr’  rœ  r2   r¾  r³  rŸ   Úobjectr=   rÊ  rÒ  rÓ   r€   rä  rè  rê  rG   rù  r@  r3  rt   r’  ré   rD  rŠ  rM  r
  rp  r  r@  rœ  r	  r
  r  r`   r  r*  r6  rš  r9  r�  r°  rž  r=  r•  r–  r€  r4   r:   r;   Ú<module>rÓ     s©  ðñ -ó^ Û Û Û Û Û Û Û Û Ý Ý Û Û Û Û 	Û Û 
Û Û Û Û Û Û Û Ý "ç IÝ Ý Ý )Ý Ý Ý ß 4Ñ 4Ý ß )÷	÷ 	ó 	÷ CÑ Bà€÷÷ ÷ ÷ õ   Û à	××Ýð
 �U˜L¨#¨w×/?Ñ/?À×ARÑARÐRÑS€à˜3  t¨C°¨H¡~°t¸CÀ¸JÑ7GÐGÑHÐ ð &'Ð "ðð &'Ð "ðð  !Ð ðð $%Ð  ð÷	ñ 	ñ !Ó"€ð —:’:ÐCÓDÐ ôL!�Vô L!ñ^6 Ð3¸>ÑJÐ ð˜TÐ"5Ñ6ð ¸4Ð@SÑ;Tô ð6$ $ ~Ñ"6ð $¸4ô $ðØ�S˜( 9¨T¡?Ñ3Ð3Ñ4ðàˆc�8˜I d™OÑ,Ð,Ñ-ôð:Ø�S˜( 9¨T¡?Ñ3Ð3Ñ4ðàˆc�8˜I d™OÑ,Ð,Ñ-ôô6$MÐ-ô $MôN{
Ð"ô {
ô|	W-�x×3Ñ3ô W-ôt/�	ô /ôd	ˆYô 	ô8!˜9ô !ô�>ô ô -9�nô -9ô`L˜ô Lô^�nô ô8�fô ô0X˜/ô Xðv"Ø�S˜( 9¨T¡?Ñ3Ð3Ñ4ð"àˆc�8˜I d™OÑ,Ð,Ñ-ô"ôJ@:ˆvô @:ôF.ˆxô .ô
-�hô -ô
D9�Xô D9ôN)˜ô )ð. "Ø+/Ø!%ñ;=Øð;=à
ð;=ð ��e�Ñð;=ð �c‰]ð	;=ð
 �H˜R ˜YÑ'Ñ(ð;=ð ˜#‘ð;=ð õ;=ð@ Ÿ:š:Ð&?Ó@Ð ð˜ð  #ô ð6 Ø+/Ø!%ñØðà
ðð ��s˜EÐ!Ñ"ðð ð	ð
 �H˜R ˜YÑ'Ñ(ðð ˜#‘ðð ˆe�_õð> Ø�#�u�*Ñð à
ð ð ð ð ð	 ð
 �B˜�IÑð ð ˆe�_ô ðFL˜Uð L u¨S°%¸ÀÀuÐ-LÑ'Mô Lð(%Øð%à
ð%ð ð%ð ð	%ð
 �B˜�IÑð%ð ˆe�_ô%ðP
 U¨3°¨:Ñ%6ð 
¸8ÀC¹=ô 
ð"  s¨E zÑ!2ð "¸EÀ#ÀuÀ*Ñ<Mð "ÐRWô "ð"  s¨E zÑ!2ð "°uð "Àô "ðE�cð E˜dõ Er:   