[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit d9f9913e8987d020bf16d19d0dad1578e94d5a92
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits