[tor-commits] [flashproxy/master] Add a test for readline limit.

dcf at torproject.org dcf at torproject.org
Fri Aug 31 11:39:36 UTC 2012


commit ed2506d10deaf8979e56ac57be3b8d3dc25e5b7e
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Jul 7 07:48:39 2012 -0700

    Add a test for readline limit.
---
 facilitator-test |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/facilitator-test b/facilitator-test
index bdc064d..4e2ec56 100755
--- a/facilitator-test
+++ b/facilitator-test
@@ -41,5 +41,17 @@ class FacilitatorTest(unittest.TestCase):
         time.sleep(0.3)
         self.assertRaises(socket.error, s.send, "w")
 
+    def test_readline_limit(self):
+        """Test that reads won't buffer indefinitely."""
+        s = self.gimme_socket()
+        buflen = 0
+        try:
+            while buflen + 1024 < 200000:
+                s.send("X" * 1024)
+                buflen += 1024
+            self.fail("should have raised a socket error")
+        except socket.error:
+            pass
+
 if __name__ == "__main__":
     unittest.main()





More information about the tor-commits mailing list