mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
Make sure we update remaining length, and update test to catch the edge case
this fixes.
This commit is contained in:
parent
5c5556d915
commit
dac0080ea2
@ -125,7 +125,8 @@ class _LengthLimitedCollector:
|
||||
f: BytesIO = field(factory=BytesIO)
|
||||
|
||||
def __call__(self, data: bytes):
|
||||
if len(data) > self.remaining_length:
|
||||
self.remaining_length -= len(data)
|
||||
if self.remaining_length < 0:
|
||||
raise ValueError("Response length was too long")
|
||||
self.f.write(data)
|
||||
|
||||
|
@ -337,7 +337,7 @@ class CustomHTTPServerTests(SyncTestCase):
|
||||
``http_client.limited_content()`` returns the body if it is less than
|
||||
the max length.
|
||||
"""
|
||||
for at_least_length in (length, length + 1, length + 1000):
|
||||
for at_least_length in (length, length + 1, length + 1000, length + 100_000):
|
||||
response = result_of(
|
||||
self.client.request(
|
||||
"GET",
|
||||
|
Loading…
Reference in New Issue
Block a user