Skip to content

Commit 3d1b733

Browse files
Simply allow read() to fail with timeout.
1 parent 4bfd8b4 commit 3d1b733

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎Lib/http/server.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,14 +1290,16 @@ def run_cgi(self):
12901290
if self.command.lower() == "post" and nbytes > 0:
12911291
cursize = 0
12921292
data = self.rfile.read(min(nbytes, _MIN_READ_BUF_SIZE))
1293-
while (len(data) < nbytes and len(data) != cursize and
1294-
select.select([self.rfile._sock], [], [], self.timeout)[0]):
1293+
while len(data) < nbytes and len(data) != cursize:
12951294
cursize = len(data)
12961295
# This is a geometric increase in read size (never more
1297-
# than doubling our the current length of data per loop
1296+
# than doubling out the current length of data per loop
12981297
# iteration).
12991298
delta = min(cursize, nbytes - cursize)
1300-
data += self.rfile.read(delta)
1299+
try:
1300+
data += self.rfile.read(delta)
1301+
except TimeoutError:
1302+
break
13011303
else:
13021304
data = None
13031305
# throw away additional data [see bug #427345]

0 commit comments

Comments
 (0)