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

SSL support and a Stream API #107

Merged
merged 78 commits into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
c11d06a
Some tweaks/cleanup to the stream interface
njsmith Mar 20, 2017
e814bf0
some notes to self on how SSLObject works
njsmith Mar 20, 2017
d505cf9
[wip] First attempt at proper SSL support
njsmith Mar 20, 2017
ae544bc
Small cleanups, some test infrastructure, and a first passing test
njsmith Apr 9, 2017
3187137
[travis] why on earth is this not working
njsmith Apr 10, 2017
1d7f097
Install test certs alongside tests
njsmith Apr 10, 2017
7815369
Some basic tests working
njsmith Apr 21, 2017
0dc84ab
Better auto-handshake handling, and more tests
njsmith Apr 21, 2017
7c4c9f3
SSLWantWriteError can't happen
njsmith Apr 21, 2017
e503a83
Test case for bpo-30141
njsmith Apr 23, 2017
0613ce2
checkpoint with tons of wacky stuff
njsmith Apr 25, 2017
e332c92
checkpoint
njsmith Apr 25, 2017
d428a61
Remove unused clutter
njsmith Apr 25, 2017
a138a78
This actually tests the weird interactions! And caught a bug!
njsmith Apr 26, 2017
df63625
Add a tiebreaker= argument to wait_all_tasks_blocked
njsmith Apr 26, 2017
b90d99b
Lots of SSL-related cleanups
njsmith Apr 27, 2017
5bb29ea
refactor trio.ssl._NonblockingMutex into trio._util.UnLock
njsmith Apr 27, 2017
455783a
Add StrictFIFOLock as an alias for Lock
njsmith Apr 28, 2017
c45b382
checkpoint; tons of work on stream API
njsmith Apr 29, 2017
a4b88a9
Really simplify that memory stream hook interface
njsmith Apr 29, 2017
838713b
Document and test trio.StapledStream
njsmith Apr 29, 2017
84ee6b9
AsyncResource is not an AbstractContextManager, what was I thinking
njsmith Apr 29, 2017
909d35e
Tests for trio.abc and trio._streams
njsmith Apr 29, 2017
1c2c1cb
Document and test the new trio.testing memory streams
njsmith Apr 29, 2017
67ada3c
And now the test for trailing data works!
njsmith Apr 29, 2017
77e4d35
Update my TODO list comments
njsmith Apr 29, 2017
6dd8a77
Misc small and somewhat fiddly fixes
njsmith Apr 29, 2017
0270f67
Stop MemoryRecvStream from crashing when closed w/o pending data
njsmith May 1, 2017
d24568e
Groping towards proper close handling in SSLStream
njsmith May 1, 2017
71d2707
Tiny wording tweak to tutorial
njsmith May 1, 2017
2c63c9f
Two changes to SocketType.sendall
njsmith May 1, 2017
3ec1093
Allow TLS <= v1.2, but not 1.3, in the renegotiation tests
njsmith May 1, 2017
493a4df
pypy is fixed now
njsmith May 2, 2017
26109c3
New exception ResourceBusyError
njsmith May 3, 2017
e8e3559
checkpoint
njsmith May 6, 2017
39794f6
checkpoint
njsmith May 11, 2017
bf9e77a
checkpoint
njsmith May 12, 2017
8e0e949
a note to self
njsmith May 16, 2017
5e04e10
Merge branch 'master' into ssl-and-redo-streams
njsmith May 18, 2017
fac436f
small doc changes.
njsmith May 18, 2017
26f758a
Implement lockstep streams
njsmith May 18, 2017
aa7b1d0
Fix for platforms that have no TCP_NOTSENT_LOWAT
njsmith May 19, 2017
c0e43e6
Make windows wait_socket_* into proper checkpoints
njsmith May 19, 2017
512515d
Fix ReST titles
njsmith May 19, 2017
9a7e99e
Revisit non-blocking connect / InterruptedError handling
njsmith May 19, 2017
9cd3b27
Add a test for ssl-over-ssl
njsmith May 19, 2017
c77130d
On MacOS, socket.shutdown is not idempotent
njsmith May 20, 2017
40f1e8e
Merge branch 'ssl' of github.com:njsmith/trio into ssl
njsmith May 20, 2017
ceda041
Remove now-irrelevant test
njsmith May 20, 2017
6432f5a
reduce code duplication in test_ssl.py
njsmith May 20, 2017
8d40410
Speed up MacOS tests a lot by avoiding a weird timeout problem
njsmith May 20, 2017
e4bb97d
Fix docs
njsmith May 20, 2017
42f0092
Make SSLStream pass the generic tests
njsmith May 20, 2017
ff80cf1
Update comment to remove resolved issues
njsmith May 20, 2017
8b0a252
Lots more TLS tests and graceful shutdown fixes
njsmith May 23, 2017
5375893
Add long comment
njsmith May 23, 2017
5b58671
Make SSLStream state handling a little prettier
njsmith May 23, 2017
0fc185b
First attempt at SSLStream https compatibility mode
njsmith May 23, 2017
bd0a386
Finish SSLStream https_compatible mode
njsmith May 23, 2017
40496ea
Attempt to fix appveyor
njsmith May 23, 2017
c7f89c0
Add workaround for PyPy bug 2561
njsmith May 23, 2017
9fe2a7e
[ci] Attempt to add pypy release build test
njsmith May 23, 2017
7cf4815
bits of docs and stuff
njsmith May 23, 2017
1c2bf94
Better handling of errors during handshake
njsmith May 23, 2017
f737597
SSL docstrings, and various tweaks
njsmith May 23, 2017
074a4f0
Remove superfluous 'pass' statements from trio.abc
njsmith May 23, 2017
61a575e
Disable testing pypy releases for now
njsmith May 23, 2017
1480281
Some docstring fixups
njsmith May 23, 2017
3bb0c30
more SSL docs
njsmith May 23, 2017
3cfd248
Add test for pypy getsockopt workaround
njsmith May 23, 2017
48599d2
Improved tests for wait_send_all_might_not_block, and corresponding f…
njsmith May 23, 2017
afe7700
Add a pragma: no cover
njsmith May 23, 2017
31073eb
Remove a superfluous comment
njsmith May 23, 2017
39dbf32
Make the getsockopt w/ non-zero buflen test more portable
njsmith May 23, 2017
7bd1ef8
Merge branch 'master' into ssl
njsmith May 30, 2017
d1144b8
[docs] Make clear that high-level networking is under construction
njsmith Jun 11, 2017
9e17794
Merge branch 'ssl' of github.com:njsmith/trio into ssl
njsmith Jun 11, 2017
b61535f
Remove todos
njsmith Jun 11, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ matrix:
- os: linux
language: generic
env: USE_PYPY_NIGHTLY=1
# 5.7.1 has some minor bugs that are nonetheless annoying/hard to
# work around; let's wait for the next beta before we start
# testing pypy releases.
# - os: linux
# language: generic
# env: USE_PYPY_RELEASE=1
- os: osx
language: generic
env: MACPYTHON=3.5.3
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ include LICENSE LICENSE.MIT LICENSE.APACHE2
include README.rst
include CODE_OF_CONDUCT.md
include test-requirements.txt
recursive-include trio/tests/test_ssl_certs *.pem
recursive-include docs *
prune docs/build
16 changes: 14 additions & 2 deletions ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -ex

if [ "$TRAVIS_OS_NAME" = "osx" ]; then
curl -o macpython.pkg https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg
curl -Lo macpython.pkg https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg
sudo installer -pkg macpython.pkg -target /
ls /Library/Frameworks/Python.framework/Versions/*/bin/
if expr "${MACPYTHON}" : 2; then
Expand All @@ -18,7 +18,7 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then
fi

if [ "$USE_PYPY_NIGHTLY" = "1" ]; then
curl -o pypy.tar.bz2 http://buildbot.pypy.org/nightly/py3.5/pypy-c-jit-latest-linux64.tar.bz2
curl -Lo pypy.tar.bz2 http://buildbot.pypy.org/nightly/py3.5/pypy-c-jit-latest-linux64.tar.bz2
tar xaf pypy.tar.bz2
# something like "pypy-c-jit-89963-748aa3022295-linux64"
PYPY_DIR=$(echo pypy-c-jit-*)
Expand All @@ -29,6 +29,18 @@ if [ "$USE_PYPY_NIGHTLY" = "1" ]; then
source testenv/bin/activate
fi

if [ "$USE_PYPY_RELEASE" = "1" ]; then
curl -Lo pypy.tar.bz2 https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.5-5.7.1-beta-linux_x86_64-portable.tar.bz2
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is not beta anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the URL where he posted it; what do you want me to do here :-). Note that "beta" here doesn't mean "this is a beta of 5.7.1", it means "this is 5.7.1, and watch out b/c the py3 support is still considered beta quality".

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, my bad. Ignore comment then.

tar xaf pypy.tar.bz2
# something like "pypy3.5-5.7.1-beta-linux_x86_64-portable"
PYPY_DIR=$(echo pypy3.5-*)
PYTHON_EXE=$PYPY_DIR/bin/pypy3
$PYTHON_EXE -m ensurepip
$PYTHON_EXE -m pip install virtualenv
$PYTHON_EXE -m virtualenv testenv
source testenv/bin/activate
fi

pip install -U pip setuptools wheel

python setup.py sdist --formats=zip
Expand Down
11 changes: 8 additions & 3 deletions docs/source/reference-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ work that was happening within the scope that was cancelled.
Looking at this, you might wonder how you can tell whether the inner
block timed out – perhaps you want to do something different, like try
a fallback procedure or report a failure to our caller. To make this
easier, :func:`move_on_after`'s ``__enter__`` function returns an
easier, :func:`move_on_after`s ``__enter__`` function returns an
object representing this cancel scope, which we can use to check
whether this scope caught a :exc:`Cancelled` exception::

Expand Down Expand Up @@ -1364,6 +1364,9 @@ don't have any special access to trio's internals.)
.. autoclass:: Lock
:members:

.. autoclass:: StrictFIFOLock
:members:

.. autoclass:: Condition
:members:

Expand Down Expand Up @@ -1534,12 +1537,14 @@ trio's internal scheduling decisions.
Exceptions
----------

.. autoexception:: TrioInternalError

.. autoexception:: Cancelled

.. autoexception:: TooSlowError

.. autoexception:: WouldBlock

.. autoexception:: ResourceBusyError

.. autoexception:: RunFinishedError

.. autoexception:: TrioInternalError
8 changes: 4 additions & 4 deletions docs/source/reference-hazmat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ All environments provide the following functions:

:raises TypeError:
if the given object is not of type :func:`socket.socket`.
:raises RuntimeError:
:raises trio.ResourceBusyError:
if another task is already waiting for the given socket to
become readable.

Expand All @@ -62,7 +62,7 @@ All environments provide the following functions:

:raises TypeError:
if the given object is not of type :func:`socket.socket`.
:raises RuntimeError:
:raises trio.ResourceBusyError:
if another task is already waiting for the given socket to
become writable.

Expand All @@ -85,7 +85,7 @@ Unix-like systems provide the following functions:

:arg fd:
integer file descriptor, or else an object with a ``fileno()`` method
:raises RuntimeError:
:raises trio.ResourceBusyError:
if another task is already waiting for the given fd to
become readable.

Expand All @@ -103,7 +103,7 @@ Unix-like systems provide the following functions:

:arg fd:
integer file descriptor, or else an object with a ``fileno()`` method
:raises RuntimeError:
:raises trio.ResourceBusyError:
if another task is already waiting for the given fd to
become writable.

Expand Down
Loading