Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Lib/test/test_httpservers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,16 @@ def test_large_content_length(self):
self.assertEqual(res.read(), b'%d %d' % (size, size) + self.linesep)

def test_large_content_length_truncated(self):
with support.swap_attr(self.request_handler, 'timeout', support.LOOPBACK_TIMEOUT):
timeout = support.LOOPBACK_TIMEOUT
if not hasattr(os, 'fork'):
# On Windows, request() waits for the entire timeout; the default
# LOOPBACK_TIMEOUT (10s) is too long for 40 repetitions.
# Use a fraction of that (for slow machines), or .001 (in case
# LOOPBACK_TIMEOUT is cunfigured to be smaller).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# LOOPBACK_TIMEOUT is cunfigured to be smaller).
# LOOPBACK_TIMEOUT is configured to be smaller).

timeout = max(timeout / 100, 0.001)
# (On Unix, request() returns early so a large LOOPBACK_TIMEOUT
# isn't an issue.)
with support.swap_attr(self.request_handler, 'timeout', timeout):
for w in range(18, 65):
size = 1 << w
headers = {'Content-Length' : str(size)}
Expand Down
Loading