Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio SSLProtocol _app_transport is private #72400

Closed
ghost opened this issue Sep 20, 2016 · 4 comments
Closed

asyncio SSLProtocol _app_transport is private #72400

ghost opened this issue Sep 20, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 20, 2016

BPO 28213
Nosy @gvanrossum, @asvetlov, @1st1

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-10-21.21:04:20.582>
created_at = <Date 2016-09-20.09:21:57.518>
labels = ['expert-asyncio']
title = 'asyncio SSLProtocol _app_transport is private'
updated_at = <Date 2016-10-21.21:04:20.524>
user = None

bugs.python.org fields:

activity = <Date 2016-10-21.21:04:20.524>
actor = 'yselivanov'
assignee = 'none'
closed = True
closed_date = <Date 2016-10-21.21:04:20.582>
closer = 'yselivanov'
components = ['asyncio']
creation = <Date 2016-09-20.09:21:57.518>
creator = '\xd0\x9a\xd0\xbe\xd0\xbd\xd1\x81\xd1\x82\xd0\xb0\xd0\xbd\xd1\x82\xd0\xb8\xd0\xbd \xd0\x92\xd0\xbe\xd0\xbb\xd0\xba\xd0\xbe\xd0\xb2'
dependencies = []
files = []
hgrepos = []
issue_num = 28213
keywords = []
message_count = 4.0
messages = ['277020', '277066', '277080', '279152']
nosy_count = 4.0
nosy_names = ['gvanrossum', 'asvetlov', 'yselivanov', '\xd0\x9a\xd0\xbe\xd0\xbd\xd1\x81\xd1\x82\xd0\xb0\xd0\xbd\xd1\x82\xd0\xb8\xd0\xbd \xd0\x92\xd0\xbe\xd0\xbb\xd0\xba\xd0\xbe\xd0\xb2']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue28213'
versions = ['Python 3.5', 'Python 3.6']

@ghost
Copy link
Author

ghost commented Sep 20, 2016

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
self._tls_protocol.connection_made(socket_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

Repository owner added the topic-asyncio label Sep 20, 2016
@1st1
Copy link
Member

1st1 commented Sep 20, 2016

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

@asvetlov
Copy link
Contributor

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

@1st1
Copy link
Member

1st1 commented Oct 21, 2016

Closing this one. I don't think we want to expose/document _app_transport.

@1st1 1st1 closed this as completed Oct 21, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants