Title: asyncio SSLProtocol _app_transport is private
Type: Stage: resolved
Components: asyncio Versions: Python 3.6, Python 3.5
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, gvanrossum, yselivanov, Константин Волков
Priority: normal Keywords:

Created on 2016-09-20 09:21 by Константин Волков, last changed 2016-10-21 21:04 by yselivanov. This issue is now closed.

Messages (4)
msg277020 - (view) Author: Константин Волков (Константин Волков) Date: 2016-09-20 09:21
Seems that this field must not be private(or must have read-only property) as it is supposed to use outside of class.

I catched that, when implemented STARTTLS smtp process, when you must start SSL connection over existing socket connection. Currently it is not hard, its easy to add SSL layer as loop do:

self._tls_protocol = sslproto.SSLProtocol()
socket_transport = self.transport
socket_transport._protocol = self._tls_protocol
self.transport = self._tls_protocol._app_transport

But here you must access to private property "app_transport". It must be public because its purpose to public "result" of SSL layer implementation. 

From class BaseSelectorEventLoop:

def _make_ssl_transport(...):
    return ssl_protocol._app_transport
msg277066 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-09-20 20:58
-1 on exposing app_protocol. It's an implementation detail, starttls should be implemented in asyncio (and while it's not, it's ok to use '_app_protocol'.
msg277080 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2016-09-20 23:08
-1, agree with Yury.
As an option it's possible to wrap `sslproto.SSLProtocol` by custom derived class which overrides `connection_made()` for storing a transport somewhere.
The solution looks like sub-optimal but it's backward-compatible.
The other problem is: `sslproto` is a very private module for working with SSL if `ssl.MemoryBIO` is available.
I believe that third-party code shouldn't rely on `sslproto.SSLProtocol` and even on `asyncio.sslproto` existence.
msg279152 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-10-21 21:04
Closing this one. I don't think we want to expose/document _app_transport.
Date User Action Args
2016-10-21 21:04:20yselivanovsetstatus: open -> closed
resolution: wont fix
messages: + msg279152

stage: resolved
2016-09-20 23:08:34asvetlovsetmessages: + msg277080
2016-09-20 20:58:28yselivanovsetmessages: + msg277066
2016-09-20 20:17:31gvanrossumsetnosy: + asvetlov
2016-09-20 09:21:57Константин Волковcreate