diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2014-05-14 15:54:30 -0600 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2014-05-14 16:09:17 -0600 |
commit | 4b5e43f240e194ef973acbcc8fbac707f3014d38 (patch) | |
tree | 0f75e5f3da15c752428f5ef50d6b9f050ecb7760 | |
parent | b9464c28b90f39c2fd9473c4170a65ba5985d6db (diff) | |
download | waitress-4b5e43f240e194ef973acbcc8fbac707f3014d38.tar.gz |
Upon a socket.error, we need to close the filehandle
If we don't close the filehandle, socket.close() won't actually close
the underlying file descriptor because the fp still holds a reference to
it. Even when it then goes out of scope, the file pointer is still open.
-rw-r--r-- | waitress/tests/test_functional.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/waitress/tests/test_functional.py b/waitress/tests/test_functional.py index 2ff3b97..c066c92 100644 --- a/waitress/tests/test_functional.py +++ b/waitress/tests/test_functional.py @@ -1475,6 +1475,7 @@ def read_http(fp): # pragma: no cover try: response_line = fp.readline() except socket.error as exc: + fp.close() # errno 104 is ENOTRECOVERABLE, In WinSock 10054 is ECONNRESET if get_errno(exc) in (errno.ECONNABORTED, errno.ECONNRESET, 104, 10054): raise ConnectionClosed |