Add in HTTP/2 support with right deps and log info

This commit is contained in:
Andrew Godwin 2017-03-18 12:10:20 -07:00
parent e6e4240c0e
commit a925ce32cd
2 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import warnings
from twisted.internet import reactor, defer from twisted.internet import reactor, defer
from twisted.internet.endpoints import serverFromString from twisted.internet.endpoints import serverFromString
from twisted.logger import globalLogBeginner, STDLibLogObserver from twisted.logger import globalLogBeginner, STDLibLogObserver
from twisted.web import http
from .http_protocol import HTTPFactory from .http_protocol import HTTPFactory
@ -84,6 +85,12 @@ class Server(object):
else: else:
globalLogBeginner.beginLoggingTo([STDLibLogObserver(__name__)]) globalLogBeginner.beginLoggingTo([STDLibLogObserver(__name__)])
# Detect what Twisted features are enabled
if http.H2_ENABLED:
logger.info("HTTP/2 support enabled")
else:
logger.info("HTTP/2 support not enabled (install the http2 and tls Twisted extras)")
# Disabled deliberately for the moment as it's worse performing # Disabled deliberately for the moment as it's worse performing
if "twisted" in self.channel_layer.extensions and False: if "twisted" in self.channel_layer.extensions and False:
logger.info("Using native Twisted mode on channel layer") logger.info("Using native Twisted mode on channel layer")

View File

@ -24,7 +24,7 @@ setup(
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
'asgiref>=1.0.0', 'asgiref>=1.0.0',
'twisted>=16.0', 'twisted>=17.0',
'autobahn>=0.12', 'autobahn>=0.12',
], ],
extras_require={ extras_require={