
y X                 @   s  d  d l  Z  d  d l Z d  d l Z y d  d l Z Wn" e k
 rX d d l m Z Yn Xd  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z g  Z e
 j Z d	 d
   Z d d d  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z e d e f i   Z d d   Z d d   Z d d   Z d d   Z  d d   Z! d d   Z" d d    Z# d! d"   Z$ d# d$   Z% d% d&   Z& d' d(   Z' d) d*   Z( d+ d,   Z) d- d.   Z* d/ d0   Z+ Gd1 d2   d2 e  Z, Gd3 d4   d4 e  Z- Gd5 d6   d6 e  Z. Gd7 d8   d8 e  Z/ Gd9 d:   d: e  Z0 Gd; d<   d< e  Z1 Gd= d>   d> e  Z2 Gd? d@   d@ e  Z3 GdA dB   dB e  Z4 GdC dD   dD e  Z5 GdE dF   dF e  Z6 GdG dH   dH e  Z7 GdI dJ   dJ e  Z8 GdK dL   dL e  Z9 GdM dN   dN e  Z: GdO dP   dP e  Z; GdQ dR   dR e  Z< GdS dT   dT e  Z= GdU dV   dV e  Z> GdW dX   dX e  Z? GdY dZ   dZ e  Z@ Gd[ d\   d\ e  ZA Gd] d^   d^ e  ZB Gd_ d`   d` e  ZC Gda db   db e  ZD Gdc dd   dd e  ZE Gde df   df e  ZF Gdg dh   dh e  ZG Gdi dj   dj e  ZH Gdk dl   dl e  ZI Gdm dn   dn e  ZJ Gdo dp   dp e  ZK Gdq dr   dr e  ZL Gds dt   dt e  ZM Gdu dv   dv e  ZN Gdw dx   dx e  ZO Gdy dz   dz e  ZP Gd{ d|   d| e  ZQ Gd} d~   d~ e  ZR Gd d   d e  ZS Gd d   d e  ZT Gd d   d e  ZU Gd d   d e  ZV Gd d   d e  ZW Gd d   d e  ZX Gd d   d e  ZY Gd d   d e  ZZ Gd d   d e  Z[ Gd d   d e  Z\ Gd d   d e  Z] Gd d   d e  Z^ Gd d   d e  Z_ Gd d   d e  Z` Gd d   d e  Za Gd d   d e  Zb Gd d   d e  Zc Gd d   d e  Zd Gd d   d e  Ze Gd d   d e  Zf Gd d   d e  Zg Gd d   d e  Zh Gd d   d e  Zi Gd d   d e  Zj Gd d   d e  Zk Gd d   d e  Zl Gd d   d e  Zm Gd d   d e  Zn Gd d   d e  Zo Gd d   d e  Zp Gd d   d e  Zq Gd d   d e  Zr Gd d   d e  Zs Gd d   d e  Zt e
 ju d k rGd d   d e  Zv n  d S)    N   )argparse_compat)__version__)_compat)ConfigError)six)utilc                s     f d d   } | S)Nc                s     | |   S)N )instanceargskwargs)funcr	   ?/home/ubuntu/projects/ifolica/build/gunicorn/gunicorn/config.py_wrapped    s    zwrap_method.<locals>._wrappedr	   )r   r   r	   )r   r   wrap_method   s    r   c             C   sX   i  } |  p f  }  x? t  D]7 } |   } | j |  k r= q n  | j   | | j <q W| S)N)KNOWN_SETTINGSnamecopy)ignoresettingssZsettingr	   r	   r   make_settings%   s    	r   c                   sB  e  Z d  Z d d d d  Z d d   Z   f d d   Z d d	   Z d
 d   Z e d d    Z	 e d d    Z
 e d d    Z e d d    Z e d d    Z e d d    Z e d d    Z e d d    Z e d d    Z e d d    Z e d  d!    Z e d" d#    Z e d$ d%    Z   S)&ConfigNc             C   sM   t    |  _ | |  _ | p1 t j j t j d  |  _ t j	 j
   |  _ d  S)Nr   )r   r   usageospathbasenamesysargvprogenvironr   Zenv_orig)selfr   r   r	   r	   r   __init__2   s    	"zConfig.__init__c             C   s3   | |  j  k r" t d |   n  |  j  | j   S)Nz No configuration setting for: %s)r   AttributeErrorget)r!   r   r	   r	   r   __getattr__8   s    zConfig.__getattr__c                sG   | d k r* | |  j  k r* t d   n  t t |   j | |  d  S)Nr   zInvalid access!)r   r#   superr   __setattr__)r!   r   value)	__class__r	   r   r'   =   s    zConfig.__setattr__c             C   s:   | |  j  k r" t d |   n  |  j  | j |  d  S)Nz No configuration setting for: %s)r   r#   set)r!   r   r(   r	   r	   r   r*   B   s    z
Config.setc             C   s   i |  j  d 6|  j d 6} t j |   } | j d d d d d t j d d t d	 d
 d | j d d d d
 t j t |  j d |  j j	 } x" | D] } |  j | j
 |  q W| S)Nr   r   z-vz	--versionactionversiondefaultz%(prog)s (version z)
helpz&show program's version number and exitr   nargs*key)r   r   argparseArgumentParseradd_argumentZSUPPRESSr   sortedr   __getitem__
add_option)r!   r   parserkeyskr	   r	   r   r8   G   s    
zConfig.parserc             C   sK   |  j  d j   } | j d  p+ | d k } | rG |  j d k rG d S| S)Nworker_class
SyncWorkersyncr   threads)r   r$   endswithr>   )r!   uriis_syncr	   r	   r   worker_class_strY   s
    zConfig.worker_class_strc             C   s{   |  j  d j   } | j d  p+ | d k } | rL |  j d k rL d } n  t j |  } t | d  rw | j   n  | S)Nr;   r<   r=   r   z%gunicorn.workers.gthread.ThreadWorkersetup)r   r$   r?   r>   r   
load_classhasattrrC   )r!   r@   rA   r;   r	   r	   r   r;   c   s    	zConfig.worker_classc             C   s   |  j  d j   S)Nr>   )r   r$   )r!   r	   r	   r   r>   q   s    zConfig.threadsc             C   s   |  j  d j   S)Nworkers)r   r$   )r!   r	   r	   r   rF   u   s    zConfig.workersc             C   s$   |  j  d j   } d d   | D S)Nbindc             S   s(   g  |  ] } t  j t j |    q Sr	   )r   Zparse_addressr   bytes_to_str).0rG   r	   r	   r   
<listcomp>|   s   	 z"Config.address.<locals>.<listcomp>)r   r$   )r!   r   r	   r	   r   addressy   s    zConfig.addressc             C   s   |  j  d j   S)Nuser)r   r$   )r!   r	   r	   r   uid~   s    z
Config.uidc             C   s   |  j  d j   S)Ngroup)r   r$   )r!   r	   r	   r   gid   s    z
Config.gidc             C   s8   |  j  d j   } | d  k	 r# | S|  j  d j   Sd  S)N	proc_namedefault_proc_name)r   r$   )r!   Zpnr	   r	   r   rP      s    zConfig.proc_namec             C   s   |  j  d j   } | d k r+ t j } n  | t j k rk d |  j  k rk |  j  d j d  k	 rk d } qk n  t j | d d d d } t | d	  r | j   n  | S)
Nlogger_classZsimplestatsd_hostz!gunicorn.instrument.statsd.Statsdr-   zgunicorn.glogging.Loggersectionzgunicorn.loggersinstall)	r   r$   LoggerClassr-   r(   r   rD   rE   rU   )r!   r@   rR   r	   r	   r   rR      s    %	zConfig.logger_classc             C   s   |  j  p |  j S)N)certfilekeyfile)r!   r	   r	   r   is_ssl   s    zConfig.is_sslc             C   sL   i  } x? |  j  j   D]. \ } } | j d k r | j   | | <q q W| S)NSSL)r   itemsrT   r$   )r!   optsr   r(   r	   r	   r   ssl_options   s
    zConfig.ssl_optionsc             C   s   |  j  d j   } i  } | s# | Sxh | D]` } t j |  } y | j d d  \ } } Wn" t k
 r t d |   Yn X| | | <q* W| S)Nraw_env=r   zenvironment setting %r invalid)r   r$   r   rH   split
ValueErrorRuntimeError)r!   r^   enver   r:   vr	   r	   r   rc      s    z
Config.envc             C   sM   |  j  d j   d  k	 r d Sd t j k rI t j d j   } | d	 k Sd S)
NsendfileFZSENDFILEy1yestrueT)rg   rh   zyesztrue)r   r$   r   r    lower)r!   rf   r	   r	   r   rf      s    
zConfig.sendfile)__name__
__module____qualname__r"   r%   r'   r*   r8   propertyrB   r;   r>   rF   rK   rM   rO   rP   rR   rY   r]   rc   rf   r	   r	   )r)   r   r   0   s$   
r   c                   s.   e  Z d  Z   f d d   Z d d   Z   S)SettingMetac                s   t  t |   j } d d   | D } | s> | |  | | |  St t  | d <t | d  | d <| |  | | |  } | j | j d d   t j |  | S)Nc             S   s%   g  |  ] } t  | t  r |  q Sr	   )
isinstancerp   )rI   br	   r	   r   rJ      s   	 z'SettingMeta.__new__.<locals>.<listcomp>order	validatordesc )	r&   rp   __new__lenr   r   fmt_descr$   append)clsr   basesattrsZ	super_newparents	new_class)r)   r	   r   rw      s    zSettingMeta.__new__c             C   sC   t  j |  j   } t |  d |  t |  d | j   d  d  S)Nru   shortr   )textwrapdedentstripsetattr
splitlines)r{   ru   r	   r	   r   ry      s    zSettingMeta.fmt_desc)rl   rm   rn   rw   ry   r	   r	   )r)   r   rp      s   rp   c               @   s   e  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 d   Z d d   Z d d   Z d d	   Z d
 d   Z d d   Z e Z d S)SettingNc             C   s&   |  j  d  k	 r" |  j |  j   n  d  S)N)r-   r*   )r!   r	   r	   r   r"      s    zSetting.__init__c             C   s  |  j  s d  St |  j   } d |  j |  j f } | j d d  } i |  j d 6|  j p] d d 6|  j pm t d 6d  d 6| d	 6} |  j	 d  k	 r |  j	 | d
 <n  | d d k r | j
 d  n  |  j d  k	 r |  j | d <n  |  j d  k	 r |  j | d <n  | j | |   d  S)Nz%s [%s]%z%%deststorer+   typer-   r.   metavarr/   const)clitupler   r-   replacer   r+   r   strmetapopr/   r   r4   )r!   r8   r   Zhelp_txtr   r	   r	   r   r7      s(    	

zSetting.add_optionc             C   s   t  j  |   S)N)r   )r!   r	   r	   r   r     s    zSetting.copyc             C   s   |  j  S)N)r(   )r!   r	   r	   r   r$     s    zSetting.getc             C   s>   t  j |  j  s( t d |  j   n  |  j |  |  _ d  S)NzInvalid validator: %s)r   callablert   	TypeErrorr   r(   )r!   valr	   r	   r   r*     s    zSetting.setc             C   s"   |  j  | j  k o! |  j | j k  S)N)rT   rs   )r!   otherr	   r	   r   __lt__   s    zSetting.__lt__)rl   rm   rn   r   r(   rT   r   rt   r   r   r+   r-   r   ru   r/   r   r"   r7   r   r$   r*   r   Z__cmp__r	   r	   r	   r   r      s(   r   c             C   s   |  d  k r d  St  |  t  r# |  St  |  t j  sH t d |    n  |  j   j   d k rd d S|  j   j   d k r d St d |    d  S)NzInvalid type for casting: %srj   TfalseFzInvalid boolean: %s)rq   boolr   string_typesr   rk   r   ra   )r   r	   r	   r   validate_bool(  s    r   c             C   s&   t  |  t  s" t d |    n  |  S)NzValue is not a dictionary: %s )rq   dictr   )r   r	   r	   r   validate_dict8  s    r   c             C   sS   t  |  t j  s$ t |  d  }  n t |   }  |  d k  rO t d |    n  |  S)Nr   zValue must be positive: %s)rq   r   integer_typesintra   )r   r	   r	   r   validate_pos_int>  s    r   c             C   s?   |  d  k r d  St  |  t j  s5 t d |    n  |  j   S)NzNot a string: %s)rq   r   r   r   r   )r   r	   r	   r   validate_stringI  s
    r   c             C   s9   |  s
 g  St  |  t j  r( |  g }  n  d d   |  D S)Nc             S   s   g  |  ] } t  |   q Sr	   )r   )rI   re   r	   r	   r   rJ   Y  s   	 z(validate_list_string.<locals>.<listcomp>)rq   r   r   )r   r	   r	   r   validate_list_stringQ  s
    r   c             C   s0   t  |   }  |  s g  Sd d   |  j d  D S)Nc             S   s"   g  |  ] } | r | j     q Sr	   )r   )rI   re   r	   r	   r   rJ   b  s   	 z+validate_string_to_list.<locals>.<listcomp>,)r   r`   )r   r	   r	   r   validate_string_to_list\  s    r   c             C   sG   t  j |   s t  j |   r* |    }  n  t  j |   r= |  St |   S)N)inspectZ
isfunctionZismethodZisclassr   )r   r	   r	   r   validate_classe  s
    r   c                s     f d d   } | S)Nc                sC  t  |  t j  r y |  j d d  \ } } Wn" t k
 rR t d |    Yn Xy( t | d | g } t | |  }  Wq t k
 r } z t t	 |    WYd  d  } ~ Xq t
 k
 r t d | | f   Yq Xn  t j |   st d |    n    d	 k r?  t t j |   d  k r?t d     n  |  S)
N.r   zFValue '%s' is not import string. Format: module[.submodules...].objectfromlistzCan not load '%s' from '%s'zValue is not six.callable: %sr   zValue must have an arity of: %s)rq   r   r   rsplitra   r   
__import__getattrImportErrorr   r#   r   rx   r   
getargspec)r   Zmod_nameZobj_namemodrd   )arityr	   r   _validate_callablen  s&    $+z-validate_callable.<locals>._validate_callabler	   )r   r   r	   )r   r   validate_callablem  s    r   c             C   s|   |  d  k r t  j   St |  t  r) |  S|  j   r? t |   Sy t j |   j SWn" t k
 rw t	 d |    Yn Xd  S)NzNo such user: '%s')
r   geteuidrq   r   isdigitpwdgetpwnampw_uidKeyErrorr   )r   r	   r	   r   validate_user  s    

r   c             C   s|   |  d  k r t  j   St |  t  r) |  S|  j   r? t |   Sy t j |   j SWn" t k
 rw t	 d |    Yn Xd  S)NzNo such group: '%s')
r   getegidrq   r   r   grpgetgrnamgr_gidr   r   )r   r	   r	   r   validate_group  s    

r   c                s   t  d
       t t j    d  } | d k r;   S| d k rW   f d d   S| d k rs   f d d   St d	   d  S)Nr   r         c                s     |  | |  S)Nr	   )workerreqrc   _r)r   r	   r   <lambda>  s    z'validate_post_request.<locals>.<lambda>   c                s     |  |  S)Nr	   )r   r   _er   )r   r	   r   r     s    zValue must have an arity of: 4r   )r   rx   r   r   r   )r   largsr	   )r   r   validate_post_request  s    r   c             C   sh   t  |   }  t j j t j j t j j t j   |     } t j j |  sd t	 d |    n  | S)Nzcan't chdir to %r)
r   r   r   abspathnormpathjoinr   getcwdexistsr   )r   r   r	   r	   r   validate_chdir  s
    3r   c             C   sx   |  d  k r d  St  |   }  t j j t j j t j j t j   |     } t j j |  st t	 d |    n  | S)Nz%r not found)
r   r   r   r   r   r   r   r   r   r   )r   r   r	   r	   r   validate_file  s    3r   c             C   se   t  |   }  |  d  k r d  S|  j d  } t |  d k rU | d t | d  f St d   d  S)N:r   r   r   z$Value must consist of: hostname:port)r   r`   rx   r   r   )r   elementsr	   r	   r   validate_hostport  s    r   c              C   sA   t  j j t  j j t  j    d  }  t  j j |   r= |  Sd  S)Nzgunicorn.conf.py)r   r   r   r   r   r   )Zconfig_pathr	   r	   r   get_default_config_file  s
    	r   c               @   s@   e  Z d  Z d Z d Z d d g Z d Z e Z d Z	 d Z
 d S)
ConfigFileconfigzConfig Filez-cz--configZCONFIGNay          The Gunicorn config file.

        A string of the form ``PATH``, ``file:PATH``, or ``python:MODULE_NAME``.

        Only has an effect when specified on the command line or as part of an
        application specific configuration.

        .. versionchanged:: 19.4
           Loading the config from a Python module requires the ``python:``
           prefix.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r     s   r   c               @   sy   e  Z d  Z d Z d Z d Z d d g Z d Z e Z	 d e
 j k rf d j e
 j j d   g Z n	 d	 g Z d
 Z d S)BindrG   rz   zServer Socketz-bz--bindZADDRESSZPORTz0.0.0.0:{0}z127.0.0.1:8000ad          The socket to bind.

        A string of the form: ``HOST``, ``HOST:PORT``, ``unix:PATH``. An IP is
        a valid ``HOST``.

        Multiple addresses can be bound. ex.::

            $ gunicorn -b 127.0.0.1:8000 -b [::1]:8000 test:app

        will bind the `test:app` application on localhost both on ipv6
        and ipv4 interfaces.
        N)rl   rm   rn   r   r+   rT   r   r   r   rt   r   r    formatr$   r-   ru   r	   r	   r	   r   r     s   !	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)BacklogZbacklogzServer Socketz	--backlogINTi   a{          The maximum number of pending connections.

        This refers to the number of clients that can be waiting to be served.
        Exceeding this number results in the client getting an error when
        attempting to connect. It should only affect servers under significant
        load.

        Must be a positive integer. Generally set in the 64-2048 range.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   	
r   c               @   s[   e  Z d  Z d Z d Z d d g Z d Z e Z e	 Z
 e	 e j j d d   Z d Z d	 S)
WorkersrF   zWorker Processesz-wz	--workersr   ZWEB_CONCURRENCYr   a          The number of worker processes for handling requests.

        A positive integer generally in the ``2-4 x $(NUM_CORES)`` range.
        You'll want to vary this a bit to find the best for your particular
        application's work load.

        By default, the value of the ``WEB_CONCURRENCY`` environment variable.
        If it is not defined, the default is ``1``.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r   r    r$   r-   ru   r	   r	   r	   r   r   $  s   
r   c               @   s@   e  Z d  Z d Z d Z d d g Z d Z e Z d Z	 d Z
 d S)	WorkerClassr;   zWorker Processesz-kz--worker-classSTRINGr=   a          The type of workers to use.

        The default class (``sync``) should handle most "normal" types of
        workloads. You'll want to read :doc:`design` for information on when
        you might want to choose one of the other worker classes.

        A string referring to one of the following bundled classes:

        * ``sync``
        * ``eventlet`` - Requires eventlet >= 0.9.7
        * ``gevent``   - Requires gevent >= 0.13
        * ``tornado``  - Requires tornado >= 0.2
        * ``gthread``  - Python 2 requires the futures package to be installed
        * ``gaiohttp`` - Requires Python 3.4 and aiohttp >= 0.21.5

        Optionally, you can provide your own worker by giving Gunicorn a
        Python path to a subclass of ``gunicorn.workers.base.Worker``.
        This alternative syntax will load the gevent class:
        ``gunicorn.workers.ggevent.GeventWorker``. Alternatively, the syntax
        can also load the gevent class with ``egg:gunicorn#gevent``.
        N)rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r   8  s   r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)WorkerThreadsr>   zWorker Processesz	--threadsr   r   al          The number of worker threads for handling requests.

        Run each worker with the specified number of threads.

        A positive integer generally in the ``2-4 x $(NUM_CORES)`` range.
        You'll want to vary this a bit to find the best for your particular
        application's work load.

        If it is not defined, the default is 1.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r   V  s   	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)WorkerConnectionsZworker_connectionszWorker Processesz--worker-connectionsr   i  z        The maximum number of simultaneous clients.

        This setting only affects the Eventlet and Gevent worker types.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r   k  s   	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)MaxRequestsZmax_requestszWorker Processesz--max-requestsr   r   a          The maximum number of requests a worker will process before restarting.

        Any value greater than zero will limit the number of requests a work
        will process before automatically restarting. This is a simple method
        to help limit the damage of memory leaks.

        If this is set to zero (the default) then the automatic worker
        restarts are disabled.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r   z  s   	
r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)MaxRequestsJitterZmax_requests_jitterzWorker Processesz--max-requests-jitterr   r   aB          The maximum jitter to add to the *max_requests* setting.

        The jitter causes the restart per worker to be randomized by
        ``randint(0, max_requests_jitter)``. This is intended to stagger worker
        restarts to avoid all workers restarting at the same time.

        .. versionadded:: 19.2
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   		r   c               @   sF   e  Z d  Z d Z d Z d d g Z d Z e Z e	 Z
 d Z d Z d S)	TimeouttimeoutzWorker Processesz-tz	--timeoutr      a          Workers silent for more than this many seconds are killed and restarted.

        Generally set to thirty seconds. Only set this noticeably higher if
        you're sure of the repercussions for sync workers. For the non sync
        workers it just means that the worker process is still communicating and
        is not tied to the length of time required to handle a single request.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)GracefulTimeoutZgraceful_timeoutzWorker Processesz--graceful-timeoutr   r   a          Timeout for graceful workers restart.

        After receiving a restart signal, workers have this much time to finish
        serving requests. Workers still alive after the timeout (starting from
        the receipt of the restart signal) are force killed.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)	Keepalive	keepalivezWorker Processesz--keep-aliver   r   z        The number of seconds to wait for requests on a Keep-Alive connection.

        Generally set in the 1-5 seconds range.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)LimitRequestLineZlimit_request_lineSecurityz--limit-request-liner   i  a          The maximum size of HTTP request line in bytes.

        This parameter is used to limit the allowed size of a client's
        HTTP request-line. Since the request-line consists of the HTTP
        method, URI, and protocol version, this directive places a
        restriction on the length of a request-URI allowed for a request
        on the server. A server needs this value to be large enough to
        hold any of its resource names, including any information that
        might be passed in the query part of a GET request. Value is a number
        from 0 (unlimited) to 8190.

        This parameter can be used to prevent any DDOS attack.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)LimitRequestFieldsZlimit_request_fieldsr   z--limit-request-fieldsr   d   a?          Limit the number of HTTP headers fields in a request.

        This parameter is used to limit the number of headers in a request to
        prevent DDOS attack. Used with the *limit_request_field_size* it allows
        more safety. By default this value is 100 and can't be larger than
        32768.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   	r   c               @   sC   e  Z d  Z d Z d Z d g Z d Z e Z e	 Z
 d Z d Z d S)LimitRequestFieldSizeZlimit_request_field_sizer   z--limit-request-field_sizer   i  z        Limit the allowed size of an HTTP request header field.

        Value is a number from 0 (unlimited) to 8190. to set the limit
        on the allowed size of an HTTP request header field.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   	r   c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)Reloadreload	Debuggingz--reload
store_trueFa          Restart workers when code changes.

        This setting is intended for development. It will cause workers to be
        restarted whenever application code changes.

        The reloader is incompatible with application preloading. When using a
        paste configuration be sure that the server block does not import any
        application code or the reload will not work as designed.
        N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r     s   	
r   c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)SpewZspewr   z--spewr   Fz|        Install a trace function that spews every line executed by the server.

        This is the nuclear option.
        N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r      s   	r   c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)ConfigCheckZcheck_configr   z--check-configr   Fz)        Check the configuration.
        N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r   .  s   	r   c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)
PreloadAppZpreload_appzServer Mechanicsz	--preloadr   FaY          Load application code before the worker processes are forked.

        By preloading an application you can save some RAM resources as well as
        speed up server boot times. Although, if you defer application loading
        to each worker process, you can reload your application code easily by
        restarting workers.
        N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r   :  s   	r   c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)Sendfilerf   zServer Mechanicsz--no-sendfilestore_constFa          Disables the use of ``sendfile()``.

        If not set, the value of the ``SENDFILE`` environment variable is used
        to enable or disable its usage.

        .. versionadded:: 19.2
        .. versionchanged:: 19.4
           Swapped ``--sendfile`` with ``--no-sendfile`` to actually allow
           disabling.
        .. versionchanged:: 19.6
           added support for the ``SENDFILE`` environment variable
        N)rl   rm   rn   r   rT   r   r   rt   r+   r   ru   r	   r	   r	   r   r   K  s   	r   c               @   s=   e  Z d  Z d Z d Z d g Z e Z e j	   Z
 d Z d S)ChdirchdirzServer Mechanicsz--chdirzB        Chdir to specified directory before apps loading.
        N)rl   rm   rn   r   rT   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r   b  s   	r   c               @   s@   e  Z d  Z d Z d Z d d g Z e Z d Z d Z	 d Z
 d S)	DaemondaemonzServer Mechanicsz-Dz--daemonr   Fz        Daemonize the Gunicorn process.

        Detaches the server from the controlling terminal and enters the
        background.
        N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r   m  s   r   c               @   sF   e  Z d  Z d Z d Z d Z d d g Z d Z e Z	 g  Z
 d Z d S)	Envr^   rz   zServer Mechanicsz-ez--envZENVz        Set environment variable (key=value).

        Pass variables to the execution environment. Ex.::

            $ gunicorn -b 127.0.0.1:8000 --env FOO=1 test:app

        and test for the foo variable environment in your application.
        N)rl   rm   rn   r   r+   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r   {  s   
r   c               @   s@   e  Z d  Z d Z d Z d d g Z d Z e Z d Z	 d Z
 d S)PidfileZpidfilezServer Mechanicsz-pz--pidFILENzf        A filename to use for the PID file.

        If not set, no PID file will be written.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r     s   r   c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)WorkerTmpDirZworker_tmp_dirzServer Mechanicsz--worker-tmp-dirDIRNz        A directory to use for the worker heartbeat temporary file.

        If not set, the default temporary directory will be used.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r     s   	r   c               @   sF   e  Z d  Z d Z d Z d d g Z d Z e Z e	 j
   Z d Z d S)UserrL   zServer Mechanicsz-uz--userUSERz        Switch worker processes to run as this user.

        A valid user id (as an integer) or the name of a user that can be
        retrieved with a call to ``pwd.getpwnam(value)`` or ``None`` to not
        change the worker process user.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   r   c               @   sF   e  Z d  Z d Z d Z d d g Z d Z e Z e	 j
   Z d Z d S)GrouprN   zServer Mechanicsz-gz--groupZGROUPz        Switch worker process to run as this group.

        A valid group id (as an integer) or the name of a user that can be
        retrieved with a call to ``pwd.getgrnam(value)`` or ``None`` to not
        change the worker processes group.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r     s   r   c               @   sF   e  Z d  Z d Z d Z d d g Z d Z e Z e	 Z
 d Z d Z d S)	UmaskumaskzServer Mechanicsz-mz--umaskr   r   a          A bit mask for the file mode on files written by Gunicorn.

        Note that this affects unix socket permissions.

        A valid value for the ``os.umask(mode)`` call or a string compatible
        with ``int(value, 0)`` (``0`` means Python guesses the base, so values
        like ``0``, ``0xFF``, ``0022`` are valid for decimal, hex, and octal
        representations)
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r   r-   ru   r	   r	   r	   r   r    s   
r  c               @   s4   e  Z d  Z d Z d Z d Z e Z d Z d Z	 d S)TmpUploadDirZtmp_upload_dirzServer Mechanicsr   Na6          Directory to store temporary request data as they are read.

        This may disappear in the near future.

        This path should be writable by the process permissions set for Gunicorn
        workers. If not specified, Gunicorn will choose a system generated
        temporary directory.
        )
rl   rm   rn   r   rT   r   r   rt   r-   ru   r	   r	   r	   r   r    s   	r  c               @   sC   e  Z d  Z d Z d Z e Z i d d 6d d 6d d 6Z d	 Z d
 S)SecureSchemeHeaderZsecure_scheme_headerszServer MechanicssslzX-FORWARDED-PROTOCOLhttpszX-FORWARDED-PROTOonzX-FORWARDED-SSLa  
        A dictionary containing headers and values that the front-end proxy
        uses to indicate HTTPS requests. These tell Gunicorn to set
        ``wsgi.url_scheme`` to ``https``, so your application can tell that the
        request is secure.

        The dictionary should map upper-case header names to exact string
        values. The value comparisons are case-sensitive, unlike the header
        names, so make sure they're exactly what your front-end proxy sends
        when handling HTTPS requests.

        It is important that your front-end proxy configuration ensures that
        the headers defined here can not be passed directly from the client.
        N)	rl   rm   rn   r   rT   r   rt   r-   ru   r	   r	   r	   r   r    s   
r  c               @   sL   e  Z d  Z d Z d Z d g Z d Z e Z e	 j
 j d d  Z d Z d S)	ForwardedAllowIPSZforwarded_allow_ipszServer Mechanicsz--forwarded-allow-ipsr   ZFORWARDED_ALLOW_IPSz	127.0.0.1a          Front-end's IPs from which allowed to handle set secure headers.
        (comma separate).

        Set to ``*`` to disable checking of Front-end IPs (useful for setups
        where you don't know in advance the IP address of Front-end, but
        you still trust the environment).

        By default, the value of the ``FORWARDED_ALLOW_IPS`` environment
        variable. If it is not defined, the default is ``"127.0.0.1"``.
        N)rl   rm   rn   r   rT   r   r   r   rt   r   r    r$   r-   ru   r	   r	   r	   r   r  	  s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)	AccessLogZ	accesslogLoggingz--access-logfiler   NzW        The Access log file to write to.

        ``'-'`` means log to stderr.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r	    s   	r	  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)AccessLogFormatZaccess_log_formatr
  z--access-logformatr   z;%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"a          The access log format.

        ==========  ===========
        Identifier  Description
        ==========  ===========
        h           remote address
        l           ``'-'``
        u           user name
        t           date of the request
        r           status line (e.g. ``GET / HTTP/1.1``)
        m           request method
        U           URL path without query string
        q           query string
        H           protocol
        s           status
        B           response length
        b           response length or ``'-'`` (CLF format)
        f           referer
        a           user agent
        T           request time in seconds
        D           request time in microseconds
        L           request time in decimal seconds
        p           process ID
        {Header}i   request header
        {Header}o   response header
        ==========  ===========
        N)rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r  +  s   	r  c               @   s@   e  Z d  Z d Z d Z d d g Z d Z e Z d Z	 d Z
 d S)	ErrorLogZerrorlogr
  z--error-logfilez
--log-filer   -z        The Error log file to write to.

        Using ``'-'`` for FILE makes gunicorn log to stderr.

        .. versionchanged:: 19.2
           Log to stderr by default.

        N)rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r  P  s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)LoglevelZloglevelr
  z--log-levelZLEVELinfoz        The granularity of Error log outputs.

        Valid level names are:

        * debug
        * info
        * warning
        * error
        * critical
        N)rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r  b  s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)CaptureOutputZcapture_outputr
  z--capture-outputr   FzU        Redirect stdout/stderr to Error log.

        .. versionadded:: 19.6
        N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r  v  s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)rV   rR   r
  z--logger-classr   zgunicorn.glogging.Loggera          The logger you want to use to log events in Gunicorn.

        The default class (``gunicorn.glogging.Logger``) handle most of
        normal usages in logging. It provides error and access logging.

        You can provide your own worker by giving Gunicorn a
        Python path to a subclass like ``gunicorn.glogging.Logger``.
        Alternatively the syntax can also load the Logger class
        with ``egg:gunicorn#simple``.
        N)rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   rV     s   	rV   c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)	LogConfigZ	logconfigr
  z--log-configr   Nzz    The log config file to use.
    Gunicorn uses the standard Python logging module's Configuration
    file format.
    )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r    s   	r  c               @   s|   e  Z d  Z d Z d Z d g Z d Z e Z e	 d k rB d Z
 n0 e	 d k rW d	 Z
 n e	 d
 k rl d Z
 n d Z
 d Z d S)SyslogToZsyslog_addrr
  z--log-syslog-toZSYSLOG_ADDRdarwinzunix:///var/run/syslogfreebsd	dragonflyzunix:///var/run/logZopenbsdzunix:///dev/logzudp://localhost:514aY      Address to send syslog messages.

    Address is a string of the form:

    * ``unix://PATH#TYPE`` : for unix domain socket. ``TYPE`` can be ``stream``
      for the stream driver or ``dgram`` for the dgram driver.
      ``stream`` is the default.
    * ``udp://HOST:PORT`` : for UDP sockets
    * ``tcp://HOST:PORT`` : for TCP sockets

    N)r  r  )rl   rm   rn   r   rT   r   r   r   rt   PLATFORMr-   ru   r	   r	   r	   r   r    s   				r  c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)Syslogsyslogr
  z--log-syslogr   Fz(    Send *Gunicorn* logs to syslog.
    N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   r    s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)SyslogPrefixZsyslog_prefixr
  z--log-syslog-prefixZSYSLOG_PREFIXNz    Makes Gunicorn use the parameter as program-name in the syslog entries.

    All entries will be prefixed by ``gunicorn.<prefix>``. By default the
    program name is the name of the process.
    )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r    s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)SyslogFacilityZsyslog_facilityr
  z--log-syslog-facilityZSYSLOG_FACILITYrL   z    Syslog facility name
    N)rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r    s   	r  c               @   s@   e  Z d  Z d Z d Z d d g Z e Z d Z d Z	 d Z
 d S)	EnableStdioInheritanceZenable_stdio_inheritancer
  z-Rz--enable-stdio-inheritanceFr   z    Enable stdio inheritance.

    Enable inheritance for stdio file descriptors in daemon mode.

    Note: To disable the Python stdout buffering, you can to set the user
    environment variable ``PYTHONUNBUFFERED`` .
    N)rl   rm   rn   r   rT   r   r   rt   r-   r+   ru   r	   r	   r	   r   r    s   r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z d Z e Z	 d Z
 d S)
StatsdHostrS   r
  z--statsd-hostZSTATSD_ADDRNzR    ``host:port`` of the statsd server to log to.

    .. versionadded:: 19.1
    )rl   rm   rn   r   rT   r   r   r-   r   rt   ru   r	   r	   r	   r   r    s   	r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z d Z e Z	 d Z
 d S)StatsdPrefixZstatsd_prefixr
  z--statsd-prefixZSTATSD_PREFIXrv   z    Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
    if not provided).

    .. versionadded:: 19.2
    N)rl   rm   rn   r   rT   r   r   r-   r   rt   ru   r	   r	   r	   r   r  
  s   	r  c               @   s@   e  Z d  Z d Z d Z d d g Z d Z e Z d Z	 d Z
 d S)ProcnamerP   zProcess Namingz-nz--namer   Na          A base to use with setproctitle for process naming.

        This affects things like ``ps`` and ``top``. If you're going to be
        running more than one instance of Gunicorn you'll probably want to set a
        name to tell them apart. This requires that you install the setproctitle
        module.

        If not set, the *default_proc_name* setting will be used.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r    s   
r  c               @   s.   e  Z d  Z d Z d Z e Z d Z d Z d S)DefaultProcNamerQ   zProcess NaminggunicornzP        Internal setting that is adjusted for each type of application.
        N)	rl   rm   rn   r   rT   r   rt   r-   ru   r	   r	   r	   r   r  ,  s
   r  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)DjangoSettingsZdjango_settingsZDjangoz
--settingsr   Na          The Python path to a Django settings module. (deprecated)

        e.g. ``myproject.settings.main``. If this isn't provided, the
        ``DJANGO_SETTINGS_MODULE`` environment variable will be used.

        **DEPRECATED**: use the ``--env`` argument instead.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r!  6  s   	r!  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)
PythonPathZ
pythonpathzServer Mechanicsz--pythonpathr   Nz        A comma-separated list of directories to add to the Python path.

        e.g.
        ``'/home/djangoprojects/myproject,/home/python/mylibrary'``.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r"  G  s   	r"  c               @   s@   e  Z d  Z d Z d Z d d g Z d Z e Z d Z	 d Z
 d S)PasteZpastezServer Mechanicsz--pastez--pasterr   Na[          Load a PasteDeploy config file. The argument may contain a ``#``
        symbol followed by the name of an app section from the config file,
        e.g. ``production.ini#admin``.

        At this time, using alternate server blocks is not supported. Use the
        command line arguments to control server configuration instead.
        )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   r#  V  s   r#  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)
OnStartingon_startingzServer Hooksr   c             C   s   d  S)Nr	   )serverr	   r	   r   r%  m  s    zOnStarting.on_startingz        Called just before the master process is initialized.

        The callable needs to accept a single instance variable for the Arbiter.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r%  staticmethodr-   ru   r	   r	   r	   r   r$  g  s   	r$  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)OnReload	on_reloadzServer Hooksr   c             C   s   d  S)Nr	   )r&  r	   r	   r   r)  }  s    zOnReload.on_reloadz        Called to recycle workers during a reload via SIGHUP.

        The callable needs to accept a single instance variable for the Arbiter.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r)  r'  r-   ru   r	   r	   r	   r   r(  w  s   	r(  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)	WhenReady
when_readyzServer Hooksr   c             C   s   d  S)Nr	   )r&  r	   r	   r   r+    s    zWhenReady.when_readyz        Called just after the server is started.

        The callable needs to accept a single instance variable for the Arbiter.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r+  r'  r-   ru   r	   r	   r	   r   r*    s   	r*  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)Preforkpre_forkzServer Hooksr   c             C   s   d  S)Nr	   )r&  r   r	   r	   r   r-    s    zPrefork.pre_forkz        Called just before a worker is forked.

        The callable needs to accept two instance variables for the Arbiter and
        new Worker.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r-  r'  r-   ru   r	   r	   r	   r   r,    s   	r,  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)Postfork	post_forkzServer Hooksr   c             C   s   d  S)Nr	   )r&  r   r	   r	   r   r/    s    zPostfork.post_forkz        Called just after a worker has been forked.

        The callable needs to accept two instance variables for the Arbiter and
        new Worker.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r/  r'  r-   ru   r	   r	   r	   r   r.    s   	r.  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)PostWorkerInitpost_worker_initzServer Hooksr   c             C   s   d  S)Nr	   )r   r	   r	   r   r1    s    zPostWorkerInit.post_worker_initz        Called just after a worker has initialized the application.

        The callable needs to accept one instance variable for the initialized
        Worker.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r1  r'  r-   ru   r	   r	   r	   r   r0    s   	r0  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)	WorkerInt
worker_intzServer Hooksr   c             C   s   d  S)Nr	   )r   r	   r	   r   r3    s    zWorkerInt.worker_intz        Called just after a worker exited on SIGINT or SIGQUIT.

        The callable needs to accept one instance variable for the initialized
        Worker.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r3  r'  r-   ru   r	   r	   r	   r   r2    s   	r2  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)WorkerAbortworker_abortzServer Hooksr   c             C   s   d  S)Nr	   )r   r	   r	   r   r5    s    zWorkerAbort.worker_abortz        Called when a worker received the SIGABRT signal.

        This call generally happens on timeout.

        The callable needs to accept one instance variable for the initialized
        Worker.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r5  r'  r-   ru   r	   r	   r	   r   r4    s   	r4  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)PreExecpre_execzServer Hooksr   c             C   s   d  S)Nr	   )r&  r	   r	   r   r7    s    zPreExec.pre_execz        Called just before a new master process is forked.

        The callable needs to accept a single instance variable for the Arbiter.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r7  r'  r-   ru   r	   r	   r	   r   r6    s   	r6  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)
PreRequestpre_requestzServer Hooksr   c             C   s$   |  j  j d | j | j f  d  S)Nz%s %s)logdebugmethodr   )r   r   r	   r	   r   r9    s    zPreRequest.pre_requestz        Called just before a worker processes the request.

        The callable needs to accept two instance variables for the Worker and
        the Request.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r9  r'  r-   ru   r	   r	   r	   r   r8     s   	r8  c               @   sI   e  Z d  Z d Z d Z e Z e j Z	 d d   Z
 e e
  Z d Z d S)PostRequestpost_requestzServer Hooksc             C   s   d  S)Nr	   )r   r   r    respr	   r	   r   r>    s    zPostRequest.post_requestz        Called after a worker processes the request.

        The callable needs to accept two instance variables for the Worker and
        the Request.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   r>  r'  r-   ru   r	   r	   r	   r   r=    s   	r=  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)
WorkerExitworker_exitzServer Hooksr   c             C   s   d  S)Nr	   )r&  r   r	   r	   r   rA  (  s    zWorkerExit.worker_exitz        Called just after a worker has been exited.

        The callable needs to accept two instance variables for the Arbiter and
        the just-exited Worker.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   rA  r'  r-   ru   r	   r	   r	   r   r@  "  s   	r@  c               @   sO   e  Z d  Z d Z d Z e d  Z e j Z	 d d   Z
 e e
  Z d Z d S)NumWorkersChangednworkers_changedzServer Hooksr   c             C   s   d  S)Nr	   )r&  Z	new_value	old_valuer	   r	   r   rC  9  s    z"NumWorkersChanged.nworkers_changeda7          Called just after *num_workers* has been changed.

        The callable needs to accept an instance variable of the Arbiter and
        two integers of number of workers after and before change.

        If the number of workers is set for the first time, *old_value* would
        be ``None``.
        N)rl   rm   rn   r   rT   r   rt   r   r   r   rC  r'  r-   ru   r	   r	   r	   r   rB  3  s   		rB  c               @   sF   e  Z d  Z d Z d Z e d  Z d d   Z e e  Z	 d Z
 d S)OnExiton_exitzServer Hooksr   c             C   s   d  S)Nr	   )r&  r	   r	   r   rF  K  s    zOnExit.on_exitz        Called just before exiting Gunicorn.

        The callable needs to accept a single instance variable for the Arbiter.
        N)rl   rm   rn   r   rT   r   rt   rF  r'  r-   ru   r	   r	   r	   r   rE  F  s   rE  c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)ProxyProtocolZproxy_protocolzServer Mechanicsz--proxy-protocolFr   a           Enable detect PROXY protocol (PROXY mode).

        Allow using HTTP and Proxy together. It may be useful for work with
        stunnel as HTTPS frontend and Gunicorn as HTTP server.

        PROXY protocol: http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt

        Example for stunnel config::

            [https]
            protocol = proxy
            accept  = 443
            connect = 80
            cert = /etc/ssl/certs/stunnel.pem
            key = /etc/ssl/certs/stunnel.key
        N)rl   rm   rn   r   rT   r   r   rt   r-   r+   ru   r	   r	   r	   r   rG  V  s   	rG  c               @   s7   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d S)ProxyAllowFromZproxy_allow_ipszServer Mechanicsz--proxy-allow-fromz	127.0.0.1a          Front-end's IPs from which allowed accept proxy requests (comma separate).

        Set to ``*`` to disable checking of Front-end IPs (useful for setups
        where you don't know in advance the IP address of Front-end, but
        you still trust the environment)
        N)
rl   rm   rn   r   rT   r   r   rt   r-   ru   r	   r	   r	   r   rH  p  s   	rH  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)KeyFilerX   rZ   z	--keyfiler   Nz    SSL key file
    )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   rI    s   	rI  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)CertFilerW   rZ   z
--certfiler   Nz    SSL certificate file
    )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   rJ    s   	rJ  c               @   s:   e  Z d  Z d Z d Z d g Z e Z e j	 Z
 d Z d S)
SSLVersionssl_versionrZ   z--ssl-versionz5    SSL version to use (see stdlib ssl module's)
    N)rl   rm   rn   r   rT   r   r   rt   r  PROTOCOL_TLSv1r-   ru   r	   r	   r	   r   rK    s   		rK  c               @   s:   e  Z d  Z d Z d Z d g Z e Z e j	 Z
 d Z d S)CertReqs	cert_reqsrZ   z--cert-reqszI    Whether client certificate is required (see stdlib ssl module's)
    N)rl   rm   rn   r   rT   r   r   rt   r  	CERT_NONEr-   ru   r	   r	   r	   r   rN    s   		rN  c               @   s=   e  Z d  Z d Z d Z d g Z d Z e Z d Z	 d Z
 d S)CACertsca_certsrZ   z
--ca-certsr   Nz    CA certificates file
    )rl   rm   rn   r   rT   r   r   r   rt   r-   ru   r	   r	   r	   r   rQ    s   	rQ  c               @   s=   e  Z d  Z d Z d Z d g Z d Z d Z e Z	 d Z
 d S)SuppressRaggedEOFssuppress_ragged_eofsrZ   z--suppress-ragged-eofsr   Tz7    Suppress ragged EOFs (see stdlib ssl module's)
    N)rl   rm   rn   r   rT   r   r+   r-   r   rt   ru   r	   r	   r	   r   rS    s   	rS  c               @   s=   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d Z
 d S)DoHandshakeOnConnectdo_handshake_on_connectrZ   z--do-handshake-on-connectr   FzU    Whether to perform SSL handshake on socket connect (see stdlib ssl module's)
    N)rl   rm   rn   r   rT   r   r   rt   r+   r-   ru   r	   r	   r	   r   rU    s   	rU  r      c               @   s7   e  Z d  Z d Z d Z d g Z e Z d Z d Z	 d S)CiphersciphersrZ   z	--ciphersZTLSv1z9        Ciphers to use (see stdlib ssl module's)
        N)
rl   rm   rn   r   rT   r   r   rt   r-   ru   r	   r	   r	   r   rX    s   	rX  )r   rW  )wr   r   r   r2   r   rv   r   r   r   r  r   r   r   r   r   Zgunicorn.errorsr   r   r   r   platformr  r   r   objectr   r   rp   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r	  r  r  r  r  rV   r  r  r  r  r  r  r  r  r  r  r!  r"  r#  r$  r(  r*  r,  r.  r0  r2  r4  r6  r8  r=  r@  rB  rE  rG  rH  rI  rJ  rK  rN  rQ  rS  rU  version_inforX  r	   r	   r	   r   <module>   s   	A	
%


