mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
Fix bug 427345 [related to IE's additional input on POST request].
This commit is contained in:
parent
472e7db5c0
commit
8a978f7cde
1 changed files with 7 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
import urllib
|
import urllib
|
||||||
import BaseHTTPServer
|
import BaseHTTPServer
|
||||||
import SimpleHTTPServer
|
import SimpleHTTPServer
|
||||||
|
import select
|
||||||
|
|
||||||
|
|
||||||
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
|
|
@ -199,6 +200,9 @@ def run_cgi(self):
|
||||||
if pid != 0:
|
if pid != 0:
|
||||||
# Parent
|
# Parent
|
||||||
pid, sts = os.waitpid(pid, 0)
|
pid, sts = os.waitpid(pid, 0)
|
||||||
|
# throw away additional data [see bug #427345]
|
||||||
|
while select.select([self.rfile], [], [], 0)[0]:
|
||||||
|
waste = self.rfile.read(1)
|
||||||
if sts:
|
if sts:
|
||||||
self.log_error("CGI script exit status %#x", sts)
|
self.log_error("CGI script exit status %#x", sts)
|
||||||
return
|
return
|
||||||
|
|
@ -244,6 +248,9 @@ def run_cgi(self):
|
||||||
if self.command.lower() == "post" and nbytes > 0:
|
if self.command.lower() == "post" and nbytes > 0:
|
||||||
data = self.rfile.read(nbytes)
|
data = self.rfile.read(nbytes)
|
||||||
fi.write(data)
|
fi.write(data)
|
||||||
|
# throw away additional data [see bug #427345]
|
||||||
|
while select.select([self.rfile._sock], [], [], 0)[0]:
|
||||||
|
waste = self.rfile._sock.recv(1)
|
||||||
fi.close()
|
fi.close()
|
||||||
shutil.copyfileobj(fo, self.wfile)
|
shutil.copyfileobj(fo, self.wfile)
|
||||||
if self.have_popen3:
|
if self.have_popen3:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue