vsbogd <[email protected]> added the comment:
Yeah, I have seen this comment as well. As I see this code for the first time I
am not very familiar with it.
It seems that this explanation is related to the case when non-Python CGI
script is executed:
os.dup2(self.rfile.fileno(), 0)
os.dup2(self.wfile.fileno(), 1)
os.execve(scriptfile, args, env)
https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L1176-L1178
On one hand the comment seems reasonable: as fileno is duped one cannot just
read from it ahead of time. On the other hand few lines earlier one can see:
# throw away additional data [see bug #427345]
while select.select([self.rfile], [], [], 0)[0]:
if not self.rfile.read(1):
break
https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L1163-L1166
which also seems like reading ahead of time.
My opinion this case should be tested after fix and if it works then fix can be
applied without hesitation.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com