NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #264 most downloaded on PyPI
Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.
Latest stable
6.6.1
Last release 13 days ago
09 Nov 2026
Release timing varies
gaps range from 2 weeks to 4 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
17 years old
91 releases · first in 2010
Drag across the ruler to compare, or tap a release to open it.
HTTP header parsing currently supports both CRLF and LF-only line endings. LF-only line endings are already deprecated and slated for removal in Torna…
Security Fixes
- ``StaticFileHandler`` will no longer serve NTFS alternate data streams as if they were regular
files on Windows.
- ``SimpleAsyncHTTPClient`` no longer hangs and leaks resources when processing a redirect to
URL schemes other than ``http`` and ``https``.
- Parsing of percent-encoded data in URLs is much more efficient, preventing potential
denial-of-service attacks.
- Additional forms of open redirects in ``RedirectHandler`` have been fixed (in addition to
the ones fixed in 6.6.0)
- Open redirects in ``@addslash`` and ``@removeslash`` have been fixed.
Deprecation notice
Bug Fixes
- Certain patterns that worked with ``RedirectHandler`` in Tornado 6.5 and before did not work
correctly in Tornado 6.6.0. This was an unintended regression and the original behavior has
been restored.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
The host argument to the .HTTPServerRequest constructor is deprecated (since Tornado 6.5.2); use headers["Host"] instead. It will be removed in Tornad…
General changes
- Python 3.15 is now supported. Python 3.9 and 3.10 are no longer supported; 3.11 is the minimum
supported version.
- Free-threaded python interpreters are now supported; prebuilt wheels are available for 3.14t
and 3.15t.
- Windows on ARM is now supported and prebuilt wheels are available.
- Prebuilt wheels are now available for ``riscv64``, ``ppc64le``, and ``s390x`` architectures on
Linux. These architectures are experimental and have limited support and testing.
- PyPy 8.0 is now supported (for both Python 3.11 and 3.12).
- Error messages have been improved in many places.
- Improved handling of `asyncio.CancelledError` in various parts of the framework.
Feature highlights
cross_origin_protection provides a new mechanism for protecting againstxsrf_cookiesDeprecation notices
- The ``host`` argument to the `.HTTPServerRequest` constructor is deprecated (since
Tornado 6.5.2); use ``headers["Host"]`` instead. It will be removed in Tornado 6.7.
- The ``start_line`` argument to the ``HTTPServerRequest`` constructor will become required in
Tornado 6.7. The ``method``, ``uri``, and ``version`` arguments are deprecated and will be
removed at the same time. All remaining arguments will become keyword-only. A
`DeprecationWarning` is now emitted when ``start_line`` is not provided or when the ``host``,
``method``, or ``uri`` arguments are used.
- `tornado.auth.OpenIdMixin` is deprecated and will be removed in Tornado 6.7 (this is a change
in the timeline; it was previously scheduled for removal in Tornado 7.0).
- ``tornado.util.TimeoutError``, ``tornado.gen.TimeoutError``, and ``tornado.ioloop.TimeoutError``
are deprecated. They are aliases for the builtin `TimeoutError`, which should be used instead.
(No warning is emitted when these aliases are used.)
- Calling `.GzipDecompressor.decompress` without a ``max_length`` argument (or with
``max_length=0``) is deprecated and emits a `DeprecationWarning`. In Tornado 7.0,
``max_length`` will be required.
- The ``xsrf_cookies`` application setting is expected to be deprecated in Tornado 6.7 (with
warnings) in favor of ``cross_origin_protection``. It will not be removed before Tornado 7.0.
Type annotation changes
tornado.gen.multi now has overload annotations to indicate that its return type depends.HTTPServerRequest.method and uri attributes are now typed as str instead ofstr | None.tornado.curl_httpclient
- The minimum supported version of libcurl is now 7.81 (which is the version shipped by
Ubuntu 22.04 LTS).
- Passing a coroutine as the ``streaming_callback`` argument now fails with a `TypeError`.
(Coroutine streaming callbacks are only supported by ``simple_httpclient``.)
`tornado.gen`
~~~~~~~~~~~~~
- `asyncio.CancelledError` is now handled correctly in coroutines, `.multi`, and `.chain_future`.
- `.WaitIterator` now supports multiple copies of the same `.Future` object.
- `.with_timeout` has a new ``message`` argument, which sets the message of the `TimeoutError`.
It may be a string or a callable that returns a string (which is only called if the timeout
expires).
``tornado.http1connection``
Host headers are now logged at the INFO level instead of as an uncaught exception.data_received, so the pieces seen by the application no longer correspond to the HTTP\r\n is now reported as an.HTTPInputError instead of raising AssertionError (or being silently accepted when-O).simple_httpclient and to requests received by a server withdecompress_request=True.tornado.httputil
- If ``start_line`` is not passed to `.HTTPServerRequest`, missing ``method`` and ``uri``
arguments now default to ``GET`` and ``/`` (with a `DeprecationWarning`) instead of leaving
these attributes as ``None``.
- ``HTTPHeaders.__delitem__`` no longer raises `KeyError` at inappropriate times.
`tornado.iostream`
.SSLIOStream is cancelled.tornado.locale
- `.format_date` now correctly handles times in the future that are close to a multiple of
24 hours away.
`tornado.locks`
~~~~~~~~~~~~~~~
- A ``timeout`` value of zero will either return or raise immediately. Previously, zero was
treated as equivalent to ``None`` (wait forever). This affects `.Condition.wait`, `.Event.wait`,
`.Semaphore.acquire`, and `.Lock.acquire`.
`tornado.netutil`
SSLContext objects are now lazily created on first use rather than at import time.tornado.platform.asyncio
- The selector thread used on Windows now cleans up its sockets correctly on interpreter exit,
preventing logged warnings.
`tornado.platform.caresresolver`
CaresResolver class (which has been deprecated since Tornado 6.2) requires pycarestornado.queues
- A ``timeout`` value of zero will either return or raise immediately. Previously, zero was
treated as equivalent to ``None`` (wait forever). This affects `.Queue.get`, `.Queue.put`, and
`.Queue.join`.
``tornado.simple_httpclient``
tornado.http1connection above).streaming_callback argument to SimpleAsyncHTTPClient.fetch may now be a coroutine.tornado.tcpclient
- When a connection attempt is cancelled, sockets are now closed immediately instead of waiting
for the connection to either complete or time out.
`tornado.util`
~~~~~~~~~~~~~~
- `.GzipDecompressor` now decompresses streams containing multiple gzip members in full;
previously everything after the first member was ignored. Data after the last member that is
not the start of another member is now an error, as is a stream that ends partway through a
member. `.GzipDecompressor.flush` now raises `zlib.error` for truncated input and always
returns an empty byte string (since `~.GzipDecompressor.decompress` returns all of the
output); it raises `ValueError` if `~.GzipDecompressor.unconsumed_tail` has not been passed
back to ``decompress``.
`tornado.web`
~~~~~~~~~~~~~
- New feature ``cross_origin_protection`` provides a new mechanism for protecting against
XSRF and other cross-origin attacks. This feature is easier to use than ``xsrf_cookies``
and is expected to become the default in Tornado 6.7. Additional origins can be allowed
with the new ``trusted_origins`` application setting or by overriding the new method
`.RequestHandler.check_trusted_origin`. See :ref:`cross_origin_protection` for details.
- `asyncio.CancelledError` is now handled correctly instead of leaving connections to hang.
- ``raise HTTPError(204)`` no longer attempts to incorrectly send a response body.
- Writing a response body with a status code that does not allow one (such as 204 or 304) now
raises `RuntimeError` instead of `AssertionError` (so the check is no longer skipped when
Python runs with ``-O``).
- Signed values with valid signatures but certain formatting errors are now ignored instead of
raising errors (consistent with historical behavior for other formatting errors).
- The ``max_age`` argument to `.RequestHandler.set_cookie` can no longer be abused for
attribute injection.
- `.RedirectHandler` no longer allows values substituted into its ``url`` to change the scheme or
netloc (user info, host, and port) of the redirect, which could be used as an open redirect.
This includes protocol-relative URLs (``//example.com``) and variants that browsers treat the
same way, such as ``/\example.com``. Such requests now fail with a 400 error. As a
consequence, substitutions can no longer be used in the scheme or netloc part of the ``url``.
- The check that prevents `.StaticFileHandler` from redirecting to a protocol-relative URL (when
``default_filename`` is used) now also recognizes variants that use backslashes.
- `.RequestHandler.static_url` (and `.StaticFileHandler.get_version`) now raise
`~tornado.web.HTTPError` (403) for paths outside of ``static_path`` instead of reading and
hashing files elsewhere on the filesystem. Files that are not regular files (such as devices or
FIFOs), and files larger than the new `.StaticFileHandler.MAX_VERSION_CONTENT_SIZE`, get no
version. Symlinks inside the static directory are still followed when computing versions; see
`.StaticFileHandler` for details. ``static_url`` is intended for an application's known static
files and should not be called with untrusted input.
- The cache of static file versions is now limited to
`.StaticFileHandler.MAX_CACHED_VERSIONS` entries.
`tornado.websocket`
.WebSocketHandler.check_origin is no longer called for requests that can be determinedSec-Fetch-Site header or (if that header is absent) byOrigin and Host headers. Its default implementation now calls.RequestHandler.check_trusted_origin, so origins listed in the trusted_originscheck_origin to restrictasyncio.CancelledError no longer breaks the websocket loop without closing the connection.on_ping is still called for every ping.6455) is accepted. The Sec-WebSocket-Origin headerNothing published for this version
The host argument to the .HTTPServerRequest constructor is deprecated (since Tornado 6.5.2); use headers["Host"] instead. It will be removed in Tornad…
General changes
- Python 3.15 is now supported. Python 3.9 and 3.10 are no longer supported; 3.11 is the minimum
supported version.
- Free-threaded python interpreters are now supported; prebuilt wheels are available for 3.14t
and 3.15t.
- Windows on ARM is now supported and prebuilt wheels are available.
- Prebuilt wheels are now available for ``riscv64``, ``ppc64le``, and ``s390x`` architectures on
Linux. These architectures are experimental and have limited support and testing.
- PyPy 8.0 is now supported (for both Python 3.11 and 3.12).
- Error messages have been improved in many places.
- Improved handling of `asyncio.CancelledError` in various parts of the framework.
Feature highlights
cross_origin_protection provides a new mechanism for protecting againstxsrf_cookiesDeprecation notices
- The ``host`` argument to the `.HTTPServerRequest` constructor is deprecated (since
Tornado 6.5.2); use ``headers["Host"]`` instead. It will be removed in Tornado 6.7.
- The ``start_line`` argument to the ``HTTPServerRequest`` constructor will become required in
Tornado 6.7. The ``method``, ``uri``, and ``version`` arguments are deprecated and will be
removed at the same time. All remaining arguments will become keyword-only. A
`DeprecationWarning` is now emitted when ``start_line`` is not provided or when the ``host``,
``method``, or ``uri`` arguments are used.
- `tornado.auth.OpenIdMixin` is deprecated and will be removed in Tornado 6.7 (this is a change
in the timeline; it was previously scheduled for removal in Tornado 7.0).
- ``tornado.util.TimeoutError``, ``tornado.gen.TimeoutError``, and ``tornado.ioloop.TimeoutError``
are deprecated. They are aliases for the builtin `TimeoutError`, which should be used instead.
(No warning is emitted when these aliases are used.)
- Calling `.GzipDecompressor.decompress` without a ``max_length`` argument (or with
``max_length=0``) is deprecated and emits a `DeprecationWarning`. In Tornado 7.0,
``max_length`` will be required.
- The ``xsrf_cookies`` application setting is expected to be deprecated in Tornado 6.7 (with
warnings) in favor of ``cross_origin_protection``. It will not be removed before Tornado 7.0.
Type annotation changes
tornado.gen.multi now has overload annotations to indicate that its return type depends.HTTPServerRequest.method and uri attributes are now typed as str instead ofstr | None.tornado.curl_httpclient
- The minimum supported version of libcurl is now 7.81 (which is the version shipped by
Ubuntu 22.04 LTS).
- Passing a coroutine as the ``streaming_callback`` argument now fails with a `TypeError`.
(Coroutine streaming callbacks are only supported by ``simple_httpclient``.)
`tornado.gen`
~~~~~~~~~~~~~
- `asyncio.CancelledError` is now handled correctly in coroutines, `.multi`, and `.chain_future`.
- `.WaitIterator` now supports multiple copies of the same `.Future` object.
- `.with_timeout` has a new ``message`` argument, which sets the message of the `TimeoutError`.
It may be a string or a callable that returns a string (which is only called if the timeout
expires).
``tornado.http1connection``
Host headers are now logged at the INFO level instead of as an uncaught exception.data_received, so the pieces seen by the application no longer correspond to the HTTP\r\n is now reported as an.HTTPInputError instead of raising AssertionError (or being silently accepted when-O).simple_httpclient and to requests received by a server withdecompress_request=True.tornado.httputil
- If ``start_line`` is not passed to `.HTTPServerRequest`, missing ``method`` and ``uri``
arguments now default to ``GET`` and ``/`` (with a `DeprecationWarning`) instead of leaving
these attributes as ``None``.
- ``HTTPHeaders.__delitem__`` no longer raises `KeyError` at inappropriate times.
`tornado.iostream`
.SSLIOStream is cancelled.tornado.locale
- `.format_date` now correctly handles times in the future that are close to a multiple of
24 hours away.
`tornado.locks`
~~~~~~~~~~~~~~~
- A ``timeout`` value of zero will either return or raise immediately. Previously, zero was
treated as equivalent to ``None`` (wait forever). This affects `.Condition.wait`, `.Event.wait`,
`.Semaphore.acquire`, and `.Lock.acquire`.
`tornado.netutil`
SSLContext objects are now lazily created on first use rather than at import time.tornado.platform.asyncio
- The selector thread used on Windows now cleans up its sockets correctly on interpreter exit,
preventing logged warnings.
`tornado.platform.caresresolver`
CaresResolver class (which has been deprecated since Tornado 6.2) requires pycarestornado.queues
- A ``timeout`` value of zero will either return or raise immediately. Previously, zero was
treated as equivalent to ``None`` (wait forever). This affects `.Queue.get`, `.Queue.put`, and
`.Queue.join`.
``tornado.simple_httpclient``
tornado.http1connection above).streaming_callback argument to SimpleAsyncHTTPClient.fetch may now be a coroutine.tornado.tcpclient
- When a connection attempt is cancelled, sockets are now closed immediately instead of waiting
for the connection to either complete or time out.
`tornado.util`
~~~~~~~~~~~~~~
- `.GzipDecompressor` now decompresses streams containing multiple gzip members in full;
previously everything after the first member was ignored. Data after the last member that is
not the start of another member is now an error, as is a stream that ends partway through a
member. `.GzipDecompressor.flush` now raises `zlib.error` for truncated input and always
returns an empty byte string (since `~.GzipDecompressor.decompress` returns all of the
output); it raises `ValueError` if `~.GzipDecompressor.unconsumed_tail` has not been passed
back to ``decompress``.
`tornado.web`
~~~~~~~~~~~~~
- New feature ``cross_origin_protection`` provides a new mechanism for protecting against
XSRF and other cross-origin attacks. This feature is easier to use than ``xsrf_cookies``
and is expected to become the default in Tornado 6.7. Additional origins can be allowed
with the new ``trusted_origins`` application setting or by overriding the new method
`.RequestHandler.check_trusted_origin`. See :ref:`cross_origin_protection` for details.
- `asyncio.CancelledError` is now handled correctly instead of leaving connections to hang.
- ``raise HTTPError(204)`` no longer attempts to incorrectly send a response body.
- Writing a response body with a status code that does not allow one (such as 204 or 304) now
raises `RuntimeError` instead of `AssertionError` (so the check is no longer skipped when
Python runs with ``-O``).
- Signed values with valid signatures but certain formatting errors are now ignored instead of
raising errors (consistent with historical behavior for other formatting errors).
- The ``max_age`` argument to `.RequestHandler.set_cookie` can no longer be abused for
attribute injection.
- `.RedirectHandler` now refuses to generate protocol-relative redirects via formatted URLs,
which could potentially be used as an open redirect.
`tornado.websocket`
.WebSocketHandler.check_origin is no longer called for requests that can be determinedSec-Fetch-Site header or (if that header is absent) byOrigin and Host headers. Its default implementation now calls.RequestHandler.check_trusted_origin, so origins listed in the trusted_originscheck_origin to restrictasyncio.CancelledError no longer breaks the websocket loop without closing the connection.on_ping is still called for every ping.6455) is accepted. The Sec-WebSocket-Origin headerThe host argument to the .HTTPServerRequest constructor is deprecated (since Tornado 6.5.2); use headers["Host"] instead. It will be removed in Tornad…
General changes
- Python 3.15 is now supported. Python 3.9 and 3.10 are no longer supported; 3.11 is the minimum
supported version.
- Free-threaded python interpreters are now supported; prebuilt wheels are available for 3.14t
and 3.15t.
- Windows on ARM is now supported and prebuilt wheels are available.
- Prebuilt wheels are now available for ``riscv64``, ``ppc64le``, and ``s390x`` architectures on
Linux. These architectures are experimental and have limited support and testing.
Deprecation notices
host argument to the .HTTPServerRequest constructor is deprecated (sinceheaders["Host"] instead. It will be removed in Tornado 6.7.start_line argument to the HTTPServerRequest constructor will become required inmethod, uri, and version arguments are deprecated and will betornado.auth.OpenIdMixin is deprecated and will be removed in Tornado 6.7 (this is a changeType annotation changes
- `.tornado.gen.multi` now has overload annotations to indicate that its return type depends
on its inputs (list vs dict).
- `.HTTPServerRequest.method` and ``uri`` attributes are now typed as ``str`` instead of
``str | None``
``tornado.curl_httpclient``
tornado.simple_httpclient
- The ``streaming_callback`` argument to ``SimpleAsyncHTTPClient.fetch`` may now be a coroutine.
``tornado.http1connection``
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Invalid ``Host`` headers are now logged at the INFO level instead of as an uncaught exception.
`tornado.httputil`
~~~~~~~~~~~~~~~~~~
- If the ``start_line`` argument to `.HTTPServerRequest` is not provided, both ``method`` and
``uri`` must be provided.
`tornado.locks`
~~~~~~~~~~~~~~~
- A ``timeout`` value of zero will either return or raise immediately. Previously, zero was
treated as equivalent to ``None`` (wait forever). This affects `.Condition.wait`, `.Event.wait`,
`.Semaphore.acquire`, and `.Lock.acquire`.
`tornado.netutil`
~~~~~~~~~~~~~~~~~
- The default ``SSLContext`` objects are now lazily created on first use rather than at import time.
`tornado.platform.asyncio`
~~~~~~~~~~~~~~~~~~~~~~~~~~
- The selector thread used on Windows now cleans up its sockets correctly on interpreter exit,
preventing logged warnings.
`tornado.platform.caresresolver`
CaresResolver class (which has been deprecated since Tornado 6.2) requires pycarestornado.queues
- A ``timeout`` value of zero will either return or raise immediately. Previously, zero was
treated as equivalent to ``None`` (wait forever). This affects `.Queue.get`, `.Queue.put`, and
`.Queue.join`.
The allowed_symlink_directory argument of StaticFileHandler may now be a list of directories instead of just a single directory. This feature has been
Bug fixes
`tornado.web`
allowed_symlink_directory argument of StaticFileHandler may now be a listThe allowed_symlink_directory argument of StaticFileHandler may now be a list of directories instead of just a single directory. This feature has been adjusted to improve compatibility with Jupyter, which would fail to load with Tornado 6.5.9.
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Security fixes
- `.StaticFileHandler` no longer follows symlinks outside of the static root directory.
Applications that wish to continue the previous behavior may set the new argument
``allowed_symlink_directory`` to the directory (an ancestor of the static root) that
should be used for symlink validation. Thanks to `afldl <https://github.com/afldl>`_ and
`iaokhut-from-NightWolf-Team <https://github.com/iaokhut-from-NightWolf-Team>`_ for
reporting this issue.
- ``curl_httpclient`` has a new ``max_body_size`` argument (default 100MB, same as
for ``simple_httpclient``). This limit is enforced on all requests, whether or not
``streaming_callback`` is used. ``curl_httpclient`` now also controls its memory usage
when decompressing response bodies. Thanks to `afldl <https://github.com/afldl>`_,
`iaohkut-from-NightWolf-Team <https://github.com/iaohkut-from-NightWolf-Team>`_, and
`aoto-tech <https://github.com/aoto-tech>`_ for reporting this issue.
- ``simple_httpclient`` now correctly applies the ``max_body_size`` limit to responses
using HTTP/1.0 format (no ``Content-Length`` or ``Transfer-Encoding``). Previously it
silently truncated such responses at ``max_buffer_size`` instead. Thanks to
`afldl <https://github.com/afldl>`_ for reporting this issue.
- ``simple_httpclient`` now rejects responses that use more than 10 ``100 Continue`` responses,
which could previously cause stack overflow errors. Thanks to `afldl <https://github.com/afldl>`_
for reporting this issue.
- The limit ``ParseBodyConfig.urlencoded.max_argument`` is now applied to URL arguments
in addition to ``POST`` bodies. Thanks to
`iaohkut-from-NightWolf-Team <https://github.com/iaohkut-from-NightWolf-Team>`_,
`afldl <https://github.com/afldl>`_, and `manus-pi <https://github.com/manus-pi>`_
for reporting this issue.
Bug fixes
~~~~~~~~~
`tornado.iostream`
.IOStream.read_until_close now reports errors correctly when a stream is closed due to.IOStream), since some platforms report a clean shutdown by the peer this way..StaticFileHandler no longer follows symlinks outside of the static root directory. Applications that wish to continue the previous behavior may set the new argument allowed_symlink_directory to the directory (an ancestor of the static root) that should be used for symlink validation. Thanks to Yasha-ops and iaohkut-from-NightWolf-Team for reporting this issue.
curl_httpclient has a new max_body_size argument (default 100MB, same as for simple_httpclient). This limit is enforced on all requests, whether or not streaming_callback is used. curl_httpclient now also controls its memory usage when decompressing response bodies. Thanks to afldl, iaohkut-from-NightWolf-Team, and aoto-tech for reporting this issue.
simple_httpclient now correctly applies the max_body_size limit to responses using HTTP/1.0 format (no Content-Length or Transfer-Encoding). Previously it silently truncated such responses at max_buffer_size instead. Thanks to afldl for reporting this issue.
simple_httpclient now rejects responses that use more than 10 100 Continue responses, which could previously cause stack overflow errors. Thanks to afldl for reporting this issue.
The limit ParseBodyConfig.urlencoded.max_argument is now applied to URL arguments in addition to POST bodies. Thanks to iaohkut-from-NightWolf-Team, afldl, and manus-pi for reporting this issue.
.IOStream.read_until_close now reports errors correctly when a stream is closed due to an error or exceeds a memory limit. Previously it would report a successful read of whatever was in the buffer. Connection resets are still treated as a normal close (as they are elsewhere in .IOStream), since some platforms report a clean shutdown by the peer this way.
The deprecated mixed-case arguments to .RequestHandler.set_cookie now enforce the same restrictions on invalid characters that were introduced in Torn…
Security fixes
- Form-encoded ``POST`` bodies are now subject to a limit of 1000 arguments by default. This
prevents a CPU and memory denial of service attack. This limit can be overridden via the
`.set_parse_body_config` function. Thanks to `Arpit Jain <https://github.com/arpitjain099>`_
for reporting this issue.
- Multipart parsing now rejects requests with an excessive number of parts earlier in the parsing
process, limiting memory consumption. Thanks to `afldl <https://github.com/afldl>`_ for
reporting this issue.
- The deprecated mixed-case arguments to `.RequestHandler.set_cookie` now enforce the same
restrictions on invalid characters that were introduced in Tornado 6.5.5 for the standard
lowercase arguments. Thanks to `sec-reex <https://github.com/sec-reex>`_ and
`Arpit Jain <https://github.com/arpitjain099>`_ for reporting this issue.
Deprecations
~~~~~~~~~~~~
- The `.OpenIdMixin` class is deprecated and will be removed in Tornado 6.7. OpenID 2.0 is no
longer widely supported by identity providers.
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Security fixes
- ``CurlAsyncHTTPClient`` now fully resets the curl object before reusing it. This prevents
incorrectly reusing options from a previous request, specifically including client SSL and
credentials used for accessing proxies. Thanks to `Koh Jun Sheng <https://github.com/seankohjs>`_
for reporting this issue.
CurlAsyncHTTPClient now fully resets the curl object before reusing it. This prevents incorrectly reusing options from a previous request, specifically including client SSL and credentials used for accessing proxies. Thanks to Koh Jun Sheng for reporting this issue.
CurlAsyncHTTPClient has been updated to use non-deprecated APIs, avoiding deprecation warnings with recent versions of pycurl.">
Security fixes
- ``SimpleAsyncHTTPClient`` now strips the ``Authorization`` and ``Cookie`` headers from the request
when following a redirect to a different origin. This matches the default behavior of
``CurlAsyncHTTPClient``. Applications that need different behavior here can set
``follow_redirects=False`` and handle redirects manually. Thanks to [Yannick
Wang](https://github.com/noobone123) for being first to report this issue, as well as additional
reporters [Kai Aizen](https://github.com/SnailSploit), [HunSec](https://github.com/0xHunSec), and
[Thai Son Dinh](https://github.com/sondt99).
- ``SimpleAsyncHTTPClient`` now enforces ``max_body_size`` on the decompressed size of the response,
rather than the compressed size. This prevents a denial-of-service attack via a very large
compressed response. Thanks to [Yuichiro Kedashiro](https://github.com/yuui25) for reporting this
issue.
- Fixed a bug in the C extension that could have read up to three bytes past the end of an input
array. Thanks to [Thai Son Dinh](https://github.com/sondt99) for reporting this issue.
- ``OpenIDMixin`` has improved parsing for the ``check_authentication`` response. Thanks to
[Yannick Wang](https://github.com/noobone123) for reporting this issue.
Bug fixes
~~~~~~~~~
- ``CurlAsyncHTTPClient`` has been updated to use non-deprecated APIs, avoiding deprecation
warnings with recent versions of ``pycurl``.
SimpleAsyncHTTPClient now strips the Authorization and Cookie headers from the request when following a redirect to a different origin. This matches the default behavior of CurlAsyncHTTPClient. Applications that need different behavior here can set follow_redirects=False and handle redirects manually. Thanks to Yannick Wang for being first to report this issue, as well as additional reporters Kai Aizen, HunSec, and Thai Son Dinh. CVE-2026-49853
SimpleAsyncHTTPClient now enforces max_body_size on the decompressed size of the response, rather than the compressed size. This prevents a denial-of-service attack via a very large compressed response. Thanks to Yuichiro Kedashiro for reporting this issue. CVE-2026-49855
Fixed a bug in the C extension that could have read up to three bytes past the end of an input array. Thanks to Thai Son Dinh for reporting this issue. CVE-2026-49854
OpenIDMixin has improved parsing for the check_authentication response. Thanks to Yannick Wang for reporting this issue.
CurlAsyncHTTPClient has been updated to use non-deprecated APIs, avoiding deprecation warnings with recent versions of pycurl.
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Security fixes
- ``multipart/form-data`` requests are now limited to 100 parts by default, to prevent a
denial-of-service attack via very large requests with many parts. This limit is configurable
via `tornado.httputil.ParseMultipartConfig`. Multipart parsing can also be disabled completely
if not required for the application. Thanks to [0x-Apollyon](https://github.com/0x-Apollyon) and
[bekkaze](https://github.com/bekkaze) for reporting this issue.
- The ``domain``, ``path``, and ``samesite`` arguments to `.RequestHandler.set_cookie` are now
validated for illegal characters, which could be abused to inject other attributes on the cookie.
Thanks to Dhiral Vyas (Praetorian) for reporting this issue.
- Carriage return characters are no longer accepted in ``multipart/form-data`` headers. Thanks to
[sergeykochanov](https://github.com/sergeykochanov) for reporting this issue.
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Bug fixes
- The ``in`` operator for ``HTTPHeaders`` was incorrectly case-sensitive, causing
lookups to fail for headers with different casing than the original header name.
This was a regression in version 6.5.3 and has been fixed to restore the intended
case-insensitive behavior from version 6.5.2 and earlier.
The in operator for HTTPHeaders was incorrectly case-sensitive, causing lookups to fail for headers with different casing than the original header name. This was a regression in version 6.5.3 and has been fixed to restore the intended case-insensitive behavior from version 6.5.2 and earlier.
…when parsing multipart/form-data request bodies. CVE-2025-67726 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-jhmp-mqwm-3gq8>_ Thank…
Security fixes
- Fixed a denial-of-service vulnerability involving quadratic computation when parsing
``multipart/form-data`` request bodies.
`CVE-2025-67726 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-jhmp-mqwm-3gq8>`_
Thanks to `Finder16 <https://github.com/Finder16>`_ for reporting this issue.
- Fixed a denial-of-service vulnerability involving quadratic computation when parsing repeated HTTP
headers.
`CVE-2025-67725 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-c98p-7wgm-6p64>`_.
Thanks to `Finder16 <https://github.com/Finder16>`_ for reporting this issue.
- Fixed a header injection and XSS vulnerability involving the ``reason`` argument to
`.RequestHandler.set_status` and `tornado.web.HTTPError`.
`CVE-2025-67724 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-pr2v-jx2c-wg9f>`_.
Thanks to `Finder16 <https://github.com/Finder16>`_ and
`Cheshire1225 <https://github.com/Cheshire1225>`_ for reporting this issue.
Demo changes
~~~~~~~~~~~~
- Several demo applications bundled with the Tornado repo (``blog``, ``chat``, ``facebook``) had an
open redirect vulnerability which has been fixed. This is not covered by a CVE or security
advisory since the demo applications are not included as a part of the Tornado package when
installed, but developers who have copied code from these demos may which to review their own
applications for open redirects. Thanks to `J1vvoo <https://github.com/J1vvoo>`_ for reporting this
issue.
- The ``s3server`` demo application contained some path traversal vulnerabilities. Since this demo
application was not demonstrating any interesting aspects of Tornado, it has been deleted rather
than being fixed. Thanks to `J1vvoo <https://github.com/J1vvoo>`_ for reporting this issue.
Fixed a denial-of-service vulnerability involving quadratic computation when parsing multipart/form-data request bodies. CVE-2025-67726 Thanks to Finder16 for reporting this issue.
Fixed a denial-of-service vulnerability involving quadratic computation when parsing repeated HTTP headers. CVE-2025-67725. Thanks to Finder16 for reporting this issue.
Fixed a header injection and XSS vulnerability involving the reason argument to .RequestHandler.set_status and tornado.web.HTTPError. CVE-2025-67724. Thanks to Finder16 and Cheshire1225 for reporting this issue.
Several demo applications bundled with the Tornado repo (blog, chat, facebook) had an open redirect vulnerability which has been fixed. This is not covered by a CVE or security advisory since the demo applications are not included as a part of the Tornado package when installed, but developers who have copied code from these demos may which to review their own applications for open redirects. Thanks to J1vvoo for reporting this issue.
The s3server demo application contained some path traversal vulnerabilities. Since this demo application was not demonstrating any interesting aspects of Tornado, it has been deleted rather than being fixed. Thanks to J1vvoo for reporting this issue.
Restored the host argument to .HTTPServerRequest. This argument is deprecated and will be removed in the future, but its removal with no warning in 6.…
Bug fixes
- Fixed a bug that resulted in WebSocket pings not being sent at the configured interval.
- Improved logging for invalid ``Host`` headers. This was previouisly logged as an uncaught
exception with a stack trace, now it is simply a 400 response (logged as a warning in the
access log)
- Restored the ``host`` argument to ``.HTTPServerRequest``. This argument is deprecated
and will be removed in the future, but its removal with no warning in 6.5.0 was a mistake.
- Removed a debugging print statement that was left in the code.
- Improved type hints for ``gen.multi``.
Fixed a bug that resulted in WebSocket pings not being sent at the configured interval.
Improved logging for invalid Host headers. This was previously logged as an uncaught exception with a stack trace, now it is simply a 400 response (logged as a warning in the access log).
Restored the host argument to .HTTPServerRequest. This argument is deprecated and will be removed in the future, but its removal with no warning in 6.5.0 was a mistake.
Removed a debugging print statement that was left in the code.
Improved type hints for gen.multi.
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Bug fixes
- Fixed a bug in ``multipart/form-data`` parsing that could incorrectly reject filenames containing
characters above U+00FF (i.e. most characters outside the Latin alphabet).
Fixed a bug in multipart/form-data parsing that could incorrectly reject filenames containing characters above U+00FF (i.e. most characters outside the Latin alphabet).
Prepare for release 6.5b1
Prepare for release 6.5b1
Previously, malformed multipart-form-data requests could log multiple warnings and constitute a denial-of-service attack. Now an exception is raised at the first error, so there is only one log message per request. This fixes CVE-2025-47287.
Python 3.14 is now supported. Older versions of Tornado will work on Python 3.14 but may log deprecation warnings.
The free-threading mode of Python 3.13 is now supported on an experimental basis. Prebuilt wheels are not yet available for this configuration, but it can be built from source.
The minimum supported Python version is 3.9.
Support for obs-fold continuation lines in HTTP headers is deprecated and will be removed in Tornado 7.0, as is the use of carriage returns without line feeds as header separators.
The callback argument to .websocket_connect is deprecated and will be removed in Tornado 7.0. Note that on_message_callback is not deprecated.
The log_message and args attributes of tornado.web.HTTPError are deprecated. Use the new get_message method instead.
tornado.concurrent.chain_future is now typed as accepting both asyncio and concurrent Futures.
tornado.gen.multi and multi_future now take Sequences and Mappings instead of List and Dict.
tornado.httputil.RequestStartLine and .ResponseStartLine now have type annotations for their attributes.
.HTTPHeaders now has type annotations for its elements.
The autoescape argument to tornado.template.BaseLoader is now marked as optional.
tornado.routing._RuleList is now a Sequence for more flexibility.
.RequestHandler.SUPPPORTED_METHODS is now typed to support overriding in a subclass.
Types for .RequestHandler.get_body_argument and get_query_argument are improved and now match the get_argument method.
.RequestHandler.get_cookie now has more accurate types.
The return type of .UIModule.render may now be either str or bytes.
Support for obs-fold continuation lines in HTTP headers is deprecated and will be removed in Tornado 7.0, as is the use of carriage returns without line feeds as header separators.
Request start lines may no longer include control characters.
Method names containing invalid characters now return error code 400 instead of 405.
Header names are now restricted to the set of characters permitted by the RFCs.
Control characters are no longer allowed in (incoming) header values.
Handling of trailing whitespace in headers has been improved, especially with obs-fold continuation lines.
The Host header is now restricted to the set of characters permitted by the RFCs. It is now an error to send more than one Host header, or to omit a Host header for a request that is not using HTTP/1.0.
Fixed a bug in which contextvars that were set when the event loop was created were not available inside the event loop on Windows.
.bind_unix_socket now supports the Linux abstract namespace.
TwistedResolver has been deleted. It was already deprecated and scheduled for removal in Tornado 7.0, but due to the adoption of RFC 8482 it no longer works for most domain names. This class was primarily intended to provide thread-free non-blocking DNS resolution. If that is still required, tornado.platform.caresresolver is the next best option, although it has its own limitations which differ from TwistedResolver, and it is also deprecated. Most users should switch to the default resolver, which uses threads.
The set of characters allowed in (outgoing) HTTP headers now matches the RFCs. Specifically, tab characters are now allowed and DEL is not.
Invalid If-Modified-Since headers are now ignored instead of causing a 500 error.
% characters in the log message of tornado.web.HTTPError are no longer doubled when no additional arguments are passed. This matches the behavior of logging.LogRecord. A new method get_message has been added to HTTPError to allow access to the fully-substituted message; directly accessing log_message and args is deprecated.
Some bugs involving ping_interval and ping_timeout have been fixed. Setting the ping_timeout greater than the ping_interval is no longer supported. The default ping_timeout is now equal to the ping_interval.
The callback argument to websocket_connect is deprecated and will be removed in Tornado 7.0. Note that on_message_callback is not deprecated.
Nothing published for this version
…and block the event loop. This change fixes CVE-2024-7592.
Parsing of the cookie header is now much more efficient. The older algorithm sometimes had quadratic performance which allowed for a denial-of-service attack in which the server would spend excessive CPU time parsing cookies and block the event loop. This change fixes CVE-2024-7592.
Security Improvements ~~~~~~~~~~~~~~~~~~~~~
Parsing of the Transfer-Encoding header is now stricter. Unexpected transfer-encoding values were previously ignored and treated as the HTTP/1.0 default of read-until-close. This can lead to framing issues with certain proxies. We now treat any unexpected value as an error.
Handling of whitespace in headers now matches the RFC more closely. Only space and tab characters are treated as whitespace and stripped from the beginning and end of header values. Other unicode whitespace characters are now left alone. This could also lead to framing issues with certain proxies.
tornado.curl_httpclient now prohibits carriage return and linefeed headers in HTTP headers (matching the behavior of simple_httpclient). These characters could be used for header injection or request smuggling if untrusted data were used in headers.
.SSLIOStream now understands changes to error codes from OpenSSL 3.2. The main result of this change is to reduce the noise in the logs for certain errors.
simple_httpclient now prohibits carriage return characters in HTTP headers. It had previously prohibited only linefeed characters.
.AsyncTestCase subclasses can now be instantiated without being associated with a test method. This improves compatibility with test discovery in Pytest 8.2.
Python 3.12 is now supported. Older versions of Tornado will work on Python 3.12 but may log deprecation warnings.
Python 3.12 is now supported. Older versions of Tornado will work on Python 3.12 but may log deprecation warnings.
.IOLoop.add_callback_from_signal is suspected to have been broken since Tornado 5.0 and will be removed in version 7.0. Use asyncio.loop.add_signal_handler instead.
The client_secret argument to .OAuth2Mixin.authorize_redirect is deprecated and will be removed in Tornado 7.0. This argument has never been used and other similar methods in this module don't have it.
.TwitterMixin is deprecated and will be removed in the future.
The client_secret argument to .OAuth2Mixin.authorize_redirect is deprecated and will be removed in Tornado 7.0. This argument has never been used and other similar methods in this module don't have it.
.TwitterMixin is deprecated and will be removed in the future.
Autoreload can now be used when the program is run as a directory rather than a file or module.
New CLI flag --until-success re-runs the program on any failure but stops after the first successful run.
Fixed reference cycles that could lead to increased memory usage.
Several methods in this module now simply pass through to their equivalents in the standard library.
This module now holds a strong reference to all running asyncio.Task objects it creates. This prevents premature garbage collection which could cause warnings like "Task was destroyed but it is pending!".
.IOLoop.add_callback_from_signal is suspected to have been broken since Tornado 5.0 and will be removed in version 7.0. Use asyncio.loop.add_signal_handler instead.
The type annotation for .IOLoop.run_in_executor has been updated to match the updated signature of asyncio.loop.run_in_executor.
Fixed reference cycles that could lead to increased memory usage.
.format_timestamp now supports "aware" datetime objects.
The shutdown protocol for .AddThreadSelectorEventLoop now requires the use of asyncio.run or asyncio.loop.shutdown_asyncgens to avoid leaking the thread.
Introduced .SelectorThread class containing the core functionality of .AddThreadSelectorEventLoop.
The close() method of .AddThreadSelectorEventLoop is now idempotent.
.StaticFileHandler.get_modified_time now supports "aware" datetime objects and the default implementation now returns aware objects.
Unclosed client connections now reliably log a warning. Previously the warning was dependent on garbage collection and whether the ping_interval option was used.
The subprotocols argument to .WebSocketClientConnection now defaults to None instead of an empty list (which was mutable and reused)
Nothing published for this version
…RFCs) to avoid potential request-smuggling vulnerabilities when deployed behind certain proxies.
The Content-Length header and chunked Transfer-Encoding sizes are now parsed more strictly (according to the relevant RFCs) to avoid potential request-smuggling vulnerabilities when deployed behind certain proxies.
Fixed an open redirect vulnerability in StaticFileHandler under certain configurations.
Fixed an open redirect vulnerability in StaticFileHandler under certain configurations.
.RequestHandler.set_cookie once again accepts capitalized keyword arguments for backwards compatibility. This is deprecated and in Tornado 7.0 only lo…
.RequestHandler.set_cookie once again accepts capitalized keyword arguments for backwards compatibility. This is deprecated and in Tornado 7.0 only lowercase arguments will be accepted.
.AsyncTestCase and .AsyncHTTPTestCase, which were deprecated in Tornado 6.2, are no longer deprecated.
The new .Application setting xsrf_cookie_name can now be used to take advantage of the __Host cookie prefix for improved security. To use it, add {"xsrf_cookie_name": "__Host-xsrf", "xsrf_cookie_kwargs": {"secure": True}} to your .Application settings. Note that this feature currently only works when HTTPS is used.
.WSGIContainer now supports running the application in a ThreadPoolExecutor so the event loop is no longer blocked.
.AsyncTestCase and .AsyncHTTPTestCase, which were deprecated in Tornado 6.2, are no longer deprecated.
WebSockets are now much faster at receiving large messages split into many fragments.
Python 3.7 is no longer supported; the minimum supported Python version is 3.8. Python 3.12 is now supported.
To avoid spurious deprecation warnings, users of Python 3.10 should upgrade to at least version 3.10.9, and users of Python 3.11 should upgrade to at least version 3.11.1.
Tornado submodules are now imported automatically on demand. This means it is now possible to use a single import tornado statement and refer to objects in submodules such as tornado.web.RequestHandler.
In Tornado 7.0, tornado.testing.ExpectLog will match WARNING and above regardless of the current logging configuration, unless the level argument is used.
.RequestHandler.get_secure_cookie is now a deprecated alias for .RequestHandler.get_signed_cookie. .RequestHandler.set_secure_cookie is now a deprecated alias for .RequestHandler.set_signed_cookie.
.RequestHandler.clear_all_cookies is deprecated. No direct replacement is provided; .RequestHandler.clear_cookie should be used on individual cookies.
Calling the .IOLoop constructor without a make_current argument, which was deprecated in Tornado 6.2, is no longer deprecated.
.AsyncTestCase and .AsyncHTTPTestCase, which were deprecated in Tornado 6.2, are no longer deprecated.
.AsyncTestCase.get_new_ioloop is deprecated.
New method .GoogleOAuth2Mixin.get_google_oauth_settings can now be overridden to get credentials from a source other than the .Application settings.
contextvars now work properly when a @gen.coroutine calls a native coroutine.
~.OptionParser.parse_config_file now recognizes single comma-separated strings (in addition to lists of strings) for options with multiple=True.
New .Application setting xsrf_cookie_name can be used to change the name of the XSRF cookie. This is most useful to take advantage of the __Host- cookie prefix.
.RequestHandler.get_secure_cookie and .RequestHandler.set_secure_cookie (and related methods and attributes) have been renamed to ~.RequestHandler.get_signed_cookie and ~.RequestHandler.set_signed_cookie. This makes it more explicit what kind of security is provided, and avoids confusion with the Secure cookie attribute and __Secure- cookie prefix. The old names remain supported as deprecated aliases.
.RequestHandler.clear_cookie now accepts all keyword arguments accepted by ~.RequestHandler.set_cookie. In some cases clearing a cookie requires certain arguments to be passed the same way in which it was set.
.RequestHandler.clear_all_cookies now accepts additional keyword arguments for the same reason as clear_cookie. However, since the requirements for additional arguments mean that it cannot reliably clear all cookies, this method is now deprecated.
It is now much faster (no longer quadratic) to receive large messages that have been split into many fragments.
.websocket_connect now accepts a resolver parameter.
.WSGIContainer now accepts an executor parameter which can be used to run the WSGI application on a thread pool.
Nothing published for this version
Deprecation notice ~~~~~~~~~~~~~~~~~~
April 2023 update: Python 3.12 reversed some of the changes described below. In Tornado 6.3, .AsyncTestCase, .AsyncHTTPTestCase, and the behavior of the .IOLoop constructor related to the make_current parameter are no longer deprecated.
Python 3.10 has begun the process of significant changes to the APIs for managing the event loop. Calls to methods such as asyncio.get_event_loop may now raise DeprecationWarning if no event loop is running. This has significant impact on the patterns for initializing applications, and in particular invalidates patterns that have long been the norm in Tornado's documentation and actual usage. In the future (with some as-yet-unspecified future version of Python), the old APIs will be removed. The new recommended pattern is to start the event loop with asyncio.run. More detailed migration guides will be coming in the future.
The .IOLoop constructor is deprecated unless the make_current=False argument is used. Use .IOLoop.current when the loop is already running instead.
.AsyncTestCase (and .AsyncHTTPTestCase) are deprecated. Use unittest.IsolatedAsyncioTestCase instead.
Multi-process .TCPServer.bind/.TCPServer.start is deprecated. See .TCPServer docs for supported alternatives.
.AnyThreadEventLoopPolicy is deprecated. This class controls the creation of the "current" event loop so it will be removed when that concept is no longer supported.
.IOLoop.make_current and .IOLoop.clear_current are deprecated. In the future the concept of a "current" event loop as distinct from one that is currently running will be removed.
TwistedResolver and CaresResolver are deprecated and will be removed in Tornado 7.0.
The minimum supported Python version is now 3.7.
Wheels are now published with the Python stable ABI (abi3) for compatibility across versions of Python.
SSL certificate verification and hostname checks are now enabled by default in more places (primarily in client-side usage of .SSLIOStream).
Various improvements to type hints throughout the package.
CI has moved from Travis and Appveyor to Github Actions.
Fixed a bug in which WaitIterator.current_index could be incorrect.
tornado.gen.TimeoutError is now an alias for asyncio.TimeoutError.
max_body_size may now be set to zero to disallow a non-empty body.
Content-Encoding: gzip is now recognized case-insensitively.
curl_httpclient now supports non-ASCII (ISO-8859-1) header values, same as simple_httpclient.
.PeriodicCallback now understands coroutines and will not start multiple copies if a previous invocation runs too long.
.PeriodicCallback now accepts datetime.timedelta objects in addition to numbers of milliseconds.
Avoid logging "Event loop is closed" during shutdown-related race conditions.
Tornado no longer calls logging.basicConfig when starting an IOLoop; this has been unnecessary since Python 3.2 added a logger of last resort.
The .IOLoop constructor now accepts an asyncio_loop keyword argument to initialize with a specified asyncio event loop.
It is now possible to construct an .IOLoop on one thread (with make_current=False) and start it on a different thread.
.SSLIOStream now supports reading more than 2GB at a time.
IOStream.write now supports typed memoryview objects.
.load_gettext_translations no longer logs errors when language directories exist but do not contain the expected file.
.is_valid_ip no longer raises exceptions when the input is too long.
The default resolver now uses the same methods (and thread pool) as asyncio.
.TCPServer.listen now supports more arguments to pass through to .netutil.bind_sockets.
.bind_unused_port now takes an optional address argument.
Wrapped test methods now include the __wrapped__ attribute.
When using a custom .StaticFileHandler subclass, the reset() method is now called on this subclass instead of the base class.
Improved handling of the Accept-Language header.
.Application.listen now supports more arguments to pass through to .netutil.bind_sockets.
.WebSocketClientConnection.write_message now accepts dict arguments for consistency with .WebSocketHandler.write_message.
.WebSocketClientConnection.write_message now raises an exception as documented if the connection is already closed.
Nothing published for this version
Nothing published for this version
Deprecation notice ~~~~~~~~~~~~~~~~~~
This is the last release of Tornado to support Python 3.5. Future versions will require Python 3.6 or newer.
Windows support has been improved. Tornado is now compatible with the proactor event loop (which became the default in Python 3.8) by automatically falling back to running a selector in a second thread. This means that it is no longer necessary to explicitly configure a selector event loop, although doing so may improve performance. This does not change the fact that Tornado is significantly less scalable on Windows than on other platforms.
Binary wheels are now provided for Windows, MacOS, and Linux (amd64 and arm64).
.coroutine now has better support for the Python 3.7+ contextvars module. In particular, the ContextVar.reset method is now supported.
HEAD requests to handlers that used chunked encoding no longer produce malformed output.
Certain kinds of malformed gzip data no longer cause an infinite loop.
Setting decompress_response=False now works correctly with curl_httpclient.
Mixing requests with and without proxies works correctly in curl_httpclient (assuming the version of pycurl is recent enough).
A default User-Agent of Tornado/$VERSION is now used if the user_agent parameter is not specified.
After a 303 redirect, tornado.simple_httpclient always uses GET. Previously this would use GET if the original request was a POST and would otherwise reuse the original request method. For curl_httpclient, the behavior depends on the version of libcurl (with the most recent versions using GET after 303 regardless of the original method).
Setting request_timeout and/or connect_timeout to zero is now supported to disable the timeout.
Header parsing is now faster.
.parse_body_arguments now accepts incompletely-escaped non-ASCII inputs.
ssl.CertificateError during the SSL handshake is now handled correctly.
Reads that are resolved while the stream is closing are now handled correctly.
When colored logging is enabled, logging.CRITICAL messages are now recognized and colored magenta.
EADDRNOTAVAIL is now ignored when binding to localhost with IPv6. This error is common in docker.
.AnyThreadEventLoopPolicy now also configures a selector event loop for these threads (the proactor event loop only works on the main thread)
The set_close_exec function has been removed.
.ExpectLog now has a level argument to ensure that the given log level is enabled.
RedirectHandler.get now accepts keyword arguments.
When sending 304 responses, more headers (including Allow) are now preserved.
reverse_url correctly handles escaped characters in the regex route.
Default Etag headers are now generated with SHA-512 instead of MD5.
The ping_interval timer is now stopped when the connection is closed.
.websocket_connect now raises an error when it encounters a redirect instead of hanging.
Nothing published for this version
Nothing published for this version
General changes ~~~~~~~~~~~~~~~
Binary wheels are now available for Python 3.8 on Windows. Note that it is still necessary to use asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) for this platform/version.
Fixed an issue in .IOStream (introduced in 6.0.0) that resulted in StreamClosedError being incorrectly raised if a stream is closed mid-read but there is enough buffered data to satisfy the read.
.AnyThreadEventLoopPolicy now always uses the selector event loop on Windows.
.gen.with_timeout always treats asyncio.CancelledError as a quiet_exception (this improves compatibility with Python 3.8, which changed CancelledError
.gen.with_timeout always treats asyncio.CancelledError as a quiet_exception (this improves compatibility with Python 3.8, which changed CancelledError to a BaseException).
IOStream now checks for closed streams earlier, avoiding spurious logged errors in some situations (mainly with websockets).
.WebSocketHandler.set_nodelay works again.
.WebSocketHandler.set_nodelay works again.
Accessing HTTPResponse.body now returns an empty byte string instead of raising ValueError for error responses that don't have a body (it returned None in this case in Tornado 5).
Fixed issues with type annotations that caused errors while importing Tornado on Python 3.5.2.
Fixed issues with type annotations that caused errors while importing Tornado on Python 3.5.2.
APIs deprecated in Tornado 5.1 have been removed. This includes the tornado.stack_context module and most callback arguments throughout the package. A…
Python 2.7 and 3.4 are no longer supported; the minimum supported Python version is 3.5.2.
APIs deprecated in Tornado 5.1 have been removed. This includes the tornado.stack_context module and most callback arguments throughout the package. All removed APIs emitted DeprecationWarning when used in Tornado 5.1, so running your application with the -Wd Python command-line flag or the environment variable PYTHONWARNINGS=d should tell you whether your application is ready to move to Tornado 6.0.
.WebSocketHandler.get is now a coroutine and must be called accordingly in any subclasses that override this method (but note that overriding get is not recommended; either prepare or open should be used instead).
Tornado now includes type annotations compatible with mypy. These annotations will be used when type-checking your application with mypy, and may be usable in editors and other tools.
Tornado now uses native coroutines internally, improving performance.
All callback arguments in this package have been removed. Use the coroutine interfaces instead.
The OAuthMixin._oauth_get_user method has been removed. Override ~.OAuthMixin._oauth_get_user_future instead.
The callback argument to .run_on_executor has been removed.
return_future has been removed.
Some older portions of this module have been removed. This includes engine, YieldPoint, Callback, Wait, WaitAll, MultiYieldPoint, and Task.
Functions decorated with @gen.coroutine no longer accept callback arguments.
The behavior of raise_error=False has changed. Now only suppresses the errors raised due to completed responses with non-200 status codes (previously it suppressed all errors).
The callback argument to .AsyncHTTPClient.fetch has been removed.
HTTPServerRequest.write has been removed. Use the methods of request.connection instead.
Unrecognized Content-Encoding values now log warnings only for content types that we would otherwise attempt to parse.
IOLoop.set_blocking_signal_threshold, IOLoop.set_blocking_log_threshold, IOLoop.log_stack, and IOLoop.handle_callback_exception have been removed.
Improved performance of .IOLoop.add_callback.
All callback arguments in this module have been removed except for .BaseIOStream.set_close_callback.
streaming_callback arguments to .BaseIOStream.read_bytes and .BaseIOStream.read_until_close have been removed.
Eliminated unnecessary logging of "Errno 0".
Log files opened by this module are now explicitly set to UTF-8 encoding.
The results of getaddrinfo are now sorted by address family to avoid partial failures and deadlocks.
TornadoReactor and TwistedIOLoop have been removed.
The default HTTP client now supports the network_interface request argument to specify the source IP for the connection.
If a server returns a 3xx response code without a Location header, the response is raised or returned directly instead of trying and failing to follow the redirect.
When following redirects, methods other than POST will no longer be transformed into GET requests. 301 (permanent) redirects are now treated the same way as 302 (temporary) and 303 (see other) redirects in this respect.
Following redirects now works with body_producer.
The tornado.stack_context module has been removed.
.TCPServer.start now supports a max_restarts argument (same as .fork_processes).
.AsyncHTTPTestCase now drops all references to the .Application during tearDown, allowing its memory to be reclaimed sooner.
.AsyncTestCase now cancels all pending coroutines in tearDown, in an effort to reduce warnings from the python runtime about coroutines that were not awaited. Note that this may cause asyncio.CancelledError to be logged in other places. Coroutines that expect to be running at test shutdown may need to catch this exception.
The asynchronous decorator has been removed.
The callback argument to .RequestHandler.flush has been removed.
.StaticFileHandler now supports large negative values for the Range header and returns an appropriate error for end > start.
It is now possible to set expires_days in xsrf_cookie_kwargs.
Pings and other messages sent while the connection is closing are now silently dropped instead of logging exceptions.
Errors raised by open() are now caught correctly when this method is a coroutine.
WSGIApplication and WSGIAdapter have been removed.
Nothing published for this version
Nothing published for this version
Fixed an case in which the .Future returned by .RequestHandler.finish could fail to resolve.
Fixed an case in which the .Future returned by .RequestHandler.finish could fail to resolve.
The .TwitterMixin.authenticate_redirect method works again.
Improved error handling in the tornado.auth module, fixing hanging requests when a network or other error occurs.
Deprecation notice ~~~~~~~~~~~~~~~~~~
Tornado 6.0 will drop support for Python 2.7 and 3.4. The minimum supported Python version will be 3.5.2.
The tornado.stack_context module is deprecated and will be removed in Tornado 6.0. The reason for this is that it is not feasible to provide this module's semantics in the presence of async def native coroutines. ExceptionStackContext is mainly obsolete thanks to coroutines. StackContext lacks a direct replacement although the new contextvars package (in the Python standard library beginning in Python 3.7) may be an alternative.
Callback-oriented code often relies on ExceptionStackContext to handle errors and prevent leaked connections. In order to avoid the risk of silently introducing subtle leaks (and to consolidate all of Tornado's interfaces behind the coroutine pattern), callback arguments throughout the package are deprecated and will be removed in version 6.0. All functions that had a callback argument removed now return a .Future which should be used instead.
Where possible, deprecation warnings are emitted when any of these deprecated interfaces is used. However, Python does not display deprecation warnings by default. To prepare your application for Tornado 6.0, run Python with the -Wd argument or set the environment variable PYTHONWARNINGS to d. If your application runs on Python 3 without deprecation warnings, it should be able to move to Tornado 6.0 without disruption.
.OAuthMixin._oauth_get_user_future may now be a native coroutine.
All callback arguments in this package are deprecated and will be removed in 6.0. Use the coroutine interfaces instead.
The OAuthMixin._oauth_get_user method is deprecated and will be removed in 6.0. Override ~.OAuthMixin._oauth_get_user_future instead.
The command-line autoreload wrapper is now preserved if an internal autoreload fires.
The command-line wrapper no longer starts duplicated processes on windows when combined with internal autoreload.
.run_on_executor now returns .Future objects that are compatible with await.
The callback argument to .run_on_executor is deprecated and will be removed in 6.0.
return_future is deprecated and will be removed in 6.0.
Some older portions of this module are deprecated and will be removed in 6.0. This includes engine, YieldPoint, Callback, Wait, WaitAll, MultiYieldPoint, and Task.
Functions decorated with @gen.coroutine will no longer accept callback arguments in 6.0.
The behavior of raise_error=False is changing in 6.0. Currently it suppresses all errors; in 6.0 it will only suppress the errors raised due to completed responses with non-200 status codes.
The callback argument to .AsyncHTTPClient.fetch is deprecated and will be removed in 6.0.
tornado.httpclient.HTTPError has been renamed to .HTTPClientError to avoid ambiguity in code that also has to deal with tornado.web.HTTPError. The old name remains as an alias.
tornado.curl_httpclient now supports non-ASCII characters in username and password arguments.
.HTTPResponse.request_time now behaves consistently across simple_httpclient and curl_httpclient, excluding time spent in the max_clients queue in both cases (previously this time was included in simple_httpclient but excluded in curl_httpclient). In both cases the time is now computed using a monotonic clock where available.
.HTTPResponse now has a start_time attribute recording a wall-clock (time.time) timestamp at which the request started (after leaving the max_clients queue if applicable).
.parse_multipart_form_data now recognizes non-ASCII filenames in RFC 2231/5987 (filename*=) format.
HTTPServerRequest.write is deprecated and will be removed in 6.0. Use the methods of request.connection instead.
Malformed HTTP headers are now logged less noisily.
.PeriodicCallback now supports a jitter argument to randomly vary the timeout.
IOLoop.set_blocking_signal_threshold, IOLoop.set_blocking_log_threshold, IOLoop.log_stack, and IOLoop.handle_callback_exception are deprecated and will be removed in 6.0.
Fixed a KeyError in .IOLoop.close when .IOLoop objects are being opened and closed in multiple threads.
All callback arguments in this module are deprecated except for .BaseIOStream.set_close_callback. They will be removed in 6.0.
streaming_callback arguments to .BaseIOStream.read_bytes and .BaseIOStream.read_until_close are deprecated and will be removed in 6.0.
Improved compatibility with GNU Hurd.
tornado.options.parse_config_file now allows setting options to strings (which will be parsed the same way as tornado.options.parse_command_line) in addition to the specified type for the option.
TornadoReactor and TwistedIOLoop are deprecated and will be removed in 6.0. Instead, Tornado will always use the asyncio event loop and twisted can be configured to do so as well.
The tornado.stack_context module is deprecated and will be removed in 6.0.
.AsyncHTTPTestCase.fetch now takes a raise_error argument. This argument has the same semantics as .AsyncHTTPClient.fetch, but defaults to false because tests often need to deal with non-200 responses (and for backwards-compatibility).
The .AsyncTestCase.stop and .AsyncTestCase.wait methods are deprecated.
New method .RequestHandler.detach can be used from methods that are not decorated with @asynchronous (the decorator was required to use self.request.connection.detach().
.RequestHandler.finish and .RequestHandler.render now return Futures that can be used to wait for the last part of the response to be sent to the client.
.FallbackHandler now calls on_finish for the benefit of subclasses that may have overridden it.
The asynchronous decorator is deprecated and will be removed in 6.0.
The callback argument to .RequestHandler.flush is deprecated and will be removed in 6.0.
When compression is enabled, memory limits now apply to the post-decompression size of the data, protecting against DoS attacks.
.websocket_connect now supports subprotocols.
.WebSocketHandler and .WebSocketClientConnection now have selected_subprotocol attributes to see the subprotocol in use.
The .WebSocketHandler.select_subprotocol method is now called with an empty list instead of a list containing an empty string if no subprotocols were requested by the client.
.WebSocketHandler.open may now be a coroutine.
The data argument to .WebSocketHandler.ping is now optional.
Client-side websocket connections no longer buffer more than one message in memory at a time.
Exception logging now uses .RequestHandler.log_exception.
WSGIApplication and WSGIAdapter are deprecated and will be removed in Tornado 6.0.
Nothing published for this version
Fixed a memory leak when .IOLoop objects are created and destroyed.
Fixed a memory leak when .IOLoop objects are created and destroyed.
If .AsyncTestCase.get_new_ioloop returns a reference to a preexisting event loop (typically when it has been overridden to return .IOLoop.current()), the test's tearDown method will not close this loop.
Fixed a confusing error message when the synchronous .HTTPClient fails to initialize because an event loop is already running.
.PeriodicCallback no longer executes twice in a row due to backwards clock adjustments.
This release restores support for versions of Python 3.4 prior to 3.4.4. This is important for compatibility with Debian Jessie which has 3.4.2 as its
This release restores support for versions of Python 3.4 prior to 3.4.4. This is important for compatibility with Debian Jessie which has 3.4.2 as its version of Python 3.
Tornado 5.0 supports Python 2.7.9+ and 3.4+. Python 2.7 and 3.4 are deprecated and support for them will be removed in Tornado 6.0, which will require…
The focus of this release is improving integration with asyncio. On Python 3, the .IOLoop is always a wrapper around the asyncio event loop, and asyncio.Future and asyncio.Task are used instead of their Tornado counterparts. This means that libraries based on asyncio can be mixed relatively seamlessly with those using Tornado. While care has been taken to minimize the disruption from this change, code changes may be required for compatibility with Tornado 5.0, as detailed in the following section.
Tornado 5.0 supports Python 2.7.9+ and 3.4+. Python 2.7 and 3.4 are deprecated and support for them will be removed in Tornado 6.0, which will require Python 3.5+.
Python 3.3 is no longer supported.
Versions of Python 2.7 that predate the ssl module update are no longer supported. (The ssl module was updated in version 2.7.9, although in some distributions the updates are present in builds with a lower version number. Tornado requires ssl.SSLContext, ssl.create_default_context, and ssl.match_hostname)
Versions of Python 3.5 prior to 3.5.2 are no longer supported due to a change in the async iterator protocol in that version.
The trollius project (asyncio backported to Python 2) is no longer supported.
tornado.concurrent.Future is now an alias for asyncio.Future when running on Python 3. This results in a number of minor behavioral changes:
.Future objects can only be created while there is a current .IOLoop
The timing of callbacks scheduled with Future.add_done_callback has changed. tornado.concurrent.future_add_done_callback can be used to make the behavior more like older versions of Tornado (but not identical). Some of these changes are also present in the Python 2 version of tornado.concurrent.Future to minimize the difference between Python 2 and 3.
Cancellation is now partially supported, via asyncio.Future.cancel. A canceled .Future can no longer have its result set. Applications that handle ~asyncio.Future objects directly may want to use tornado.concurrent.future_set_result_unless_cancelled. In native coroutines, cancellation will cause an exception to be raised in the coroutine.
The exc_info and set_exc_info methods are no longer present. Use tornado.concurrent.future_set_exc_info to replace the latter, and raise the exception with ~asyncio.Future.result to replace the former.
io_loop arguments to many Tornado functions have been removed. Use .IOLoop.current() instead of passing .IOLoop objects explicitly.
On Python 3, .IOLoop is always a wrapper around the asyncio event loop. IOLoop.configure is effectively removed on Python 3 (for compatibility, it may be called to redundantly specify the asyncio-backed .IOLoop)
.IOLoop.instance is now a deprecated alias for .IOLoop.current. Applications that need the cross-thread communication behavior facilitated by .IOLoop.instance should use their own global variable instead.
The futures (concurrent.futures backport) package is now required on Python 2.7.
The certifi and backports.ssl-match-hostname packages are no longer required on Python 2.7.
Python 3.6 or higher is recommended, because it features more efficient garbage collection of asyncio.Future objects.
.GoogleOAuth2Mixin now uses a newer set of URLs.
On Python 3, uses __main__.__spec to more reliably reconstruct the original command line and avoid modifying PYTHONPATH.
The io_loop argument to tornado.autoreload.start has been removed.
tornado.concurrent.Future is now an alias for asyncio.Future when running on Python 3. See "Backwards-compatibility notes" for more.
Setting the result of a Future no longer blocks while callbacks are being run. Instead, the callbacks are scheduled on the next .IOLoop iteration.
The deprecated alias tornado.concurrent.TracebackFuture has been removed.
tornado.concurrent.chain_future now works with all three kinds of Futures (Tornado, asyncio, and concurrent.futures)
The io_loop argument to tornado.concurrent.run_on_executor has been removed.
New functions .future_set_result_unless_cancelled, .future_set_exc_info, and .future_add_done_callback help mask the difference between asyncio.Future and Tornado's previous Future implementation.
Improved debug logging on Python 3.
The time_info response attribute now includes appconnect in addition to other measurements.
Closing a .CurlAsyncHTTPClient now breaks circular references that could delay garbage collection.
The io_loop argument to the .CurlAsyncHTTPClient constructor has been removed.
tornado.gen.TimeoutError is now an alias for tornado.util.TimeoutError.
Leak detection for Futures created by this module now attributes them to their proper caller instead of the coroutine machinery.
Several circular references that could delay garbage collection have been broken up.
On Python 3, asyncio.Task is used instead of the Tornado coroutine runner. This improves compatibility with some asyncio libraries and adds support for cancellation.
The io_loop arguments to YieldFuture and .with_timeout have been removed.
The io_loop argument to all .AsyncHTTPClient constructors has been removed.
It is now possible for a client to reuse a connection after sending a chunked request.
If a client sends a malformed request, the server now responds with a 400 error instead of simply closing the connection.
Content-Length and Transfer-Encoding headers are no longer sent with 1xx or 204 responses (this was already true of 304 responses).
When closing a connection to a HTTP/1.1 client, the Connection: close header is sent with the response.
The io_loop argument to the .HTTPServer constructor has been removed.
If more than one X-Scheme or X-Forwarded-Proto header is present, only the last is used.
The string representation of .HTTPServerRequest objects (which are sometimes used in log messages) no longer includes the request headers.
New function .qs_to_qsl converts the result of urllib.parse.parse_qs to name-value pairs.
tornado.ioloop.TimeoutError is now an alias for tornado.util.TimeoutError.
.IOLoop.instance is now a deprecated alias for .IOLoop.current.
.IOLoop.install and .IOLoop.clear_instance are deprecated.
The IOLoop.initialized method has been removed.
On Python 3, the asyncio-backed .IOLoop is always used and alternative .IOLoop implementations cannot be configured. .IOLoop.current and related methods pass through to asyncio.get_event_loop.
~.IOLoop.run_sync cancels its argument on a timeout. This results in better stack traces (and avoids log messages about leaks) in native coroutines.
New methods .IOLoop.run_in_executor and .IOLoop.set_default_executor make it easier to run functions in other threads from native coroutines (since concurrent.futures.Future does not support await).
PollIOLoop (the default on Python 2) attempts to detect misuse of .IOLoop instances across os.fork.
The io_loop argument to .PeriodicCallback has been removed.
It is now possible to create a .PeriodicCallback in one thread and start it in another without passing an explicit event loop.
The IOLoop.set_blocking_signal_threshold and IOLoop.set_blocking_log_threshold methods are deprecated because they are not implemented for the asyncio event loop`. Use the PYTHONASYNCIODEBUG=1 environment variable instead.
.IOLoop.clear_current now works if it is called before any current loop is established.
The io_loop argument to the .IOStream constructor has been removed.
New method .BaseIOStream.read_into provides a minimal-copy alternative to .BaseIOStream.read_bytes.
.BaseIOStream.write is now much more efficient for very large amounts of data.
Fixed some cases in which IOStream.error could be inaccurate.
Writing a memoryview can no longer result in "BufferError: Existing exports of data: object cannot be re-sized".
As a side effect of the Future changes, waiters are always notified asynchronously with respect to .Condition.notify.
The default .Resolver now uses .IOLoop.run_in_executor. .ExecutorResolver, .BlockingResolver, and .ThreadedResolver are deprecated.
The io_loop arguments to .add_accept_handler, .ExecutorResolver, and .ThreadedResolver have been removed.
.add_accept_handler returns a callable which can be used to remove all handlers that were added.
.OverrideResolver now accepts per-family overrides.
Duplicate option names are now detected properly whether they use hyphens or underscores.
.AsyncIOLoop and .AsyncIOMainLoop are now used automatically when appropriate; referencing them explicitly is no longer recommended.
Starting an .IOLoop or making it current now also sets the asyncio event loop for the current thread. Closing an .IOLoop closes the corresponding asyncio event loop.
.to_tornado_future and .to_asyncio_future are deprecated since they are now no-ops.
~.AnyThreadEventLoopPolicy can now be used to easily allow the creation of event loops on any thread (similar to Tornado's prior policy).
The io_loop argument to .CaresResolver has been removed.
The io_loop arguments to TornadoReactor, TwistedResolver, and tornado.platform.twisted.install have been removed.
The io_loop argument to the .Subprocess constructor and .Subprocess.initialize has been removed.
A default 404 response is now generated if no delegate is found for a request.
The io_loop argument to .SimpleAsyncHTTPClient has been removed.
TLS is now configured according to ssl.create_default_context by default.
The io_loop argument to the .TCPClient constructor has been removed.
.TCPClient.connect has a new timeout argument.
The io_loop argument to the .TCPServer constructor has been removed.
.TCPServer no longer logs EBADF errors during shutdown.
The deprecated tornado.testing.get_unused_port and tornado.testing.LogTrapTestCase have been removed.
.AsyncHTTPTestCase.fetch now supports absolute URLs.
.AsyncHTTPTestCase.fetch now connects to 127.0.0.1 instead of localhost to be more robust against faulty ipv6 configurations.
tornado.util.TimeoutError replaces tornado.gen.TimeoutError and tornado.ioloop.TimeoutError.
.Configurable now supports configuration at multiple levels of an inheritance hierarchy.
.RequestHandler.set_status no longer requires that the given status code appear in http.client.responses.
It is no longer allowed to send a body with 1xx or 204 responses.
Exception handling now breaks up reference cycles that could delay garbage collection.
.RedirectHandler now copies any query arguments from the request to the redirect location.
If both If-None-Match and If-Modified-Since headers are present in a request to .StaticFileHandler, the latter is now ignored.
The C accelerator now operates on multiple bytes at a time to improve performance.
Requests with invalid websocket headers now get a response with status code 400 instead of a closed connection.
.WebSocketHandler.write_message now raises .WebSocketClosedError if the connection closes while the write is in progress.
The io_loop argument to .websocket_connect has been removed.
Nothing published for this version
Nothing published for this version
tornado.curl_httpclient ~~~~~~~~~~~~~~~~~~~~~~~~~
Improved debug logging on Python 3.
Content-Length and Transfer-Encoding headers are no longer sent with 1xx or 204 responses (this was already true of 304 responses).
Reading chunked requests no longer leaves the connection in a broken state.
Writing a memoryview can no longer result in "BufferError: Existing exports of data: object cannot be re-sized".
Duplicate option names are now detected properly whether they use hyphens or underscores.
.AsyncHTTPTestCase.fetch now uses 127.0.0.1 instead of localhost, improving compatibility with systems that have partially-working ipv6 stacks.
It is no longer allowed to send a body with 1xx or 204 responses.
Requests with invalid websocket headers now get a response with status code 400 instead of a closed connection.
Tornado now sets the FD_CLOEXEC flag on all file descriptors it creates. This prevents hanging client connections and resource leaks when the tornado.
Tornado now sets the FD_CLOEXEC flag on all file descriptors it creates. This prevents hanging client connections and resource leaks when the tornado.autoreload module (or Application(debug=True)) is used.
Improved detection of libraries for colorized logging.
Improved detection of libraries for colorized logging.
.url_concat once again treats None as equivalent to an empty sequence.
yield None is now equivalent to yield gen.moment. ~tornado.gen.moment is deprecated. This improves compatibility with asyncio.
The tornado.websocket module now imposes a limit on the size of incoming messages, which defaults to 10MiB.
tornado.routing provides a more flexible routing system than the one built in to .Application.
Reduced the number of circular references, reducing memory usage and improving performance.
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. The session_expires field is currently a string; it should be accessed as int(user['session_expires']) because it will change from a string to an int in Tornado 5.0.
Autoreload is now compatible with the asyncio event loop.
Autoreload no longer attempts to close the .IOLoop and all registered file descriptors before restarting; it relies on the CLOEXEC flag being set instead.
Suppressed some "'NoneType' object not callback" messages that could be logged at shutdown.
yield None is now equivalent to yield gen.moment. ~tornado.gen.moment is deprecated. This improves compatibility with asyncio.
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 by .coroutine or engine.
The Transfer-Encoding header is now parsed case-insensitively.
SimpleAsyncHTTPClient now follows 308 redirects.
CurlAsyncHTTPClient will no longer accept protocols other than http and https. To override this, set pycurl.PROTOCOLS and pycurl.REDIR_PROTOCOLS in a prepare_curl_callback.
CurlAsyncHTTPClient now supports digest authentication for proxies (in addition to basic auth) via the new proxy_auth_mode argument.
The minimum supported version of libcurl is now 7.22.0.
.HTTPServer now accepts the keyword argument trusted_downstream which controls the parsing of X-Forwarded-For headers. This header may be a list or set of IP addresses of trusted proxies which will be skipped in the X-Forwarded-For list.
The no_keep_alive argument works again.
.url_concat correctly handles fragments and existing query arguments.
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 to ~.IOLoop.add_callback from the .IOLoop thread, and slightly decreases it for calls from other threads.
memoryview objects are now permitted as arguments to ~.BaseIOStream.write.
The internal memory buffers used by .IOStream now use bytearray instead of a list of bytes, improving performance.
Futures returned by ~.BaseIOStream.write are no longer orphaned if a second call to write occurs before the previous one is finished.
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 with logging.config.dictConfig.
Worked around an issue that caused "LookupError: unknown encoding: latin1" errors on Solaris.
.Subprocess no longer causes "subprocess still running" warnings on Python 3.6.
Improved error handling in .cpu_count.
.TCPClient now supports a source_ip and source_port argument.
Improved error handling for environments where IPv6 support is incomplete.
.TCPServer.handle_stream implementations may now be native coroutines.
Stopping a .TCPServer twice no longer raises an exception.
.RedirectHandler now supports substituting parts of the matched URL into the redirect location using str.format syntax.
New methods .RequestHandler.render_linked_js, .RequestHandler.render_embed_js, .RequestHandler.render_linked_css, and .RequestHandler.render_embed_css can be overridden to customize the output of .UIModule.
.WebSocketHandler.on_message implementations may now be coroutines. New messages will not be processed until the previous on_message coroutine has finished.
The websocket_ping_interval and websocket_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 or .RequestHandler.set_default_headers are now sent as a part of the websocket handshake.
Return values from .WebSocketHandler.get_compression_options may now include the keys compression_level and mem_level to set gzip parameters. The default compression level is now 6 instead of 9.
A new file upload demo is available in the file_upload directory.
A new .TCPClient and .TCPServer demo is available in the tcpecho directory.
Minor updates have been made to several existing demos, including updates to more recent versions of jquery.
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
依云
Nothing published for this version
Nothing published for this version
The tornado.auth module has been updated for compatibility with a change to Facebook's access_token endpoint. _
The tornado.auth module has been updated for compatibility with a change to Facebook's access_token endpoint.
A difference in cookie parsing between Tornado and web browsers (especially when combined with Google Analytics) could allow an attacker to set arbitr
A difference in cookie parsing between Tornado and web browsers (especially when combined with Google Analytics) could allow an attacker to set arbitrary cookies and bypass XSRF protection. The cookie parser has been rewritten to fix this attack.
Cookies containing certain special characters (in particular semicolon and square brackets) are now parsed differently.
If the cookie header contains a combination of valid and invalid cookies, the valid ones will be returned (older versions of Tornado would reject the entire header for a single invalid cookie).
Fixed a regression in Tornado 4.4 which caused URL regexes containing backslash escapes outside capturing groups to be rejected.
Fixed a regression in Tornado 4.4 which caused URL regexes containing backslash escapes outside capturing groups to be rejected.
Tornado now requires Python 2.7 or 3.3+; versions 2.6 and 3.2 are no longer supported. Pypy3 is still supported even though its latest release is main
Tornado now requires Python 2.7 or 3.3+; versions 2.6 and 3.2 are no longer supported. Pypy3 is still supported even though its latest release is mainly based on Python 3.2.
The monotonic package is now supported as an alternative to Monotime for monotonic clock support on Python 2.
Failures in _curl_setup_request no longer cause the max_clients pool to be exhausted.
Non-ascii header values are now handled correctly.
.with_timeout now accepts any yieldable object (except YieldPoint), not just tornado.concurrent.Future.
The errors raised by timeouts now indicate what state the request was in; the error message is no longer simply "599 Timeout".
Calling repr on a tornado.httpclient.HTTPError no longer raises an error.
Int-like enums (including http.HTTPStatus) can now be used as status codes.
Responses with status code 204 No Content no longer emit a Content-Length: 0 header.
Improved performance when there are large numbers of active timeouts.
All included .Resolver implementations raise IOError (or a subclass) for any resolution failure.
Options can now be modified with subscript syntax in addition to attribute syntax.
The special variable __file__ is now available inside config files.
HTTP/1.0 (not 1.1) responses without a Content-Length header now work correctly.
.TCPServer.bind now accepts a reuse_port argument.
Test sockets now always use 127.0.0.1 instead of localhost. This avoids conflicts when the automatically-assigned port is available on IPv4 but not IPv6, or in unusual network configurations when localhost has multiple IP addresses.
image/svg+xml is now on the list of compressible mime types.
Fixed an error on Python 3 when compression is used with multiple Vary headers.
WebSocketHandler.__init__ now uses super, which improves support for multiple inheritance.
Nothing published for this version
Deprecation notice ~~~~~~~~~~~~~~~~~~
The new async/await keywords in Python 3.5 are supported. In most cases, async def can be used in place of the @gen.coroutine decorator. Inside a function defined with async def, use await instead of yield to wait on an asynchronous operation. Coroutines defined with async/await will be faster than those defined with @gen.coroutine and yield, but do not support some features including Callback/Wait or the ability to yield a Twisted Deferred. See the users' guide for more.
The async/await keywords are also available when compiling with Cython in older versions of Python.
This will be the last release of Tornado to support Python 2.6 or 3.2. Note that PyPy3 will continue to be supported even though it implements a mix of Python 3.2 and 3.3 features.
Tornado has several new dependencies: ordereddict on Python 2.6, singledispatch on all Python versions prior to 3.4 (This was an optional dependency in prior versions of Tornado, and is now mandatory), and backports_abc>=0.4 on all versions prior to 3.5. These dependencies will be installed automatically when installing with pip or setup.py install. These dependencies will not be required when running on Google App Engine.
Binary wheels are provided for Python 3.5 on Windows (32 and 64 bit).
New method .OAuth2Mixin.oauth2_request can be used to make authenticated requests with an access token.
Now compatible with callbacks that have been compiled with Cython.
Fixed an issue with the autoreload command-line wrapper in which imports would be incorrectly interpreted as relative.
Fixed parsing of multi-line headers.
allow_nonstandard_methods=True now bypasses body sanity checks, in the same way as in simple_httpclient.
The PATCH method now allows a body without allow_nonstandard_methods=True.
.WaitIterator now supports the async for statement on Python 3.5.
@gen.coroutine can be applied to functions compiled with Cython. On python versions prior to 3.5, the backports_abc package must be installed for this functionality.
Multi and .multi_future are deprecated and replaced by a unified function .multi.
tornado.httpclient.HTTPError is now copyable with the copy module.
Requests containing both Content-Length and Transfer-Encoding will be treated as an error.
.HTTPHeaders can now be pickled and unpickled.
IOLoop(make_current=True) now works as intended instead of raising an exception.
The Twisted and asyncio IOLoop implementations now clear current() when they exit, like the standard IOLoops.
.IOLoop.add_callback is faster in the single-threaded case.
.IOLoop.add_callback no longer raises an error when called on a closed IOLoop, but the callback will not be invoked.
Coroutine-style usage of .IOStream now converts most errors into .StreamClosedError, which has the effect of reducing log noise from exceptions that are outside the application's control (especially SSL errors).
.StreamClosedError now has a real_error attribute which indicates why the stream was closed. It is the same as the error attribute of .IOStream but may be more easily accessible than the .IOStream itself.
Improved error handling in ~.BaseIOStream.read_until_close.
Logging is less noisy when an SSL server is port scanned.
EINTR is now handled on all reads.
tornado.locale.load_translations now accepts encodings other than UTF-8. UTF-16 and UTF-8 will be detected automatically if a BOM is present; for other encodings .load_translations has an encoding parameter.
.Lock and .Semaphore now support the async with statement on Python 3.5.
A new time-based log rotation mode is available with --log_rotate_mode=time, --log-rotate-when, and log-rotate-interval.
.bind_sockets now supports SO_REUSEPORT with the reuse_port=True argument.
Dashes and underscores are now fully interchangeable in option names.
.Queue now supports the async for statement on Python 3.5.
When following redirects, streaming_callback and header_callback will no longer be run on the redirect responses (only the final non-redirect).
Responses containing both Content-Length and Transfer-Encoding will be treated as an error.
tornado.template.ParseError now includes the filename in addition to line number.
Whitespace handling has become more configurable. The .Loader constructor now has a whitespace argument, there is a new template_whitespace .Application setting, and there is a new {% whitespace %} template directive. All of these options take a mode name defined in the tornado.template.filter_whitespace function. The default mode is single, which is the same behavior as prior versions of Tornado.
Non-ASCII filenames are now supported.
.ExpectLog objects now have a boolean logged_stack attribute to make it easier to test whether an exception stack trace was logged.
The hard limit of 4000 bytes per outgoing header has been removed.
.StaticFileHandler returns the correct Content-Type for files with .gz, .bz2, and .xz extensions.
Responses smaller than 1000 bytes will no longer be compressed.
The default gzip compression level is now 6 (was 9).
Fixed a regression in Tornado 4.2.1 that broke .StaticFileHandler with a path of /.
tornado.web.HTTPError is now copyable with the copy module.
The exception .Finish now accepts an argument which will be passed to the method .RequestHandler.finish.
New .Application setting xsrf_cookie_kwargs can be used to set additional attributes such as secure or httponly on the XSRF cookie.
.Application.listen now returns the .HTTPServer it created.
Fixed handling of continuation frames when compression is enabled.
Nothing published for this version
One column per quarter.