本文整理汇总了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