|
@@ -45,6 +45,7 @@ def _webio_handler(target, session_cls, check_origin_func=_is_same_site):
|
|
"""获取用于Tornado进行整合的RequestHandle类
|
|
"""获取用于Tornado进行整合的RequestHandle类
|
|
|
|
|
|
:param target: 任务函数
|
|
:param target: 任务函数
|
|
|
|
+ :param session_cls: 会话实现类
|
|
:param callable check_origin_func: check_origin_func(origin, handler) -> bool
|
|
:param callable check_origin_func: check_origin_func(origin, handler) -> bool
|
|
:return: Tornado RequestHandle类
|
|
:return: Tornado RequestHandle类
|
|
"""
|
|
"""
|
|
@@ -99,7 +100,14 @@ def webio_handler(target, allowed_origins=None, check_origin=None):
|
|
|
|
|
|
:param target: 任务函数。任务函数为协程函数时,使用 :ref:`基于协程的会话实现 <coroutine_based_session>` ;任务函数为普通函数时,使用基于线程的会话实现。
|
|
:param target: 任务函数。任务函数为协程函数时,使用 :ref:`基于协程的会话实现 <coroutine_based_session>` ;任务函数为普通函数时,使用基于线程的会话实现。
|
|
:param list allowed_origins: 除当前域名外,服务器还允许的请求的来源列表。
|
|
:param list allowed_origins: 除当前域名外,服务器还允许的请求的来源列表。
|
|
- 来源包含协议和域名和端口部分,允许使用 ``*`` 作为通配符。 比如 ``https://*.example.com`` 、 ``*://*.example.com`` 、
|
|
|
|
|
|
+ 来源包含协议和域名和端口部分,允许使用 Unix shell 风格的匹配模式:
|
|
|
|
+
|
|
|
|
+ - ``*`` 为通配符
|
|
|
|
+ - ``?`` 匹配单个字符
|
|
|
|
+ - ``[seq]`` 匹配seq内的字符
|
|
|
|
+ - ``[!seq]`` 匹配不在seq内的字符
|
|
|
|
+
|
|
|
|
+ 比如 ``https://*.example.com`` 、 ``*://*.example.com`` 、
|
|
:param callable check_origin: 请求来源检查函数。接收请求来源(包含协议和域名和端口部分)字符串,
|
|
:param callable check_origin: 请求来源检查函数。接收请求来源(包含协议和域名和端口部分)字符串,
|
|
返回 ``True/False`` 。若设置了 ``check_origin`` , ``allowed_origins`` 参数将被忽略
|
|
返回 ``True/False`` 。若设置了 ``check_origin`` , ``allowed_origins`` 参数将被忽略
|
|
:return: Tornado RequestHandle类
|
|
:return: Tornado RequestHandle类
|
|
@@ -157,10 +165,17 @@ def start_server(target, port=0, host='', debug=False,
|
|
set empty string or to listen on all available interfaces.
|
|
set empty string or to listen on all available interfaces.
|
|
:param bool debug: Tornado debug mode
|
|
:param bool debug: Tornado debug mode
|
|
:param list allowed_origins: 除当前域名外,服务器还允许的请求的来源列表。
|
|
:param list allowed_origins: 除当前域名外,服务器还允许的请求的来源列表。
|
|
- 来源包含协议和域名和端口部分,允许使用 ``*`` 作为通配符。 比如 ``https://*.example.com`` 、 ``*://*.example.com`` 、
|
|
|
|
|
|
+ 来源包含协议和域名和端口部分,允许使用 Unix shell 风格的匹配模式:
|
|
|
|
+
|
|
|
|
+ - ``*`` 为通配符
|
|
|
|
+ - ``?`` 匹配单个字符
|
|
|
|
+ - ``[seq]`` 匹配seq内的字符
|
|
|
|
+ - ``[!seq]`` 匹配不在seq内的字符
|
|
|
|
+
|
|
|
|
+ 比如 ``https://*.example.com`` 、 ``*://*.example.com``
|
|
:param callable check_origin: 请求来源检查函数。接收请求来源(包含协议和域名和端口部分)字符串,
|
|
:param callable check_origin: 请求来源检查函数。接收请求来源(包含协议和域名和端口部分)字符串,
|
|
返回 ``True/False`` 。若设置了 ``check_origin`` , ``allowed_origins`` 参数将被忽略
|
|
返回 ``True/False`` 。若设置了 ``check_origin`` , ``allowed_origins`` 参数将被忽略
|
|
- :param bool auto_open_webbrowser: Whether or not auto open web browser when server is started.
|
|
|
|
|
|
+ :param bool auto_open_webbrowser: Whether or not auto open web browser when server is started (if the operating system allows it) .
|
|
:param int websocket_max_message_size: Max bytes of a message which Tornado can accept.
|
|
:param int websocket_max_message_size: Max bytes of a message which Tornado can accept.
|
|
Messages larger than the ``websocket_max_message_size`` (default 10MiB) will not be accepted.
|
|
Messages larger than the ``websocket_max_message_size`` (default 10MiB) will not be accepted.
|
|
:param int websocket_ping_interval: If set to a number, all websockets will be pinged every n seconds.
|
|
:param int websocket_ping_interval: If set to a number, all websockets will be pinged every n seconds.
|