1 """WSGI server interface (see PEP 333). This adds some CP-specific bits to
2 the framework-agnostic wsgiserver package.
3 """
4
5 import cherrypy
6 from cherrypy import wsgiserver
7
8
10
11 - def __init__(self, sendall, environ, wsgi_app):
16
17
21
22
24 """Wrapper for wsgiserver.CherryPyWSGIServer.
25
26 wsgiserver has been designed to not reference CherryPy in any way,
27 so that it can be used in other frameworks and applications. Therefore,
28 we wrap it here, so we can set our own mount points from cherrypy.tree
29 and apply some attributes from config -> cherrypy.server -> wsgiserver.
30 """
31
32 ConnectionClass = CPHTTPConnection
33
35 server = cherrypy.server
36 sockFile = server.socket_file
37 if sockFile:
38 bind_addr = sockFile
39 else:
40 bind_addr = (server.socket_host, server.socket_port)
41
42 s = wsgiserver.CherryPyWSGIServer
43 s.__init__(self, bind_addr, cherrypy.tree,
44 server.thread_pool,
45 server.socket_host,
46 max = server.thread_pool_max,
47 request_queue_size = server.socket_queue_size,
48 timeout = server.socket_timeout,
49 shutdown_timeout = server.shutdown_timeout,
50 )
51 self.protocol = server.protocol_version
52 self.nodelay = server.nodelay
53 self.ssl_certificate = server.ssl_certificate
54 self.ssl_private_key = server.ssl_private_key
55