[Python-checkins] CVS: python/dist/src/Lib CGIHTTPServer.py,1.17,1.17.4.1

Anthony Baxter anthonybaxter@users.sourceforge.net
Tue, 04 Dec 2001 20:39:43 -0800


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

Modified Files:
      Tag: release21-maint
	CGIHTTPServer.py 
Log Message:
backport 1.18, 1.19, 1.20:
--
Apply two small changes to the Windows code, according to SF bug
#427345.  These are supposed to support binary data and avoid
buffering problems on Windows.
--
SF patch #467430.
- replace some log_error() calls with log_message()
- flush self.rfile before forking too (hope this works on Windows)
--
Fix two typos, one noted by Noah Spurrier in SF bug #475166, the
second noted after a second's thought about what the next line should
do. :-(



Index: CGIHTTPServer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v
retrieving revision 1.17
retrieving revision 1.17.4.1
diff -C2 -d -r1.17 -r1.17.4.1
*** CGIHTTPServer.py	2001/02/09 12:10:26	1.17
--- CGIHTTPServer.py	2001/12/05 04:39:41	1.17.4.1
***************
*** 193,196 ****
--- 193,197 ----
                  args.append(decoded_query)
              nobody = nobody_uid()
+             self.rfile.flush() # Always flush before forking
              self.wfile.flush() # Always flush before forking
              pid = os.fork()
***************
*** 222,236 ****
                  interp = sys.executable
                  if interp.lower().endswith("w.exe"):
!                     # On Windows, use python.exe, not python.exe
!                     interp = interp[:-5] = interp[-4:]
!                 cmdline = "%s %s" % (interp, cmdline)
              if '=' not in query and '"' not in query:
                  cmdline = '%s "%s"' % (cmdline, query)
!             self.log_error("command: %s", cmdline)
              try:
                  nbytes = int(length)
              except:
                  nbytes = 0
!             fi, fo = os.popen2(cmdline)
              if self.command.lower() == "post" and nbytes > 0:
                  data = self.rfile.read(nbytes)
--- 223,237 ----
                  interp = sys.executable
                  if interp.lower().endswith("w.exe"):
!                     # On Windows, use python.exe, not pythonw.exe
!                     interp = interp[:-5] + interp[-4:]
!                 cmdline = "%s -u %s" % (interp, cmdline)
              if '=' not in query and '"' not in query:
                  cmdline = '%s "%s"' % (cmdline, query)
!             self.log_message("command: %s", cmdline)
              try:
                  nbytes = int(length)
              except:
                  nbytes = 0
!             fi, fo = os.popen2(cmdline, 'b')
              if self.command.lower() == "post" and nbytes > 0:
                  data = self.rfile.read(nbytes)
***************
*** 242,246 ****
                  self.log_error("CGI script exit status %#x", sts)
              else:
!                 self.log_error("CGI script exited OK")
  
          else:
--- 243,247 ----
                  self.log_error("CGI script exit status %#x", sts)
              else:
!                 self.log_message("CGI script exited OK")
  
          else:
***************
*** 267,271 ****
                  self.log_error("CGI script exit status %s", str(sts))
              else:
!                 self.log_error("CGI script exited OK")
  
  
--- 268,272 ----
                  self.log_error("CGI script exit status %s", str(sts))
              else:
!                 self.log_message("CGI script exited OK")