Repository URL to install this package:
|
Version:
5.0.6.dev24-5.0 ▾
|
3
kÉÛc³@ ã @ sJ d Z ddlZddlZddlZddlZddlZddlZddlZddl m
Z ddlm
Z
ddlmZ ddlmZ ddlZddlZddlZddlZddlZddlmZ ddlmZmZmZ dd lmZ ej j!Z!ej"e#Z$G d
d de
j%Z&G dd
d
ej'Z'G dd de(Z)G dd de)Z*G dd de*Z+G dd de(Z,G dd de(Z-dS )z.Utility methods for working with WSGI servers.é N)Úlog)Úservice)Úexcutils)Údeploy)Ú exception)Ú_Ú_LEÚ_LI)Úutilsc @ sT e Zd ZdZejjZdddejjdddfddZ d d
Z
dd Zd
d Zdd Z
dS )ÚServerzAServer class to manage a WSGI server, serving a WSGI application.z0.0.0.0r Né Fc
C s\ t jjtj_|| _|| _d| _|| _|p,| j | _
tj| j
| _t
jd| j | _|| _| | _t jjpfd| _|dk rtjtdd||f}
y4tj|
d |
d tjtjd }|d }|d
}
W n tk
rØ tj}Y nX ytj|
||d| _W n. tk
r tj t!d||d Y nX | jj" dd
\| _#| _$tj%t&d| j| j#| j$d dS )a Initialize, but do not start, a WSGI server.
:param name: Pretty name for logging.
:param app: The WSGI application to serve.
:param host: IP address to serve the application.
:param port: Port number to server the application.
:param pool_size: Maximum number of eventlets to spawn concurrently.
:param backlog: Maximum number of queued connections.
:param max_url_len: Maximum length of permitted URLs.
:returns: None
:raises: dmapi.exception.InvalidInput
Nzdmapi.%s.wsgi.serveré zThe backlog must be more than 0)Úreasonr )Úbacklogz#Could not bind to %(host)s:%(port)s)ÚhostÚporté z'%(name)s listening on %(host)s:%(port)s)Únamer r éÿÿÿÿ)'ÚCONFÚwsgiZmax_header_lineÚeventletZMAX_HEADER_LINEr ÚappÚ_serverÚ _protocolÚdefault_pool_sizeÚ pool_sizeZ GreenPoolÚ_poolÚloggingÚ getLoggerÚ_loggerÚ_use_sslÚ_max_url_lenÚclient_socket_timeoutr ZInvalidInputr ÚsocketZgetaddrinfoZ AF_UNSPECZSOCK_STREAMÚ ExceptionZAF_INETZlistenÚ_socketÚEnvironmentErrorÚLOGÚerrorr Zgetsocknamer r Úinfor )
Úselfr r r r r Úprotocolr Zuse_sslZmax_url_lenZ bind_addrr* Zfamily© r- ú/usr/lib/python3.6/wsgi.pyÚ__init__( sB
zServer.__init__c C sÎ | j j }|jtjtjd |jtjtjd ttdrN|jtjtj t
jj | j
rzyÚt
jj}t
jj}t
jj}|rtjj| rttd| |r´tjj| r´ttd| |rÖtjj| rÖttd| | j
rô| sè| rôttdd||tjd}t
jjr ||d <