Apr 16, 2017
Backwards-compatibility warning
- The
tornado.websocket
module now imposes a limit on the size of incoming messages, which defaults to 10MiB.
New module
tornado.routing
provides 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.auth
module 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_expires
field in the new format. Thesession_expires
field 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.autoreload
tornado.concurrent
- Suppressed some “‘NoneType’ object not callback” messages that could be logged at shutdown.
tornado.gen
yield None
is now equivalent toyield gen.moment
.moment
is 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_function
identifies functions wrapped bycoroutine
orengine
.
tornado.http1connection
- The
Transfer-Encoding
header is now parsed case-insensitively.
tornado.httpclient
SimpleAsyncHTTPClient
now follows 308 redirects.CurlAsyncHTTPClient
will no longer accept protocols other thanhttp
andhttps
. To override this, setpycurl.PROTOCOLS
andpycurl.REDIR_PROTOCOLS
in aprepare_curl_callback
.CurlAsyncHTTPClient
now supports digest authentication for proxies (in addition to basic auth) via the newproxy_auth_mode
argument.- The minimum supported version of
libcurl
is now7.22.0
.
tornado.httpserver
HTTPServer
now accepts the keyword argumenttrusted_downstream
which controls the parsing ofX-Forwarded-For
headers. This header may be a list or set of IP addresses of trusted proxies which will be skipped in theX-Forwarded-For
list.- The
no_keep_alive
argument works again.
tornado.httputil
url_concat
correctly handles fragments and existing query arguments.
tornado.ioloop
- Fixed 100% CPU usage after a callback returns an empty list or dict.
IOLoop.add_callback
now uses a lockless implementation which makes it safe for use from__del__
methods. This improves performance of calls toadd_callback
from theIOLoop
thread, and slightly decreases it for calls from other threads.
tornado.iostream
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
LogFormatter
constructor 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
Subprocess
no longer causes “subprocess still running” warnings on Python 3.6.- Improved error handling in
cpu_count
.
tornado.tcpclient
TCPClient
now supports asource_ip
andsource_port
argument.- Improved error handling for environments where IPv6 support is incomplete.
tornado.tcpserver
TCPServer.handle_stream
implementations may now be native coroutines.- Stopping a
TCPServer
twice no longer raises an exception.
tornado.web
RedirectHandler
now supports substituting parts of the matched URL into the redirect location usingstr.format
syntax.- New methods
RequestHandler.render_linked_js
,RequestHandler.render_embed_js
,RequestHandler.render_linked_css
, andRequestHandler.render_embed_css
can be overridden to customize the output ofUIModule
.
tornado.websocket
WebSocketHandler.on_message
implementations may now be coroutines. New messages will not be processed until the previouson_message
coroutine has finished.- The
websocket_ping_interval
andwebsocket_ping_timeout
application 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_size
setting defaults to 10MiB. The connection will be closed if messages larger than this are received. - Headers set by
RequestHandler.prepare
orRequestHandler.set_default_headers
are now sent as a part of the websocket handshake. - Return values from
WebSocketHandler.get_compression_options
may now include the keyscompression_level
andmem_level
to 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
TCPClient
andTCPServer
demo 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
- 依云