This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: StreamReaderProtocol.eof_received() should return True only for _SSLProtocolTransport
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: aba, asvetlov, yselivanov
Priority: normal Keywords: patch

Created on 2019-11-07 18:31 by aba, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
eof-received-over-ssl.diff aba, 2019-11-07 18:31 patch
Messages (2)
msg356207 - (view) Author: Anthony Baire (aba) Date: 2019-11-07 18:31
We developed an alternate asyncio TLS transport based on GnuTLS (https://pypi.org/project/aio-gnutls-transport/). In this project we want to support half-closed TLS connections (WriteTransport.write_eof()).


Unfortunately StreamReaderProtocol won't interoperate properly without a monkey patch because its eof_received() method returns True for any ssl transport (this is to avoid a warning in the _SSLProtocolTransport):

    def eof_received(self):
        self._stream_reader.feed_eof()
        if self._over_ssl:
            # Prevent a warning in SSLProtocol.eof_received:
            # "returning true from eof_received()
            # has no effect when using ssl"
            return False
        return True

As this is an unspecified internal feature, very specific to the _SSLProtocolTransport class (which issues the warning), we think the test should be made explicitly against this class (see the attached patch).
msg356209 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-11-07 19:16
StreamReaderProtocol is tightly coupled with builtin asyncio transports.
Even worse, it is an internal class actually.
If you want a code to operate with custom transports -- perhaps you need to reimplement streams for them as well.
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82918
2019-11-07 19:16:13asvetlovsetstatus: open -> closed
resolution: wont fix
messages: + msg356209

stage: resolved
2019-11-07 18:31:50abacreate