What’s new in Tornado 4.5¶
Apr 16, 2017¶
Backwards-compatibility warning¶
- The
tornado.websocketmodule now imposes a limit on the size of incoming messages, which defaults to 10MiB.
New module¶
tornado.routingprovides a more flexible routing system than the one built in toApplication.
General changes¶
- Reduced the number of circular references, reducing memory usage and improving performance.
tornado.auth¶
- The
tornado.authmodule has been updated for compatibility with a change to Facebook’s access_token endpoint. This includes both the changes initially released in Tornado 4.4.3 and an additional change to support the`session_expiresfield in the new format. Thesession_expiresfield is currently a string; it should be accessed asint(user['session_expires'])because it will change from a string to an int in Tornado 5.0.
tornado.concurrent¶
- Suppressed some “‘NoneType’ object not callback” messages that could be logged at shutdown.
tornado.gen¶
yield Noneis now equivalent toyield gen.moment.momentis deprecated. This improves compatibility withasyncio.- Fixed an issue in which a generator object could be garbage collected prematurely (most often when weak references are used.
- New function
is_coroutine_functionidentifies functions wrapped bycoroutineorengine.
tornado.http1connection¶
- The
Transfer-Encodingheader is now parsed case-insensitively.
tornado.httpclient¶
SimpleAsyncHTTPClientnow follows 308 redirects.CurlAsyncHTTPClientwill no longer accept protocols other thanhttpandhttps. To override this, setpycurl.PROTOCOLSandpycurl.REDIR_PROTOCOLSin aprepare_curl_callback.CurlAsyncHTTPClientnow supports digest authentication for proxies (in addition to basic auth) via the newproxy_auth_modeargument.- The minimum supported version of
libcurlis now7.22.0.
tornado.httpserver¶
HTTPServernow accepts the keyword argumenttrusted_downstreamwhich controls the parsing ofX-Forwarded-Forheaders. This header may be a list or set of IP addresses of trusted proxies which will be skipped in theX-Forwarded-Forlist.- The
no_keep_aliveargument works again.
tornado.httputil¶
url_concatcorrectly handles fragments and existing query arguments.
tornado.ioloop¶
- Fixed 100% CPU usage after a callback returns an empty list or dict.
IOLoop.add_callbacknow uses a lockless implementation which makes it safe for use from__del__methods. This improves performance of calls toadd_callbackfrom theIOLoopthread, and slightly decreases it for calls from other threads.
tornado.log¶
- Colored log output is now supported on Windows if the
colorama library
is installed and the application calls
colorama.init()at startup. - The signature of the
LogFormatterconstructor has been changed to make it compatible withlogging.config.dictConfig.
tornado.netutil¶
- Worked around an issue that caused “LookupError: unknown encoding: latin1” errors on Solaris.
tornado.process¶
Subprocessno longer causes “subprocess still running” warnings on Python 3.6.- Improved error handling in
cpu_count.
tornado.tcpclient¶
TCPClientnow supports asource_ipandsource_portargument.- Improved error handling for environments where IPv6 support is incomplete.
tornado.tcpserver¶
TCPServer.handle_streamimplementations may now be native coroutines.- Stopping a
TCPServertwice no longer raises an exception.
tornado.web¶
RedirectHandlernow supports substituting parts of the matched URL into the redirect location usingstr.formatsyntax.- New methods
RequestHandler.render_linked_js,RequestHandler.render_embed_js,RequestHandler.render_linked_css, andRequestHandler.render_embed_csscan be overridden to customize the output ofUIModule.
tornado.websocket¶
WebSocketHandler.on_messageimplementations may now be coroutines. New messages will not be processed until the previouson_messagecoroutine has finished.- The
websocket_ping_intervalandwebsocket_ping_timeoutapplication settings can now be used to enable a periodic ping of the websocket connection, allowing dropped connections to be detected and closed. - The new
websocket_max_message_sizesetting defaults to 10MiB. The connection will be closed if messages larger than this are received. - Headers set by
RequestHandler.prepareorRequestHandler.set_default_headersare now sent as a part of the websocket handshake. - Return values from
WebSocketHandler.get_compression_optionsmay now include the keyscompression_levelandmem_levelto set gzip parameters. The default compression level is now 6 instead of 9.
Demos¶
- A new file upload demo is available in the file_upload directory.
- A new
TCPClientandTCPServerdemo is available in the tcpecho directory. - Minor updates have been made to several existing demos, including updates to more recent versions of jquery.
Credits¶
The following people contributed commits to this release:
- A. Jesse Jiryu Davis
- Aaron Opfer
- Akihiro Yamazaki
- Alexander
- Andreas Røsdal
- Andrew Rabert
- Andrew Sumin
- Antoine Pietri
- Antoine Pitrou
- Artur Stawiarski
- Ben Darnell
- Brian Mego
- Dario
- Doug Vargas
- Eugene Dubovoy
- Iver Jordal
- JZQT
- James Maier
- Jeff Hunter
- Leynos
- Mark Henderson
- Michael V. DePalatis
- Min RK
- Mircea Ulinic
- Ping
- Ping Yang
- Riccardo Magliocchetti
- Samuel Chen
- Samuel Dion-Girardeau
- Scott Meisburger
- Shawn Ding
- TaoBeier
- Thomas Kluyver
- Vadim Semenov
- matee
- mike820324
- stiletto
- zhimin
- 依云