diff --git a/CHANGES.rst b/CHANGES.rst index 9c7b4293fef..02ab1d45970 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,80 @@ .. towncrier release notes start +3.11.11 (2024-12-18) +==================== + +Bug fixes +--------- + +- Updated :py:meth:`~aiohttp.ClientSession.request` to reuse the ``quote_cookie`` setting from ``ClientSession._cookie_jar`` when processing cookies parameter. + -- by :user:`Cycloctane`. + + + *Related issues and pull requests on GitHub:* + :issue:`10093`. + + + +- Fixed type of ``SSLContext`` for some static type checkers (e.g. pyright). + + + *Related issues and pull requests on GitHub:* + :issue:`10099`. + + + +- Updated :meth:`aiohttp.web.StreamResponse.write` annotation to also allow :class:`bytearray` and :class:`memoryview` as inputs -- by :user:`cdce8p`. + + + *Related issues and pull requests on GitHub:* + :issue:`10154`. + + + +- Fixed a hang where a connection previously used for a streaming + download could be returned to the pool in a paused state. + -- by :user:`javitonino`. + + + *Related issues and pull requests on GitHub:* + :issue:`10169`. + + + + +Features +-------- + +- Enabled ALPN on default SSL contexts. This improves compatibility with some + proxies which don't work without this extension. + -- by :user:`Cycloctane`. + + + *Related issues and pull requests on GitHub:* + :issue:`10156`. + + + + +Miscellaneous internal changes +------------------------------ + +- Fixed an infinite loop that can occur when using aiohttp in combination + with `async-solipsism`_ -- by :user:`bmerry`. + + .. _async-solipsism: https://github.com/bmerry/async-solipsism + + + *Related issues and pull requests on GitHub:* + :issue:`10149`. + + + + +---- + + 3.11.10 (2024-12-05) ==================== diff --git a/CHANGES/10093.bugfix.rst b/CHANGES/10093.bugfix.rst deleted file mode 100644 index 4d7076115d9..00000000000 --- a/CHANGES/10093.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update :py:meth:`~aiohttp.ClientSession.request` to reuse the ``quote_cookie`` setting from ``ClientSession._cookie_jar`` when processing cookies parameter. --- by :user:`Cycloctane`. diff --git a/CHANGES/10099.bugfix.rst b/CHANGES/10099.bugfix.rst deleted file mode 100644 index 718420a6ad5..00000000000 --- a/CHANGES/10099.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed type of ``SSLContext`` for some static type checkers (e.g. pyright). diff --git a/CHANGES/10149.misc.rst b/CHANGES/10149.misc.rst deleted file mode 100644 index 61765a50fcf..00000000000 --- a/CHANGES/10149.misc.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fixed an infinite loop that can occur when using aiohttp in combination -with `async-solipsism`_ -- by :user:`bmerry`. - -.. _async-solipsism: https://github.com/bmerry/async-solipsism diff --git a/CHANGES/10154.bugfix.rst b/CHANGES/10154.bugfix.rst deleted file mode 100644 index 382d9e56e6c..00000000000 --- a/CHANGES/10154.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Updated :meth:`aiohttp.web.StreamResponse.write` annotation to also allow :class:`bytearray` and :class:`memoryview` as inputs -- by :user:`cdce8p`. diff --git a/CHANGES/10156.feature.rst b/CHANGES/10156.feature.rst deleted file mode 100644 index 0ff6b6b8bd8..00000000000 --- a/CHANGES/10156.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Enabled ALPN on default SSL contexts. This improves compatibility with some -proxies which don't work without this extension. --- by :user:`Cycloctane`. diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 7a7f882c885..591142d469e 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -179,6 +179,7 @@ Jan Buchar Jan Gosmann Jarno Elonen Jashandeep Sohi +Javier Torres Jean-Baptiste Estival Jens Steinhauser Jeonghun Lee diff --git a/aiohttp/streams.py b/aiohttp/streams.py index 82d404d617b..ca7a420c6d5 100644 --- a/aiohttp/streams.py +++ b/aiohttp/streams.py @@ -220,6 +220,9 @@ def feed_eof(self) -> None: self._eof_waiter = None set_result(waiter, None) + if self._protocol._reading_paused: + self._protocol.resume_reading() + for cb in self._eof_callbacks: try: cb() diff --git a/tests/test_flowcontrol_streams.py b/tests/test_flowcontrol_streams.py index a6516fec75a..9e21f786610 100644 --- a/tests/test_flowcontrol_streams.py +++ b/tests/test_flowcontrol_streams.py @@ -107,3 +107,25 @@ async def test_read_nowait(self, stream: streams.StreamReader) -> None: res = stream.read_nowait(5) assert res == b"" assert stream._protocol.resume_reading.call_count == 1 # type: ignore[attr-defined] + + async def test_resumed_on_eof(self, stream: streams.StreamReader) -> None: + stream.feed_data(b"data") + assert stream._protocol.pause_reading.call_count == 1 # type: ignore[attr-defined] + assert stream._protocol.resume_reading.call_count == 0 # type: ignore[attr-defined] + stream._protocol._reading_paused = True + + stream.feed_eof() + assert stream._protocol.resume_reading.call_count == 1 # type: ignore[attr-defined] + + +async def test_stream_reader_eof_when_full() -> None: + loop = asyncio.get_event_loop() + protocol = BaseProtocol(loop=loop) + protocol.transport = asyncio.Transport() + stream = streams.StreamReader(protocol, 1024, loop=loop) + + data_len = stream._high_water + 1 + stream.feed_data(b"0" * data_len) + assert protocol._reading_paused + stream.feed_eof() + assert not protocol._reading_paused