summaryrefslogtreecommitdiffstats
path: root/Lib/CGIHTTPServer.py
diff options
context:
space:
mode:
authorSteve Holden <steve@holdenweb.com>2003-01-08 18:53:18 (GMT)
committerSteve Holden <steve@holdenweb.com>2003-01-08 18:53:18 (GMT)
commit8a978f7cdeaf7c96ef5b53a501bcd689bcd90820 (patch)
treeabc520b4adb41b9630f16b85b859ed4441923676 /Lib/CGIHTTPServer.py
parent472e7db5c0455b6d80326d75f619f7c0bfb3070f (diff)
downloadcpython-8a978f7cdeaf7c96ef5b53a501bcd689bcd90820.zip
cpython-8a978f7cdeaf7c96ef5b53a501bcd689bcd90820.tar.gz
cpython-8a978f7cdeaf7c96ef5b53a501bcd689bcd90820.tar.bz2
Fix bug 427345 [related to IE's additional input on POST request].
Diffstat (limited to 'Lib/CGIHTTPServer.py')
-rw-r--r--Lib/CGIHTTPServer.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index b3f922b..f14ebba 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -26,6 +26,7 @@ import sys
import urllib
import BaseHTTPServer
import SimpleHTTPServer
+import select
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
@@ -199,6 +200,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
if pid != 0:
# Parent
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:
self.log_error("CGI script exit status %#x", sts)
return
@@ -244,6 +248,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
if self.command.lower() == "post" and nbytes > 0:
data = self.rfile.read(nbytes)
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()
shutil.copyfileobj(fo, self.wfile)
if self.have_popen3: