This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vsbogd
Recipients georg.brandl, shajianrui, vsbogd
Date 2019-06-17.09:52:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560765161.67.0.617712255458.issue37301@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-06-17 09:52:41vsbogdsetrecipients: + vsbogd, georg.brandl, shajianrui
2019-06-17 09:52:41vsbogdsetmessageid: <1560765161.67.0.617712255458.issue37301@roundup.psfhosted.org>
2019-06-17 09:52:41vsbogdlinkissue37301 messages
2019-06-17 09:52:41vsbogdcreate