Ben Darnell [Thu, 24 Oct 2024 13:33:13 +0000 (09:33 -0400)]
setup: Remove override of bdist_wheel
This is no longer necessary in recent versions of setuptools
(and we now check that abi3 is used properly in official releases).
The bdist_wheel implementation is being moved from the wheel package
into setuptools so overriding it will stop working in the future.
Follows the example of https://github.com/joerick/python-abi3-package-sample/pull/30
Ben Darnell [Wed, 4 Sep 2024 19:14:30 +0000 (15:14 -0400)]
docs: Add readthedocs configuration
RTD will no longer do this automagically, so we need to add these
lines explicitly for compatibility. See
https://about.readthedocs.com/blog/2024/07/addons-by-default/
Colin Watson [Sun, 18 Aug 2024 17:58:11 +0000 (18:58 +0100)]
Fix tests with Twisted 24.7.0
`twisted.internet.defer.returnValue` was needed on Python 2, but on
Python 3 a simple `return` statement works fine. Twisted 24.7.0
deprecated the former, causing
`tornado.test.twisted_test.ConvertDeferredTest.test_success` to fail.
Ben Darnell [Thu, 11 Jul 2024 18:28:10 +0000 (14:28 -0400)]
test: Remove broken tests for legacy TLS versions
The get_ssl_version method in these tests has been
silently ignored for a long time (forever?) due to
MRO issues (if they weren't ignored, they'd have
started throwing deprecation warnings), and they
were never updated for more recent versions of
TLS. There doesn't appear to be much value in
rehabilitating these tests so just get rid of all
but the base configuration.
build(deps): bump certifi from 2024.6.2 to 2024.7.4
Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4.
- [Commits](https://github.com/certifi/python-certifi/compare/2024.06.02...2024.07.04)
Ben Darnell [Fri, 28 Jun 2024 20:27:55 +0000 (16:27 -0400)]
test: Replace a long-skipped test for tornado.util.exec_in
This test was first written to rely on the print_function future import
in Python 2.7, so it's been skipped since we dropped Python 2.
Use the annotations future import introduced in Python 3.7 instead.
Ben Darnell [Thu, 13 Jun 2024 19:25:50 +0000 (15:25 -0400)]
*: Switch from percent formatting to f-strings
Automated change using pyupgrade in two passes (once to go from percent
formatting to str.format, then to go from str.format to f-strings),
followed by black.
This left a few uses of str.format for unknown reasons.
Ben Darnell [Thu, 13 Jun 2024 19:08:18 +0000 (15:08 -0400)]
lint: Set black target version to 3.8+
This makes black use trailing commas consistently across the codebase.
Without this, it uses certain trailing commas only in files that
contain fstrings (because this marks them as requiring Python 3.6+).
Ben Darnell [Wed, 12 Jun 2024 01:35:51 +0000 (21:35 -0400)]
docs: Update sphinx (and the rest of the deps)
Remove pin to sphinx 5.x and remove sphinx-asyncio. Sphinx now supports
asyncio out of the box. Everything I've checked looks fine although I
haven't looked at every page.
Ben Darnell [Tue, 11 Jun 2024 16:16:55 +0000 (12:16 -0400)]
twisted: Delete TwistedResolver class
This class was deprecated and slated for deletion in Tornado 7.0.
However, it has become broken due to the adoption of RFC 8482
(which limits the use of the ANY query type in DNS) and it now fails
for most domain names (with the exception of localhost).
The upstream issue https://github.com/twisted/twisted/issues/10062
has been open for years which is a pretty good sign that no one
is depending on this class and it's safe to remove it ahead of
schedule.
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.
Ben Darnell [Mon, 10 Jun 2024 16:22:54 +0000 (12:22 -0400)]
test: Fix some lint issues after #3298
That PR arrived while our CI was broken and I
manually verified that the tests passed but didn't
run the linters. These changes are running in to
https://github.com/python/mypy/issues/5088
Ben Darnell [Fri, 7 Jun 2024 19:23:45 +0000 (15:23 -0400)]
web: Improve typing for UIModule.render
In practice, UIModule.render often returns the
result of self.render_string, which returns bytes.
In fact, we have an example of that in this file
which had a type ignore comment. UIModule.render
may now return either str or bytes and downstream
code is responsible for handling this. (Note that
the new call to _unicode appears to be redundant
since the Template module's bytes return was
already working correctly, but this conversion is
necessary to satisfy the type checker.)
Ben Darnell [Fri, 7 Jun 2024 18:42:28 +0000 (14:42 -0400)]
httputil: Add types for elements of HTTPHeaders
Revealed an issue in websocket.py in which bytes were used when it
should have been str. This avoided being a bug because something
down the line was converting it to str but it was still a logical
type error.
The change to httputil.py was taken from #3329 (thanks mslynch).
Ben Darnell [Wed, 5 Jun 2024 20:50:37 +0000 (16:50 -0400)]
httputil: Only strip tabs and spaces from header values
The RFC specifies that only tabs and spaces should be stripped.
Removing additonal whitespace characters can lead to framing
errors with certain proxies.
Ben Darnell [Wed, 5 Jun 2024 20:50:11 +0000 (16:50 -0400)]
http1connection: Stricter handling of transfer-encoding
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.
Ben Darnell [Wed, 5 Jun 2024 19:43:45 +0000 (15:43 -0400)]
curl_httpclient,http1connection: Prohibit CR and LF in headers
libcurl does not check for CR and LF in headers, making this the
application's responsibility. However, Tornado's other HTTP interfaces
check for linefeeds so we should do the same here so that switching
between the simple and curl http clients does not introduce header
injection vulnerabilties.
http1connection previously checked only for LF in headers (alone or in a
CRLF pair). It now prohibits bare CR as well, following the requirement
in RFC 9112.