本文整理匯總了Python中tornado.netutil.ssl_options_to_context方法的典型用法代碼示例。如果您正苦於以下問題:Python netutil.ssl_options_to_context方法的具體用法?Python netutil.ssl_options_to_context怎麽用?Python netutil.ssl_options_to_context使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tornado.netutil
的用法示例。
在下文中一共展示了netutil.ssl_options_to_context方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_ssl_options
# 需要導入模塊: from tornado import netutil [as 別名]
# 或者: from tornado.netutil import ssl_options_to_context [as 別名]
def get_ssl_options(self):
context = ssl_options_to_context(
AsyncHTTPSTestCase.get_ssl_options(self))
assert isinstance(context, ssl.SSLContext)
return context
示例2: get_ssl_options
# 需要導入模塊: from tornado import netutil [as 別名]
# 或者: from tornado.netutil import ssl_options_to_context [as 別名]
def get_ssl_options(self):
context = ssl_options_to_context(AsyncHTTPSTestCase.get_ssl_options(self))
assert isinstance(context, ssl.SSLContext)
return context
示例3: initialize
# 需要導入模塊: from tornado import netutil [as 別名]
# 或者: from tornado.netutil import ssl_options_to_context [as 別名]
def initialize(self, request_callback, ssl_options=None, **kwargs):
if ssl_options is not None:
if isinstance(ssl_options, dict):
if 'certfile' not in ssl_options:
raise KeyError('missing key "certfile" in ssl_options')
ssl_options = ssl_options_to_context(ssl_options)
ssl_options.set_alpn_protocols([constants.HTTP2_TLS])
# TODO: add h2-specific parameters like frame size instead of header size.
self.http2_params = Params(
max_header_size=kwargs.get('max_header_size'),
decompress=kwargs.get('decompress_request', False),
)
super(Server, self).initialize(
request_callback, ssl_options=ssl_options, **kwargs)
示例4: _get_ssl_options
# 需要導入模塊: from tornado import netutil [as 別名]
# 或者: from tornado.netutil import ssl_options_to_context [as 別名]
def _get_ssl_options(self, scheme):
options = super(_HTTP2ClientConnection, self)._get_ssl_options(scheme)
if options is not None:
if isinstance(options, dict):
options = ssl_options_to_context(options)
options.set_alpn_protocols([constants.HTTP2_TLS])
return options