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

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



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



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