classification
Title: Asyncio: SSL transport does not support set_protocol()
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jlacoline, yselivanov
Priority: normal Keywords: patch

Created on 2017-09-29 08:59 by jlacoline, last changed 2017-10-19 18:12 by yselivanov. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3817 merged jlacoline, 2017-09-29 09:56
PR 4052 merged python-dev, 2017-10-19 17:50
Messages (4)
msg303313 - (view) Author: Loïc Lajeanne (jlacoline) * Date: 2017-09-29 08:59
The bug was encountered when using the HTTPS client of the aiohttp package. 

Calling the method set_protocol() on a SSL transport (_SSLProtocolTransport) does not have the expected result: the new protocol will never be used (i.e. its data_received() method won't be called). The previous one keeps receiving data.

The problem comes from asyncio/ssl_proto.py:308. In my understanding, _SSLProtocolTransport is modifying its local reference to the protocol but does not modify the reference in SSLProtocol, which is the one that is actually called.
So imo this line should look like "self.ssl_protocol._app_protocol = protocol"

I'll submit a github PR soon to fix this issue.
msg304626 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-10-19 17:49
New changeset ea2ef5d0ca869d4550820ed53bdf56013dbb9546 by Yury Selivanov (jlacoline) in branch 'master':
bpo-31632: fix set_protocol() in _SSLProtocolTransport (#3817) (#3817)
https://github.com/python/cpython/commit/ea2ef5d0ca869d4550820ed53bdf56013dbb9546
msg304627 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-10-19 17:50
Loïc, thank you for the contribution!
msg304631 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-10-19 18:12
New changeset 9c23b173b823b5e6da01d85c570c7ae2ab07b38b by Yury Selivanov (Miss Islington (bot)) in branch '3.6':
bpo-31632: fix set_protocol() in _SSLProtocolTransport (GH-3817) (GH-3817) (#4052)
https://github.com/python/cpython/commit/9c23b173b823b5e6da01d85c570c7ae2ab07b38b
History
Date User Action Args
2017-10-19 18:12:46yselivanovsetmessages: + msg304631
2017-10-19 17:50:44yselivanovsetstatus: open -> closed
versions: + Python 3.7
messages: + msg304627

resolution: fixed
stage: patch review -> resolved
2017-10-19 17:50:09python-devsetpull_requests: + pull_request4021
2017-10-19 17:49:59yselivanovsetmessages: + msg304626
2017-09-29 09:56:28jlacolinesetkeywords: + patch
stage: patch review
pull_requests: + pull_request3801
2017-09-29 08:59:33jlacolinecreate