summaryrefslogtreecommitdiff
path: root/cherrypy/_cpnative_server.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-01-19 18:11:34 -0500
committerGitHub <noreply@github.com>2017-01-19 18:11:34 -0500
commit412216ae55fa03212d6e1eb323318304ff8ac465 (patch)
tree6e95dd023a3e590d43e5fb7de8e213eb39ba9b55 /cherrypy/_cpnative_server.py
parenta8af1e5120221aaab9b265f4d76ca6b954919428 (diff)
parent22b840409c2ba4b4101d6a7a8da2e14d14d2497a (diff)
downloadcherrypy-git-9.0.0.tar.gz
Merge pull request #1548 from cherrypy/cherootv9.0.0
Use cheroot for server
Diffstat (limited to 'cherrypy/_cpnative_server.py')
-rw-r--r--cherrypy/_cpnative_server.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/cherrypy/_cpnative_server.py b/cherrypy/_cpnative_server.py
index 026b95cd..71690dad 100644
--- a/cherrypy/_cpnative_server.py
+++ b/cherrypy/_cpnative_server.py
@@ -4,13 +4,14 @@ import logging
import sys
import io
+import cheroot.server
+
import cherrypy
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import httputil
-from cherrypy import wsgiserver
-class NativeGateway(wsgiserver.Gateway):
+class NativeGateway(cheroot.server.Gateway):
recursive = False
@@ -105,11 +106,11 @@ class NativeGateway(wsgiserver.Gateway):
req.write(seg)
-class CPHTTPServer(wsgiserver.HTTPServer):
+class CPHTTPServer(cheroot.server.HTTPServer):
- """Wrapper for wsgiserver.HTTPServer.
+ """Wrapper for cheroot.server.HTTPServer.
- wsgiserver has been designed to not reference CherryPy in any way,
+ 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 apply some attributes
from config -> cherrypy.server -> HTTPServer.
@@ -122,7 +123,7 @@ class CPHTTPServer(wsgiserver.HTTPServer):
self.server_adapter.socket_file or
None)
- wsgiserver.HTTPServer.__init__(
+ cheroot.server.HTTPServer.__init__(
self, server_adapter.bind_addr, NativeGateway,
minthreads=server_adapter.thread_pool,
maxthreads=server_adapter.thread_pool_max,
@@ -140,14 +141,14 @@ class CPHTTPServer(wsgiserver.HTTPServer):
ssl_module = self.server_adapter.ssl_module or 'pyopenssl'
if self.server_adapter.ssl_context:
- adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
+ adapter_class = cheroot.server.get_ssl_adapter_class(ssl_module)
self.ssl_adapter = adapter_class(
self.server_adapter.ssl_certificate,
self.server_adapter.ssl_private_key,
self.server_adapter.ssl_certificate_chain)
self.ssl_adapter.context = self.server_adapter.ssl_context
elif self.server_adapter.ssl_certificate:
- adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
+ adapter_class = cheroot.server.get_ssl_adapter_class(ssl_module)
self.ssl_adapter = adapter_class(
self.server_adapter.ssl_certificate,
self.server_adapter.ssl_private_key,