Tornado 6.4 Documentation
1.09 MB
268 页
0 评论
语言 | 格式 | 评分 |
---|---|---|
英语 | .pdf | 3 |
摘要 | ||
Tornado Documentation, Release 6.4 introduce various improvements and bug fixes across multiple modules. Key updates include enhanced performance in IOLoop and IOStream, better IPv6 support in tcpclient and tcpserver, improved error handling in subprocess and cpu_count, and security fixes for cookie parsing. The documentation also covers new features such as support for source_ip and source_port in TCPClient, improved HTTP redirect handling, and enhanced logging capabilities. Additionally, several deprecations and removals of outdated features are noted to guide developers toward modern practices. | ||
AI总结 | ||
《Tornado 6.4 Documentation》摘要如下:
### 1. 模块更新与改进
#### 1.1 tornado.iostream
- 现在允许使用 `memoryview` 对象作为 `write` 方法的参数。
- 内部内存缓冲区从 `list of bytes` 更改为 `bytearray`,提升性能。
- 解决了 `Futures` 在多次 `write` 调用时可能成为孤立问题。
#### 1.2 tornado.log
- 在 Windows 上支持彩色日志输出,需安装 `colorama` 库并在启动时调用 `colorama.init()`。
- `LogFormatter` 构造函数的签名已更改,以与 `logging.config.dictConfig` 兼容。
#### 1.3 tornado.netutil
- 修复了 Solaris 上引发的“LookupError: unknown encoding: latin1”问题。
- 改进了对 GNU Hurd 的兼容性。
- 当 `bind_sockets` 自动选择端口时,IPv4 和 IPv6 将使用相同的端口。
- TLS 压缩在 Python 3.3 及更高版本上默认禁用。
#### 1.4 tornado.process
- 子进程不会再在 Python 3.6 上引发“subprocess still running”警告。
- 提升了 `cpu_count` 的错误处理能力。
#### 1.5 tornado.tcpclient
- `TCPClient` 现在支持 `source_ip` 和 `source_port` 参数。
- 改进了对不完整 IPv6 支持环境的错误处理。
#### 1.6 tornado.tcpserver
- `TCPServer.handle_stream` 实现可以是本机协程。
- 多次停止 `TCPServer` 将不再引发异常。
#### 1.7 tornado.web
- `RedirectHandler` 提供使用 `str.format` 语法替换 URL 部分的功能。
- 新增 `render_linked_js`、`render_embed_js`、`render_linked_css` 和 `render_embed_css` 方法,用于自定义 UIModule 输出。
### 2. 安全改进
- 修复了 Cookie 解析漏洞,防止攻击者设置任意 Cookie 并绕过 XSRF 保护。
- 非 ASCII filename 在 RFC 2231/5987 格式下得到更好的支持。
### 3. 性能优化
- `stack_context` 系统在无上下文活动时性能开销降低。
- `PeriodicCallback` 支持随机变化超时(`jitter` 参数)。
- 内部多个模块(如 `httputil`、`iostream`)性能提升。
### 4. 兼容性与平台支持
- 新增对 Python 2.6 和 3.3+ 的支持,旧版本(如 Python 2.6、3.2)不再兼容。
- `TwistedIOLoop` 现在支持 Python 3.3+(需 Twisted 14.0.0+)。
- 改进了对 Windows 的支持,包括 `AnyThreadEventLoopPolicy` 和 `asyncio` 事件循环配置。
- Docker 环境IPv6绑定问题解决。
### 5. 异步与非阻塞
- 强调所有应用代码应尽量实现异步和非阻塞。
- 优化了 `IOLoop` 和 `IOStream` 的性能与稳定性。
### 6. 安装与文档
- 提供 PDF 和 Epub 格式的文档。
### 7. 主要版本更新
#### 7.1 What’s new in Tornado 6.4
- 简化了 `TCPServer.start` 的 `max_restarts` 参数。
- 提升了 `StaticFileHandler` 对大范围负值的支持。
- 改进了 `XSRF` 处理、分页支持和内存管理。
#### 7.2 安全修复
- 修复了 `Cookie` 解析漏洞。
- 解决了 `parse_body_arguments` 对非 ASCII 输入的处理问题。
#### 7.3 兼容性提升
- 支持 `body_producer` 和 `expect_100_continue` 功能。
- 加强了对 IPv6 的支持。
### 结论
Tornado 6.4 版本主要优化了性能、安全性和跨平台兼容性,提升了对异步和非阻塞编程的支持,并扩展了多项实用功能。用户可通过更新文档获取更详细信息。 |
P1
P2
P3
P4
P5
P6
P7
下载文档到本地,方便使用
- 可预览页数已用完,剩余
261 页请下载阅读 -
文档评分