Skip to content

Commit

Permalink
OpenSSL >= 1.1.0 fails with EOF when a client cannot complete a hands…
Browse files Browse the repository at this point in the history
…hake.

Terminating a TLS connection after the client sends a ClientHello but
before it completes a handshake always fails.  The tests in this
commit terminate client connections in this way.

Earlier versions of OpenSSL fail the BIO flush with "SSL routines: ssl
handshake failure" error in ssl3_read_bytes.  The affected tests
expected this by only trapping Error.

The TLS state machine rewrite in 1.1.0 (see
https://www.openssl.org/news/openssl-1.1.0-notes.html) presumably
resulted in the BIO flush failing with EOF.
  • Loading branch information
markrwilliams committed Mar 12, 2017
1 parent b9621a8 commit 9bf53b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/twisted/protocols/test/test_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def test_disorderlyShutdown(self):

# And when the connection completely dies, check the reason.
def cbDisconnected(clientProtocol):
clientProtocol.lostConnectionReason.trap(Error)
clientProtocol.lostConnectionReason.trap(Error, ConnectionLost)
clientConnectionLost.addCallback(cbDisconnected)
return clientConnectionLost

Expand Down Expand Up @@ -1379,7 +1379,8 @@ def registerProducerAfterConnectionLost(self, streaming):
producer is not used, and its stopProducing method is called.
"""
clientProtocol, tlsProtocol = buildTLSProtocol()
clientProtocol.connectionLost = lambda reason: reason.trap(Error)
clientProtocol.connectionLost = lambda reason: reason.trap(
Error, ConnectionLost)

class Producer(object):
stopped = False
Expand Down

0 comments on commit 9bf53b7

Please sign in to comment.