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

Support for TLS server_mode #5

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open

Conversation

arcriley
Copy link

No description provided.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 45.255% when pulling 0d49975 on arcriley:devel into 41796f4 on horazont:devel.

@@ -632,6 +641,10 @@ def starttls(self, ssl_context=None,
if post_handshake_callback is not None:
self._tls_post_handshake_callback = post_handshake_callback

# Drain before initializing TLS
while self._buffer:
yield from asyncio.sleep(0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven’t looked at this into detail yet, so this may be stupid, but yield from self.drain() is no option?

Also, this makes concurrent writes undefined, which should at least be documented.

In addition, a very simple server-mode test (possibly without starttls) should be added. I’m trying to get some unit-test coverage into aioopenssl.

@arcriley
Copy link
Author

arcriley commented May 27, 2017 via email

@horazont
Copy link
Owner

Ah, I assumed that drain was provided by the base class somehow; which of course doesn’t make sense because the base class doesn’t do any buffer management.

I’ll have a look at this this weekend.

@horazont
Copy link
Owner

I tried to write tests for this, and I’m not entirely convinced of the design yet. How is that supposed to be used?

One cannot meaningfully use server_mode with host and port, so sock is the only option. However, with BaseEventLoop.create_server, one cannot replace the transport; instead, one has to provide a Protocol (one could of course create a "Protocol" which .

So the create_starttls_connection function is not really useful for this kind of scenario.

I really would like to avoid to re-create the create_server logic of asyncio. We might need a completely different approach, possibly layering the STARTTLS layer as a Protocol which also exposes a Transport interface.

Thoughts?

@arcriley
Copy link
Author

arcriley commented May 30, 2017 via email

@horazont
Copy link
Owner

Okay, in that case, that starttls_server function should probably be included in aioopenssl (even though I don’t like it). It should also use the STARTTLSTransport constructor directly then, which should be extended by an argument which allows to initialise the extra-dict.

@arcriley
Copy link
Author

arcriley commented May 30, 2017 via email

@horazont
Copy link
Owner

Hey ho! It’s been a while! Do you have any intention on persuing this or can we close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants