[New-bugs-announce] [issue38737] StreamReaderProtocol.eof_received() should return True only for _SSLProtocolTransport

Anthony Baire report at bugs.python.org
Thu Nov 7 13:31:50 EST 2019


New submission from Anthony Baire <ayba at free.fr>:

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).

----------
components: asyncio
files: eof-received-over-ssl.diff
keywords: patch
messages: 356207
nosy: aba, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: StreamReaderProtocol.eof_received() should return True only for _SSLProtocolTransport
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48701/eof-received-over-ssl.diff

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38737>
_______________________________________


More information about the New-bugs-announce mailing list