summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2014-05-16 15:19:58 -0400
committerChris McDonough <chrism@plope.com>2014-05-16 15:19:58 -0400
commit106b196dae40b0c49f3138d0fd2ffe0ff130a58d (patch)
treedf0f4a431f6ecfffaab4011e1bc81a3901db7fe8
parent2269e13ff71a66de1f1b69ce096b65a055654487 (diff)
downloadwaitress-fix.filewrapper_leak.tar.gz
add note to changes, expand commentfix.filewrapper_leak
-rw-r--r--CHANGES.txt7
-rw-r--r--waitress/task.py6
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 7fa486b..9a9e6a3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,13 @@
Unreleased
----------
+- Give the WSGI app_iter generated when ``wsgi.file_wrapper`` is used
+ (ReadOnlyFileBasedBuffer) a ``close`` method. Do not call ``close`` on an
+ instance of such a class when it's used as a WSGI app_iter, however. This is
+ part of a fix which prevents a leakage of file descriptors; the other part of
+ the fix was in WebOb
+ (https://github.com/Pylons/webob/commit/951a41ce57bd853947f842028bccb500bd5237da).
+
- Allow trusted proxies to override ``wsgi.url_scheme`` via a request header,
``X_FORWARDED_PROTO``. Allows proxies which serve mixed HTTP / HTTPS
requests to control signal which are served as HTTPS. See
diff --git a/waitress/task.py b/waitress/task.py
index 8dbb872..28c91c7 100644
--- a/waitress/task.py
+++ b/waitress/task.py
@@ -393,7 +393,11 @@ class WSGITask(Task):
if app_iter.__class__ is ReadOnlyFileBasedBuffer:
# NB: do not put this inside the below try: finally: which closes
- # the app_iter; we need to defer closing the underlying file
+ # the app_iter; we need to defer closing the underlying file. It's
+ # intention that we don't want to call ``close`` here if the
+ # app_iter is a ROFBB; the buffer (and therefore the file) will
+ # eventually be closed within channel.py's _flush_some or
+ # handle_close instead.
cl = self.content_length
size = app_iter.prepare(cl)
if size: