
    R?gl                        S SK Jr  S SKJrJr  S SKJrJrJrJ	r	J
r
Jr  S SKJr  S SKJrJr  S SKJr  S SKJrJr  S SKJrJrJrJ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'J(r(  S SK)r*S SK+J,r,J-r-J.r.J/r/J0r0J1r1  S SK2J3r3  S SK+r+\+Rh                  (       a
  S SK+J5r5J6r6J7r7   " S S\5      r8 " S S\5      r9 " S S\5      r: " S S\Rv                  5      r<\=S:X  a  \R|                  " \:5        \	" 5         gg)    )_unicode)genversion)HTTPResponse	HTTPErrorAsyncHTTPClientmain_RequestProxyHTTPRequest)httputil)HTTP1ConnectionHTTP1ConnectionParameters)IOLoop)StreamClosedErrorIOStream)ResolverOverrideResolver_client_ssl_defaultsis_valid_ip)gen_log)	TCPClientN)BytesIO)DictAnyCallableOptionalTypeUnion)TracebackType)DequeTupleListc                   F   ^  \ rS rSrSrS\SS4U 4S jjrS\4S jrSrU =r	$ )	HTTPTimeoutError,   zError raised by SimpleAsyncHTTPClient on timeout.

For historical reasons, this is a subclass of `.HTTPClientError`
which simulates a response code of 599.

.. versionadded:: 5.1
messagereturnNc                 "   > [         TU ]  SUS9  g NW  r&   super__init__selfr&   	__class__s     ;/usr/lib/python3/dist-packages/tornado/simple_httpclient.pyr.   HTTPTimeoutError.__init__5       g.    c                 ,    U R                   =(       d    S$ )NTimeoutr+   r0   s    r2   __str__HTTPTimeoutError.__str__8   s    ||(y(r5    
__name__
__module____qualname____firstlineno____doc__strr.   r9   __static_attributes____classcell__r1   s   @r2   r$   r$   ,   s,    / / /) ) )r5   r$   c                   F   ^  \ rS rSrSrS\SS4U 4S jjrS\4S jrSrU =r	$ )	HTTPStreamClosedError<   aB  Error raised by SimpleAsyncHTTPClient when the underlying stream is closed.

When a more specific exception is available (such as `ConnectionResetError`),
it may be raised instead of this one.

For historical reasons, this is a subclass of `.HTTPClientError`
which simulates a response code of 599.

.. versionadded:: 5.1
r&   r'   Nc                 "   > [         TU ]  SUS9  g r)   r,   r/   s     r2   r.   HTTPStreamClosedError.__init__H   r4   r5   c                 ,    U R                   =(       d    S$ )NStream closedr+   r8   s    r2   r9   HTTPStreamClosedError.__str__K   s    ||..r5   r;   r<   rE   s   @r2   rG   rG   <   s,    	/ / // / /r5   rG   c                   R  ^  \ rS rSrSr       SS\S\\\\4      S\S\\	   S\\\\
4      S	\\   S
\\   SS4U 4S jjjrSU 4S jjrS\S\\/S4   SS4S jrSS jrS\4S jrS\S\/ S4   S\\/S4   SS4S jrS\SS4S jrS\SS4S jrSS\S\\   SS4S jjrSrU =r$ )SimpleAsyncHTTPClientO   a7  Non-blocking HTTP client with no external dependencies.

This class implements an HTTP 1.1 client on top of Tornado's IOStreams.
Some features found in the curl-based AsyncHTTPClient are not yet
supported.  In particular, proxies are not supported, connections
are not reused, and callers cannot select the network interface to be
used.

This implementation supports the following arguments, which can be passed
to ``configure()`` to control the global singleton, or to the constructor
when ``force_instance=True``.

``max_clients`` is the number of concurrent requests that can be
in progress; when this limit is reached additional requests will be
queued. Note that time spent waiting in this queue still counts
against the ``request_timeout``.

``defaults`` is a dict of parameters that will be used as defaults on all
`.HTTPRequest` objects submitted to this client.

``hostname_mapping`` is a dictionary mapping hostnames to IP addresses.
It can be used to make local DNS changes when modifying system-wide
settings like ``/etc/hosts`` is not possible or desirable (e.g. in
unittests). ``resolver`` is similar, but using the `.Resolver` interface
instead of a simple mapping.

``max_buffer_size`` (default 100MB) is the number of bytes
that can be read into memory at once. ``max_body_size``
(defaults to ``max_buffer_size``) is the largest response body
that the client will accept.  Without a
``streaming_callback``, the smaller of these two limits
applies; with a ``streaming_callback`` only ``max_body_size``
does.

.. versionchanged:: 4.2
    Added the ``max_body_size`` argument.
Nmax_clientshostname_mappingmax_buffer_sizeresolverdefaultsmax_header_sizemax_body_sizer'   c                 ^  > [         TU ]  US9  Xl        [        R                  " 5       U l        0 U l        0 U l        X0l        X`l	        Xpl
        U(       a  X@l        SU l        O[        5       U l        SU l        Ub  [        U R                  US9U l        [        U R                  S9U l        g )N)rU   FT)rT   mapping)rT   )r-   
initializerQ   collectionsdequequeueactivewaitingrS   rV   rW   rT   own_resolverr   r   r   
tcp_client)	r0   rQ   rR   rS   rT   rU   rV   rW   r1   s	           r2   rZ    SimpleAsyncHTTPClient.initializev   s     	H-& 	
  	  	  /.* $M %D$JDM $D',0@DM $T]];r5   c                    > [         TU ]  5         U R                  (       a  U R                  R                  5         U R                  R                  5         g N)r-   closer`   rT   ra   )r0   r1   s    r2   re   SimpleAsyncHTTPClient.close   s5    MM!r5   requestcallbackc                    [        5       nU R                  R                  X1U45        UR                  c   eUR                  c   eS n[        U R                  5      U R                  :  a  [        UR                  UR                  5      =(       d    UR                  =(       d    UR                  nU(       aW  U R                  R                  U R                  R                  5       U-   [        R                  " U R                  US5      5      nXU4U R                  U'   U R!                  5         U R                  (       aB  ["        R$                  " S[        U R                  5      [        U R                  5      4-  5        g g )Nzin request queuezImax_clients limit reached, request queued. %d active, %d queued requests.)objectr]   appendconnect_timeoutrequest_timeoutlenr^   rQ   minio_loopadd_timeouttime	functoolspartial_on_timeoutr_   _process_queuer   debug)r0   rg   rh   keytimeout_handletimeouts         r2   
fetch_impl SimpleAsyncHTTPClient.fetch_impl   s=    h

323&&222&&222t{{t///G++W-D-DE +**+** 
 !%!9!9LL%%''1%%d&6&6=OP" %?S::MM1474Dc$**o3VW r5   c                    U R                   (       a  [        U R                  5      U R                  :  a  U R                   R	                  5       u  pnXR
                  ;  a  Mb  U R                  U5        X#4U R                  U'   [        R                  " U R                  U5      nU R                  X$U5        U R                   (       a&  [        U R                  5      U R                  :  a  M  g g g g rd   )r]   rn   r^   rQ   popleftr_   _remove_timeoutrs   rt   _release_fetch_handle_request)r0   rx   rg   rh   release_callbacks        r2   rv   $SimpleAsyncHTTPClient._process_queue   s    jjS-0@0@@%)ZZ%7%7%9"C(,,&  % '2DKK(001D1DcJ  HE jjS-0@0@@j@jr5   c                     [         $ rd   )_HTTPConnectionr8   s    r2   _connection_class'SimpleAsyncHTTPClient._connection_class   s    r5   r   final_callbackc           
          U R                  5       " U UUUU R                  U R                  U R                  U R                  5        g rd   )r   rS   ra   rV   rW   )r0   rg   r   r   s       r2   r   %SimpleAsyncHTTPClient._handle_request   sC     	   OO  		
r5   rx   c                 >    U R                   U	 U R                  5         g rd   )r^   rv   )r0   rx   s     r2   r   $SimpleAsyncHTTPClient._release_fetch   s    KKr5   c                     XR                   ;   a>  U R                   U   u  p#nUb  U R                  R                  U5        U R                   U	 g g rd   )r_   rp   remove_timeout)r0   rx   rg   rh   ry   s        r2   r   %SimpleAsyncHTTPClient._remove_timeout   sH    ,,04S0A-G~)++N;S!	 r5   infoc                 Z   U R                   U   u  p4nU R                  R                  XU45        U(       a  SR                  U5      OSn[	        US[        U5      U R                  R                  5       UR                  -
  S9nU R                  R                  XG5        U R                   U	 g)zTimeout callback of request.

Construct a timeout HTTPResponse when a timeout occurs.

:arg object key: A simple object to mark the request.
:info string key: More detailed timeout information.
Timeout {0}r7   r*   )errorrequest_timeN)
r_   r]   removeformatr   r$   rp   rr   
start_timeadd_callback)r0   rx   r   rg   rh   ry   error_messagetimeout_responses           r2   ru   !SimpleAsyncHTTPClient._on_timeout   s     -1LL,=)>

3236:,,T2	'"=1**,w/A/AA	
 	!!(=LLr5   )
r^   rW   rS   rQ   rV   r`   r]   rT   ra   r_   )
   Ni  @NNNNr'   Nrd   )r=   r>   r?   r@   rA   intr   r   rB   r   r   rZ   re   r   r   r   r{   rv   typer   r   rj   r   r   ru   rC   rD   rE   s   @r2   rO   rO   O   si   $P 59('+-1)-'+$<$< #4S>2$< 	$<
 8$$< 4S>*$< "#$<  }$< 
$< $<L ".6~t7K.L	6F4 

 #2t8,
 !,!56	

 

"& T "6 "d "v Xc] d  r5   rO   c                      \ rS rSr\" / SQ5      rS\\   S\S\	/ S4   S\	\
/S4   S\S	\S
\S\SS4S jrS*S jrS\S\S\\\4   \R(                  4   4S jrS+S\\   SS4S jjrS*S jrS\S\4S jrS\SS4S jrS*S jrS\
SS4S jrSSS\\   S\\    S\4S jr!S*S  jr"S!\\#RH                  \#RJ                  4   S"\#RL                  SS4S# jr'S\4S$ jr(S*S% jr)S*S& jr*S'\+SS4S( jr,S)r-g),r      )GETHEADPOSTPUTDELETEPATCHOPTIONSclientrg   r   Nr   rS   ra   rV   rW   r'   c	                    [         R                  " 5       U l        U R                  R                  5       U l        [        R                  " 5       U l        Xl        X l        X0l        X@l	        XPl
        X`l        Xpl        Xl        S U l        S U l        / U l        S U l        S U l        S U l        [         R                  " 5       R)                  [*        R,                  " U R/                  5       5      S 5        g )Nc                 "    U R                  5       $ rd   result)fs    r2   <lambda>*_HTTPConnection.__init__.<locals>.<lambda>  s
    qxxzr5   )r   currentrp   rr   r   start_wall_timer   rg   r   r   rS   ra   rV   rW   codeheaderschunks_decompressor_timeout	_sockaddr
add_futurer   convert_yieldedrun)	r0   r   rg   r   r   rS   ra   rV   rW   s	            r2   r.   _HTTPConnection.__init__  s     ~~',,++-#yy{ 0,.$.*	!##
+-A	
r5   c           	        #     [         R                  R                  [        U R                  R
                  5      5      U l        U R                  R                  S;  a"  [        SU R                  R
                  -  5      eU R                  R                  nSU;   a  UR                  S5      u  p#n[        R                  " U5      u  pEUc  U R                  R                  S:X  a  SOSn[        R                  " SU5      (       a  USS	 nX@l        U R                  R                   S
L a  ["        R$                  nO["        R&                  nU R)                  U R                  R                  5      nS nU R                  R*                  (       a^  [-        U R                  R*                  5      (       a  U R                  R*                  nO#[        SU R                  R*                  < 35      eU R                  R.                  (       aP  U R                  R0                  (       a5  [3        U R                  R.                  U R                  R0                  5      n	OfU R                  R.                  (       a  U R                  R.                  n	O4U R                  R0                  (       a  U R                  R0                  n	OSn	U	(       aM  U R4                  R7                  U R8                  U	-   [:        R<                  " U R>                  S5      5      U l         U RB                  RE                  UUUUU RF                  US9I S h  vN n
U RH                  c  U
RK                  5         g Xl&        U RL                  RO                  U RP                  5        U RS                  5         U RH                  c  g U R                  R0                  (       aa  U R4                  R7                  U R8                  U R                  R0                  -   [:        R<                  " U R>                  S5      5      U l         U R                  RT                  U RV                  ;  a=  U R                  RX                  (       d"  [[        SU R                  RT                  -  5      eS H-  n[]        U R                  US 5      (       d  M!  [_        SU-  5      e   SU R                  R`                  ;  a  SU R                  R`                  S'   SU R                  R`                  ;  a  SU R                  R                  ;   a@  U R                  R                  R                  S5      S	   U R                  R`                  S'   O-U R                  R                  U R                  R`                  S'   Su  pU R                  Rb                  b,  U R                  Rb                  U R                  Rd                  pOLU R                  Rf                  b5  U R                  Rf                  nU R                  Rh                  =(       d    SnUb  Uc   eU R                  Rj                  S;  a   [        SU R                  Rj                  5      eS[        [l        Rn                  " [        Rp                  " X5      5      5      -   U R                  R`                  S'   U R                  Rr                  (       a.  U R                  Rr                  U R                  R`                  S'   ORU R                  R`                  Ru                  S5      c,  SRw                  [x        5      U R                  R`                  S'   U R                  RX                  (       d  U R                  RT                  S;   nU R                  Rz                  S L=(       d    U R                  R|                  S LnU(       a  U(       a  U(       a8  U(       d1  [        SU(       a  S OS< S!U R                  RT                  < S"35      eU R                  R~                  (       a  S#U R                  R`                  S$'   U R                  Rz                  b?  [        [        U R                  Rz                  5      5      U R                  R`                  S%'   U R                  RT                  S&:X  a3  S'U R                  R`                  ;  a  S(U R                  R`                  S''   U R                  R                  (       a  S)U R                  R`                  S*'   U R                  R                  =(       d    S+U R                  R                  (       a  S,U R                  R                  -   OS-   nU R                  U
5      U lF        [        R                  " U R                  RT                  US5      nU R                  R                  UU R                  R`                  5        U R                  R~                  (       a$  U R                  R                  U 5      I S h  vN   g U R                  S-5      I S h  vN   g  GN N" N
! [         a+    U R                  " [        R                  " 5       6 (       d  e  g f = f7f).N)httphttpszUnsupported url scheme: %s@r   i  P   z^\[.*\]$   Fz=Unrecognized IPv4 or IPv6 address for network_interface, got r   zwhile connecting)afssl_optionsrS   	source_ipzduring requestzunknown method %s)
proxy_host
proxy_portproxy_usernameproxy_passwordproxy_auth_modez%s not supported
Connectionre   Host)NN )Nbasiczunsupported auth_mode %szBasic Authorizationz
User-Agentz
Tornado/{})r   r   r   z
Body must znot zbe None for method z+ (unless allow_nonstandard_methods is true)z100-continueExpectContent-Lengthr   Content-Typez!application/x-www-form-urlencodedgzipzAccept-Encoding/?T)Ourllibparseurlsplitr   rg   urlparsedscheme
ValueErrornetloc
rpartitionr   split_host_and_portrematchparsed_hostname
allow_ipv6socketAF_INET	AF_UNSPEC_get_ssl_optionsnetwork_interfacer   rl   rm   ro   rp   rq   r   rs   rt   ru   r   ra   connectrS   r   re   streamset_close_callbackon_connection_closer   method_SUPPORTED_METHODSallow_nonstandard_methodsKeyErrorgetattrNotImplementedErrorr   usernamepasswordauth_usernameauth_password	auth_modebase64	b64encodeencode_username_password
user_agentgetr   r   bodybody_producerexpect_100_continuerB   rn   decompress_responsepathquery_create_connection
connectionRequestStartLinewrite_headersread_response_write_body	Exception_handle_exceptionsysexc_info)r0   r   userpass_hostportr   r   r   rz   r   rx   r   r   body_expectedbody_presentreq_path
start_lines                     r2   r   _HTTPConnection.run"  s    ^	 ,,//9I9I0JKDK{{!!):: !=@P@P!PQQ [[''Ff}&,&7&7&<#V!55f=JD|"kk00G;sxxT**Abz#' ||&&%/^^%%//0B0BCKI||--t||==>> $ > >I$<<99< 
 ||++0L0LLL00$,,2N2N --,,66--,,66 $ 8 8OOg-%%d&6&68JK!  ??22' $ 4 4# 3  F ""* KKK**4+C+CD  """*||++ $ 8 8OOdll&B&BB%%d&6&68HI!
 ##4+B+BB>>2T\\5H5HHII 4<<d33-.@3.FGG 4<<#7#775<$$\2T\\111$++,,,37;;3E3E3P3PQT3U4DLL((0 48;;3E3EDLL((0!+H{{##/%)[[%9%94;;;O;O(++7<<55<<55;#+++<<))@$%?AWAWXX8@8$$ 99(MD 9$$_5
 ||&&59\\5L5L$$\2%%)),7?5A5H5H5Q$$\2<<99 !% 3 37O OLL%%T1 >||11=  ", $ &36:DLL<O<OQ 
 ||//1?$$X.||  , :=SARAR=S9T$$%56##v-"$,,*>*>> 8 $$^4 ||//:@$$%67((/C-1[[->->t{{(((BH #55f=DO!224<<3F3FRTUJOO))*dll6J6JK||//oo33D999&&t,,,UP :, 	))3<<>: ;	s   i+L7h3 ;h,<!h3 i+Ah3 &i+'C<h3 'U%h3 h/h3 i+h3 &h1'h3 +i+,h3 /h3 1h3 32i(%i+'i((i+r   c                 >   US:X  Ga  U R                   R                  b  U R                   R                  $ U R                   R                  (       aK  U R                   R                  c4  U R                   R                  c  U R                   R
                  c  [        $ [        R                  " [        R                  R                  U R                   R                  S9nU R                   R                  (       d  SUl        [        R                  Ul        U R                   R                  b:  UR                  U R                   R                  U R                   R
                  5        [        [        S5      (       a#  U=R                   [        R"                  -  sl        U$ g )Nr   )cafileFOP_NO_COMPRESSION)rg   r   validate_certca_certsclient_cert
client_keyr   sslcreate_default_contextPurposeSERVER_AUTHcheck_hostname	CERT_NONEverify_modeload_cert_chainhasattroptionsr  )r0   r   ssl_ctxs      r2   r    _HTTPConnection._get_ssl_options  s     W||''3||/// **LL))1LL,,4LL++3++00''0E0EG <<--).&&)mm#||''3''LL,,dll.E.E s/003#8#88Nr5   r   c                     SU l         U(       a  SR                  U5      OSnU R                  b!  U R                  [        [	        U5      S5        gg)zTimeout callback of _HTTPConnection instance.

Raise a `HTTPTimeoutError` when a timeout occurs.

:info string key: More detailed timeout information.
Nr   r7   )r   r   r   r  r$   )r0   r   r   s      r2   ru   _HTTPConnection._on_timeout  sK     6:,,T2	*"" "2="A4 +r5   c                 x    U R                   b-  U R                  R                  U R                   5        S U l         g g rd   )r   rp   r   r8   s    r2   r   _HTTPConnection._remove_timeout  s.    ==$LL''6 DM %r5   r   c                     UR                  S5        [        US[        SU R                  U R                  [        U R                  R                  5      S9U R                  5      nU$ )NT)no_keep_aliverV   rW   
decompress)	set_nodelayr   r   rV   rW   boolrg   r  r   )r0   r   r  s      r2   r  "_HTTPConnection._create_connection  s`    4 $%" $ 4 4"00 @ @A	 NN


 r5   
start_readc                 D  #    U R                   R                  b0  U R                  R                  U R                   R                  5        OSU R                   R                  b<  U R                   R	                  U R                  R                  5      nUb
  UI S h  vN   U R                  R                  5         U(       a%   U R                  R                  U 5      I S h  vN   g g  NK N! [         a+    U R                  " [        R                  " 5       6 (       d  e  g f = f7frd   )rg   r   r  writer   finishr  r   r  r  r  )r0   r4  futs      r2   r	  _HTTPConnection._write_body  s     <<(OO!!$,,"3"34\\''3,,,,T__-B-BCC		 oo33D999   :$ --s||~> ?sH   BD C$%D ?C( C&C( "D &C( (2DD DD c                 T    U R                   b  U R                   nS U l         U" 5         g g rd   )r   )r0   r   s     r2   _release_HTTPConnection._release  s-      ,#44$(D! -r5   responsec                     U R                  5         U R                  b/  U R                  nS U l        U R                  R                  X!5        g g rd   )r;  r   rp   r   )r0   r=  r   s      r2   _run_callback_HTTPConnection._run_callback  sA    *!00N"&DLL%%n? +r5   typzOptional[Type[BaseException]]valuetbc           
         U R                   b  U R                  5         [        U[        5      (       a%  UR                  c  [        S5      nOUR                  nU R                  [        U R                  SUU R                  R                  5       U R                  -
  U R                  S95        [        U S5      (       a  U R                  R                  5         g[        U[        5      $ )NrL   r*   )r   r   r   r   T)r   r   
isinstancer   
real_errorrG   r?  r   rg   rp   rr   r   r   r&  r   re   )r0   rA  rB  rC  s       r2   r  !_HTTPConnection._handle_exception   s     *  "%!233##+1/BE!,,ELL!%!2!2!4t!F#33 tX&& !!# e%677r5   c                     U R                   b?  SnU R                  R                  (       a  U R                  R                  e [        U5      eg ! [         a%    U R                  " [
        R                  " 5       6    g f = f)NzConnection closed)r   r   r   rG   r  r  r  )r0   r&   s     r2   r   #_HTTPConnection.on_connection_closeD  sj    *)G{{  kk'''8+G44 + ) 8&&78s   A ,A=<A=
first_liner   c                   #    [        U[        R                  5      (       d   eU R                  R                  (       a*  UR
                  S:X  a  U R                  S5      I S h  vN   g UR
                  U l        UR                  U l        X l        U R                  5       (       a  g U R                  R                  b  U R                  R                  SU-  5        U R                  R                  5        H(  u  p4U R                  R                  U< SU< S35        M*     U R                  R                  S5        g g  N7f)Nd   Fz
%s %s %s
z: z
)rE  r   ResponseStartLinerg   r   r   r	  reasonr   _should_follow_redirectheader_callbackget_all)r0   rJ  r   kvs        r2   headers_received _HTTPConnection.headers_receivedN  s     
 *h&@&@AAAA<<++
30F""5)))OO	 ''''))<<''3LL((*)DE,,.,,Q-BC /LL((0 4 *s   A!E#D?$CEc                 <   U R                   R                  (       a  U R                   R                  c   eU R                  S;   =(       aR    U R                   R                  S:  =(       a2    U R                  S L=(       a    U R                  R                  S5      S L$ g)N)-  .  /  i3  i4  r   LocationF)rg   follow_redirectsmax_redirectsr   r   r   r8   s    r2   rO  '_HTTPConnection._should_follow_redirecte  s    <<((<<--999		66 =LL..2=LL,= LL$$Z0<	 r5   c                 R  ^ U R                   c   eSR                  U R                  5      nU R                  5         [	        U R
                  SU R
                  5      nU R                  5       (       Ga  [        U R
                  [        5      (       d   eU R                  c   e[        R                  " U R
                  R
                  5      n[        R                  R                  U R
                  R                  U R                  S   5      Ul        U R
                  R                  c   eU R
                  R                  S-
  Ul        UR                  S	 U R                   S:X  a  U R
                  R                   S:w  d*  U R                   S;   aI  U R
                  R                   S	:X  a/  S
Ul        S Ul        S H  n U R
                  R                  U	 M     X#l        U R(                  mS U l        U R+                  5         U R,                  c   eU R,                  R/                  USS9nUR1                  U4S j5        U R3                  5         g U R
                  R4                  (       a  [7        5       nO[7        U5      n[9        UU R                   [	        U SS 5      U R                  U R:                  R=                  5       U R>                  -
  U R@                  UU R
                  R                  S9nU RC                  U5        U R3                  5         g ! [$         a     GMj  f = f)Nr5   original_requestrZ  r   r   rY  r   )rW  rX  r   r   )r   r   zContent-EncodingzTransfer-EncodingF)raise_errorc                 0   > T" U R                  5       5      $ rd   r   )r   r   s    r2   r   (_HTTPConnection.finish.<locals>.<lambda>  s    N188:,Fr5   rN  )rN  r   r   r   buffereffective_url)"r   joinr   r   r   rg   rO  rE  r
   r   copyr   r   urljoinr   r\  r   r   r   r_  r   r;  r   fetchadd_done_callback_on_end_requeststreaming_callbackr   r   rp   rr   r   r   r?  )	r0   datar_  new_requesthr8  rc  r=  r   s	           @r2   r7  _HTTPConnection.finishp  s   yy$$$xx$"4<<1CT\\R''))dllM::::<<+++))DLL$8$89K$ll22  $,,z":KO <<--999(,(B(BQ(FK%##F+ 		S T\\%8%8F%B		Z'DLL,?,?6,I%*"#' A LL003 ,<(!00N"&DMMO;;***++##KU#CC!!"FG  "<<**YFT]FII440LL**,t>++,,**	
 	8$5 $ s   ?L
L&%L&c                 8    U R                   R                  5         g rd   )r   re   r8   s    r2   rj  _HTTPConnection._on_end_request  s    r5   chunkc                     U R                  5       (       a  g U R                  R                  b  U R                  R                  U5        g U R                  R	                  U5        g rd   )rO  rg   rk  r   rk   )r0   rr  s     r2   data_received_HTTPConnection.data_received  sH    ''))<<**6LL++E2KKu%r5   )r   r   r   r   r   r   r  r   r   rp   rW   rS   rV   r   r   rN  r   rg   r   r   r   ra   r   rd   ).r=   r>   r?   r@   setr   r   rO   r   r   r   r   r   r.   r   rB   r   r   r   r  
SSLContextr   ru   r   r   r   r  r2  r	  r;  r?  BaseExceptionr   r  r   r   rM  r  HTTPHeadersrT  rO  r7  rj  bytesrt  rC   r;   r5   r2   r   r      s   D
./
 
 #2t8,	

 !,!56
 
 
 
 
 

B_B	tT#s(^S^^3	4>  !
 o D T @l @t @"8,"8 &"8 ]#	"8
 
"8H81(44h6O6OOP1 %%1 
	1.	 	?B&5 &T &r5   r   __main__)?tornado.escaper   tornador   r   tornado.httpclientr   r   r   r	   r
   r   r   tornado.http1connectionr   r   tornado.ioloopr   tornado.iostreamr   r   tornado.netutilr   r   r   r   tornado.logr   tornado.tcpclientr   r   r[   rf  rs   r   r   r  r  rr   ior   urllib.parser   typingr   r   r   r   r   r   typesr   TYPE_CHECKINGr    r!   r"   r$   rG   rO   HTTPMessageDelegater   r=   	configurer;   r5   r2   <module>r     s    #     N ! 8    '     	  
 
    = =  	)))y ) /I /&jO jZ&h22 &D z34F r5   