[tor-commits] [meek/master] Make WSGI LimitedReader.read() work when not given a size.

dcf at torproject.org dcf at torproject.org
Sun Apr 12 05:34:49 UTC 2015


commit d9f9913e8987d020bf16d19d0dad1578e94d5a92
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Apr 9 10:23:30 2015 -0700

    Make WSGI LimitedReader.read() work when not given a size.
    
    It was reading unlimitedly in this case.
---
 wsgi/reflect.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wsgi/reflect.py b/wsgi/reflect.py
index 4a522b4..e9bff42 100644
--- a/wsgi/reflect.py
+++ b/wsgi/reflect.py
@@ -25,7 +25,7 @@ class LimitedReader(object):
     def read(self, size=None):
         if self.n <= 0:
             return ""
-        if size is not None and size > self.n:
+        if size is None or size > self.n:
             size = self.n
         data = self.f.read(size)
         self.n -= len(data)



More information about the tor-commits mailing list