
X?_c           @   sh   d  Z  d d l Z d d l Z d d l m Z d d l m Z m Z d d l Td e	 f d     YZ
 d S(   s"   Manage HTTP servers with CherryPy.iN(   t
   attributes(   t
   basestringt   py3k(   t   *t   Serverc           B   s  e  Z d  Z d Z d Z d   Z d   Z e e e d d Z d Z
 d Z d Z d	 Z d Z d Z d
 Z d Z d	 Z d Z d Z d Z d Z d Z d Z d Z e r d Z n d Z e Z e Z d Z  d   Z! d d  Z" d   Z# d e# _$ d   Z% d   Z& e e% e& d d Z' d   Z( RS(   s  An adapter for an HTTP server.

    You can set attributes (like socket_host and socket_port)
    on *this* object (which is probably cherrypy.server), and call
    quickstart. For example::

        cherrypy.server.socket_port = 80
        cherrypy.quickstart()
    i  s	   127.0.0.1c         C   s   |  j  S(   N(   t   _socket_host(   t   self(    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   _get_socket_host   s    c         C   s(   | d k r t  d   n  | |  _ d  S(   Nt    su   The empty string ('') is not an allowed value. Use '0.0.0.0' instead to listen on all active interfaces (INADDR_ANY).(   t
   ValueErrorR   (   R   t   value(    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   _set_socket_host"   s    t   docs  The hostname or IP address on which to listen for connections.

        Host values may be any IPv4 or IPv6 address, or any valid hostname.
        The string 'localhost' is a synonym for '127.0.0.1' (or '::1', if
        your hosts file prefers IPv6). The string '0.0.0.0' is a special
        IPv4 entry meaning "any active interface" (INADDR_ANY), and '::'
        is the similar IN6ADDR_ANY for IPv6. The empty string or None are
        not allowed.i   i
   is   HTTP/1.1i  i   id   t   builtint	   pyopenssli   i    c         C   s+   t  j |  _ d  |  _ d  |  _ t |  _ d  S(   N(   t   cherrypyt   enginet   bust   Nonet
   httpservert	   interruptt   Falset   running(   R   (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   __init__   s    		c         C   sw   | d k r |  j } n  | d k rF d d l m } | j |   } n  t | t  rj t |  |   } n  | |  j f S(   s?   Return a (httpserver, bind_addr) pair based on self attributes.i(   t   _cpwsgi_serverN(	   R   t   instanceR   R   t   CPWSGIServert
   isinstanceR   R    t	   bind_addr(   R   R   R   (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   httpserver_from_self   s    c         C   s5   |  j  s$ |  j   \ |  _  |  _ n  t j |   d S(   s   Start the HTTP server.N(   R   R   R   t   ServerAdaptert   start(   R   (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyR      s    	iK   c         C   sB   |  j  r |  j  S|  j d  k r2 |  j d  k r2 d  S|  j |  j f S(   N(   t   socket_filet   socket_hostR   t   socket_port(   R   (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   _get_bind_addr   s
    	c         C   s   | d  k r* d  |  _ d  |  _ d  |  _ np t | t  rW | |  _ d  |  _ d  |  _ nC y | \ |  _ |  _ d  |  _ Wn! t k
 r t d |   n Xd  S(   Nsf   bind_addr must be a (host, port) tuple (for TCP sockets) or a string (for Unix domain sockets), not %r(   R   R    R!   R"   R   R   R	   (   R   R
   (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   _set_bind_addr   s    				sF   A (host, port) tuple for TCP sockets or a str for Unix domain sockets.c         C   s   |  j  r |  j  S|  j } | d k r@ d d l } | j   } n  |  j } |  j rx d } | d k r | d | 7} q n# d } | d	 k r | d | 7} n  d
 | | f S(   sM   Return the base (scheme://host[:port] or sock file) for this server.
        s   0.0.0.0s   ::iNt   httpsi  s   :%st   httpiP   s   %s://%s(   s   0.0.0.0s   ::(   R    R!   t   sockett   gethostnameR"   t   ssl_certificate(   R   t   hostR'   t   portt   scheme(    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   base   s    				Ni  i  i  @(   i   i    ()   t   __name__t
   __module__t   __doc__R"   R   R   R   t   propertyR!   R   R    t   socket_queue_sizet   socket_timeoutt   accepted_queue_sizet   accepted_queue_timeoutt   shutdown_timeoutt   protocol_versiont   thread_poolt   thread_pool_maxt   max_request_header_sizet   max_request_body_sizeR   t   ssl_contextR)   t   ssl_certificate_chaint   ssl_private_keyR   t
   ssl_moduleR   t
   statisticst   Truet   nodelayt   wsgi_versionR   R   R   t   priorityR#   R$   R   R-   (    (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyR      sV   
									(   R0   t   warningsR   t   cherrypy.libR    t   cherrypy._cpcompatR   R   t   cherrypy.process.serversR   R   (    (    (    sy   /local/mnt/workspace/CRMBuilds/Saipan.LA.2.0-00145-STD.PROD-1_20200821_083004/b/common/sectools/ext/cherrypy/_cpserver.pyt   <module>   s   
