Skip to content

v6.6.2

@bdarnell bdarnell tagged this 02 Dec 18:53
Dec 2, 2026
-----------

Security Fixes
~~~~~~~~~~~~~~

- `.OAuthMixin.authorize_redirect` and `.TwitterMixin.authenticate_redirect` now raise
  `ValueError` if ``callback_uri`` is a relative URL (including a scheme-relative one such
  as ``//example.com/login``) with OAuth 1.0a. A relative callback was resolved against the
  request's ``Host`` header, which the client chooses, so an attacker could get a request
  token whose callback pointed to their own site and, with a provider that accepts the
  callback given in the request, log in to the application as the user who approved it.
  Pass the full URL of your callback handler, built from your application's configuration
  (not from the request, so not ``self.request.full_url()``).
  Absolute URLs, ``"oob"``, and omitting ``callback_uri`` work as before.
  `GHSA-qg25-9j46-q7p4 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-qg25-9j46-q7p4>`_.
  Thanks to `Dickson Wu (SEAL & CertiK) <https://github.com/DicksonWu654>`_ for reporting this
  issue.
- `.linkify` no longer takes quadratic time on text with long runs of hyphenated words, which
  could block the event loop for seconds or minutes in applications that pass it untrusted
  input. As a result, protocols longer than 32 characters are no longer linkified (even if
  they are in ``permitted_protocols``), and the end of a run of more than 32 letters,
  digits, hyphens or underscores followed by a colon may now be linkified (for example,
  a URL that directly follows a long run of hyphens).
  `GHSA-f7gj-7hhr-3588 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-f7gj-7hhr-3588>`_.
  Thanks to `goranai <https://github.com/goranai>`_ for reporting this issue.
- When ``SimpleAsyncHTTPClient`` follows a redirect that changes the request method to
  ``GET`` (a 303 redirect, or a 301 or 302 redirect of a ``POST``), it no longer uses the
  request's ``body_producer`` or sends ``Expect: 100-continue``. Previously, with
  ``allow_nonstandard_methods=True``, the body was sent again, without framing, to the
  redirect target after the ``GET`` request's headers; without that flag the redirect failed
  with `ValueError`.
  `GHSA-hgp3-38vh-pv72 <https://github.com/tornadoweb/tornado/security/advisories/GHSA-hgp3-38vh-pv72>`_.
  Thanks to Yeonghun Kim of Theori, with Xint, for reporting this issue.
- `.Application` now raises `TypeError` if the ``trusted_origins`` setting is a string
  instead of a list. A string was searched as a substring, so that
  ``trusted_origins="https://example.com"`` also trusted ``https://example.co``.
  Applications that set a single origin as a string will fail at startup and must
  change it to a list (``["https://example.com"]``).

Deprecation notice
~~~~~~~~~~~~~~~~~~

- Support for HTTP header lines terminated by LF without CR is still deprecated, but its
  removal has been postponed back to Tornado 7.0 (Tornado 6.6.1 had moved it to 6.7).

Bug Fixes
~~~~~~~~~

- ``StaticFileHandler`` once again returns a 404 instead of a 500 (with a logged
  traceback) for a request path containing a null byte (such as ``/static/foo%00``).
  This was a regression in Tornado 6.5.9.
- When `.HTTPServer` is used with ``decompress_request=True``, a limit set with
  `.HTTP1Connection.set_max_body_size` (for example, in ``prepare()`` of a handler using
  `.stream_request_body`) now also applies to the decompressed size of a gzipped request
  body. Previously the decompressed body was limited by the server-wide
  ``max_body_size`` instead.
- `.WSGIContainer` now discards the response body for ``HEAD`` requests. Previously a
  WSGI application that returned a body for ``HEAD`` (such as Django) caused the
  connection to fail.
- ``python -m tornado.autoreload -m module`` works again on Python 3.14 (previously it
  raised `AttributeError` when the module exited).
- Websocket control frames (such as pings) interleaved with the fragments of a
  compressed message no longer break decompression. Control frames with the
  compression bit set (which RFC 7692 forbids) now fail the connection.
- A websocket message that is not valid deflate data now closes the connection with
  code 1007 instead of logging an uncaught exception.
- ``simple_httpclient`` now fails a request immediately when the connection fails while
  the response body is being read (for example, if the server resets the connection),
  instead of logging an uncaught exception and failing with a timeout when
  ``request_timeout`` expires. The exception raised is the underlying error (such as
  `ConnectionResetError`) instead of ``HTTPTimeoutError``.
- `.HTTPServer` now closes server connections when their request loop is cancelled
  (for example, at shutdown) instead of leaving them open.
Assets 2
Loading