Skip to content

Commit

Permalink
Test to attempt to reproduce the eoferror in #719
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Jan 13, 2016
1 parent 628c1b9 commit 61c6a5a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions greentest/test__ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@ def test_sendall_timeout0(self):
client.close()
server_sock[0][0].close()

def test_ssl_sendall_timeout(self):
# Issue #719: SSLEOFError

data = b'HTTP/1.0\r\nGET /\r\nConnection: Keep-Alive\r\n\r\nHere is a body\r\n'
data += b'make the body longer\r\n' * 10000

def server_func():
remote, _ = self.listener.accept()
f = remote.makefile('rb')
try:
d = f.read(len(data))
self.assertEqual(d, data)
finally:
f.close()
remote.close()

acceptor = test__socket.Thread(target=server_func)
client = self.create_connection()
client.settimeout(0.001)
try:
client.sendall(data)

This comment has been minimized.

Copy link
@kurtbrose

kurtbrose Feb 5, 2016

Maybe try calling client.close() immediately here instead of after waiting for the server to finish?

I've seen these timeout bugs happen when a little test script sends the request, then finishes and process exits without reading the response.

(garbage collection doesn't seem to SSL_shutdown on the socket.)

finally:
acceptor.join()
client.close()


def ssl_listener(address, private_key, certificate):
raw_listener = socket.socket()
Expand Down

0 comments on commit 61c6a5a

Please sign in to comment.