Skip to content

Commit

Permalink
wsgi: ignore ssl.SSLZeroReturnError at request finish()
Browse files Browse the repository at this point in the history
fixes #739

plus small cleanup of redundant lines in wsgi_test
  • Loading branch information
temoto committed Jan 22, 2023
1 parent 80b7cfa commit 0dac792
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 3 additions & 0 deletions eventlet/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,9 @@ def get_environ(self):
def finish(self):
try:
BaseHTTPServer.BaseHTTPRequestHandler.finish(self)
except ssl.SSLZeroReturnError:
# TLS version of connection reset by peer
pass
except socket.error as e:
# Broken pipe, connection reset by peer
if support.get_errno(e) not in BROKEN_SOCK:
Expand Down
8 changes: 0 additions & 8 deletions tests/wsgi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,6 @@ def wsgi_app(environ, start_response):
start_response('200 OK', {})
return [environ['wsgi.input'].read()]

certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')

server_sock = eventlet.wrap_ssl(eventlet.listen(('localhost', 0)),
certfile=certificate_file,
keyfile=private_key_file,
Expand All @@ -469,8 +466,6 @@ def wsgi_app(environ, start_response):
start_response("200 OK", [])
return [b""]

certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')
server_sock = eventlet.wrap_ssl(eventlet.listen(('localhost', 0)),
certfile=certificate_file,
keyfile=private_key_file,
Expand Down Expand Up @@ -573,9 +568,6 @@ def wsgi_app(environ, start_response):
start_response('200 OK', [])
return [environ['wsgi.input'].read()]

certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')

sock = eventlet.wrap_ssl(
eventlet.listen(('localhost', 0)),
certfile=certificate_file, keyfile=private_key_file,
Expand Down

0 comments on commit 0dac792

Please sign in to comment.