[Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.20.8.3,1.20.8.4

holdenweb@users.sourceforge.net holdenweb@users.sourceforge.net
Wed, 08 Jan 2003 13:17:52 -0800


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

Modified Files:
      Tag: release22-maint
	CGIHTTPServer.py 
Log Message:
Retrospectively fix code to handle IE's additional characters on certain
web transactions more gracefully (through a fairly ugly hack). See bugs
430610 and 427345.


Index: CGIHTTPServer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v
retrieving revision 1.20.8.3
retrieving revision 1.20.8.4
diff -C2 -d -r1.20.8.3 -r1.20.8.4
*** CGIHTTPServer.py	20 Aug 2002 23:59:33 -0000	1.20.8.3
--- CGIHTTPServer.py	8 Jan 2003 21:17:35 -0000	1.20.8.4
***************
*** 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)