
    g^                         d Z ddlZddlZddlZddlZ G d dej                  j                        Z G d dej                  j                        Zy)zqWSGI server interface (see PEP 333).

This adds some CP-specific bits to the framework-agnostic cheroot
package.
    Nc                   "     e Zd ZdZ fdZ xZS )CPWSGIHTTPRequestzWrapper for cheroot.server.HTTPRequest.

    This is a layer, which preserves URI parsing mode like it which was
    before Cheroot v5.8.0.
    c                 2    t         t        |   ||d       y)a  Initialize HTTP request container instance.

        Args:
            server (cheroot.server.HTTPServer):
                web server object receiving this request
            conn (cheroot.server.HTTPConnection):
                HTTP connection object for this request
        T)
proxy_modeN)superr   __init__)selfserverconn	__class__s      ,/opt/Tautulli/lib/cherrypy/_cpwsgi_server.pyr   zCPWSGIHTTPRequest.__init__   s!     	/DT 	0 	
    )__name__
__module____qualname____doc__r   __classcell__r   s   @r   r   r      s    
 
r   r   c                   t     e Zd ZdZdZ ej
                  di  e       Zej                  f fd	Z
ddZ xZS )CPWSGIServeraR  Wrapper for cheroot.wsgi.Server.

    cheroot has been designed to not reference CherryPy in any way, so
    that it can be used in other frameworks and applications. Therefore,
    we wrap it here, so we can set our own mount points from
    cherrypy.tree and apply some attributes from config ->
    cherrypy.server -> wsgi.Server.
    z=CherryPy/{cherrypy.__version__} {cheroot.wsgi.Server.version}c                    || _         | j                   j                  xs d| _        | j                   j                  xs d| _        | j                   j                  xs | j                   j                  xs d}| j                   j
                  | _        t        t        | #  |j                  t        j                  | j                   j                  || j                   j                  | j                   j                  | j                   j                  | j                   j                   | j                   j"                  | j                   j$                  | j                   j&                  | j                   j(                         t*        | j,                  _        | j                   j0                  | _        | j                   j4                  | _        t6        j8                  dk\  r| j                   j:                  xs d}n| j                   j:                  xs d}| j                   j<                  rt>        j@                  jC                  |      } || j                   jD                  | j                   jF                  | j                   jH                  | j                   jJ                        | _&        | j                   j<                  | jL                  _'        n| j                   jD                  rt>        j@                  jC                  |      } || j                   jD                  | j                   jF                  | j                   jH                  | j                   jJ                        | _&        tQ        | j                   dd      | jR                  d	<   y)
zuInitialize CPWSGIServer instance.

        Args:
            server_adapter (cherrypy._cpserver.Server): ...
        r   N)maxrequest_queue_sizetimeoutshutdown_timeoutaccepted_queue_sizeaccepted_queue_timeoutpeercreds_enabledpeercreds_resolve_enabled)   r   builtin	pyopenssl
statisticsFEnabled)*server_adaptermax_request_header_sizemax_request_body_sizesocket_hostsocket_filewsgi_versionr   r   r   	bind_addrcherrypytreethread_poolthread_pool_maxsocket_queue_sizesocket_timeoutr   r   r   	peercredspeercreds_resolver   ConnectionClassRequestHandlerClassprotocol_versionprotocolnodelaysysversion_info
ssl_modulessl_contextcherootr
   get_ssl_adapter_classssl_certificatessl_private_keyssl_certificate_chainssl_ciphersssl_adaptercontextgetattrstats)r	   r%   server_namer;   adapter_classr   s        r   r   zCPWSGIServer.__init__0   s    -77<1 	$ 55: 	" **66 **66 	 !//<<lD*$$hmm++##33#22DD''66!00AA $ 3 3 G G#'#6#6#M#M"11;;&*&9&9&K&K 	+ 	
 4E0++<<**22v%,,77D9J,,77F;J**#NN@@LM,##33##33##99##//	 1D
 (,':':'F'FD$  00#NN@@LM,##33##33##99##//	 1D !(u!6

9r   c                 F    t         j                  j                  |||       y)z%Write given message to the error log.N)r,   enginelog)r	   msglevel	tracebacks       r   	error_logzCPWSGIServer.error_logm   s    C	2r    )    F)r   r   r   r   fmtformatglobalsversionr,   r
   r   rO   r   r   s   @r   r   r   #   s7     JCcjj%79%G&.oo ;6z3r   r   )r   r9   cheroot.wsgir=   cheroot.serverr,   r
   HTTPRequestr   wsgiServerr   rP   r   r   <module>r\      sF   
    
22 
*L37<<&& L3r   