summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Shepelev <temotor@gmail.com>2023-01-22 06:45:48 +0300
committerSergey Shepelev <temotor@gmail.com>2023-01-22 06:45:48 +0300
commit0dac792df69f28407e1eb0b42e53fa06cc83a02a (patch)
tree2632c778c5f34ab71baf806b57bb25dc736dea52
parent80b7cfaf86e9d787250c1a3924248a22c8b6baad (diff)
downloadeventlet-739-ssl-eof.tar.gz
wsgi: ignore ssl.SSLZeroReturnError at request finish()739-ssl-eof
fixes https://github.com/eventlet/eventlet/issues/739 plus small cleanup of redundant lines in wsgi_test
-rw-r--r--eventlet/wsgi.py3
-rw-r--r--tests/wsgi_test.py8
2 files changed, 3 insertions, 8 deletions
diff --git a/eventlet/wsgi.py b/eventlet/wsgi.py
index 7ef0254..3c524cf 100644
--- a/eventlet/wsgi.py
+++ b/eventlet/wsgi.py
@@ -749,6 +749,9 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
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:
diff --git a/tests/wsgi_test.py b/tests/wsgi_test.py
index 298f694..1c290a9 100644
--- a/tests/wsgi_test.py
+++ b/tests/wsgi_test.py
@@ -446,9 +446,6 @@ class TestHttpd(_TestBase):
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,
@@ -469,8 +466,6 @@ class TestHttpd(_TestBase):
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,
@@ -573,9 +568,6 @@ class TestHttpd(_TestBase):
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,