[Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.29,1.30

holdenweb@users.sourceforge.net holdenweb@users.sourceforge.net
Wed, 08 Jan 2003 10:53:21 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv10589

Modified Files:
	CGIHTTPServer.py 
Log Message:
Fix bug 427345 [related to IE's additional input on POST request].


Index: CGIHTTPServer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** CGIHTTPServer.py	17 Oct 2002 16:21:35 -0000	1.29
--- CGIHTTPServer.py	8 Jan 2003 18:53:18 -0000	1.30
***************
*** 27,30 ****
--- 27,31 ----
  import BaseHTTPServer
  import SimpleHTTPServer
+ import select
  
  
***************
*** 200,203 ****
--- 201,207 ----
                  # 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)
***************
*** 245,248 ****
--- 249,255 ----
                  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)