summaryrefslogtreecommitdiff
path: root/tests/integration/test_keepalive.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/test_keepalive.py')
-rw-r--r--tests/integration/test_keepalive.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/integration/test_keepalive.py b/tests/integration/test_keepalive.py
index 2c724fc..f9aa468 100644
--- a/tests/integration/test_keepalive.py
+++ b/tests/integration/test_keepalive.py
@@ -107,6 +107,22 @@ class KeepAlive(TrackerTestCase):
107 finally: 107 finally:
108 c.close() 108 c.close()
109 109
110 def test_a_tiny_split_request_does_not_overread(self):
111 """A request that arrives in pieces and completes as a buffer shorter
112 than the dispatch literals (\"GET /\" etc.) used to read past the
113 exactly sized buffer. It must be rejected without a sanitizer hit."""
114 c = self.tracker.connect()
115 try:
116 c.sock.sendall(b"\r\n")
117 time.sleep(0.05)
118 c.sock.sendall(b"\r\n") # completes as a 4-byte buffer
119 time.sleep(0.1)
120 finally:
121 c.close()
122 # the tracker must still answer; tearDown's stop() surfaces any sanitizer abort
123 answer = self.tracker.announce(self.hash_for("after-tiny"), port=6881, left=0)
124 self.assertNotIn(b"failure reason", answer, "the tracker stopped serving after a tiny request")
125
110 def test_a_split_request_answered_by_a_worker_does_not_spin(self): 126 def test_a_split_request_answered_by_a_worker_does_not_spin(self):
111 """A reply that a worker produces does not go through the send path, 127 """A reply that a worker produces does not go through the send path,
112 so the request stays in the buffer the read loop is reading. The loop 128 so the request stays in the buffer the read loop is reading. The loop