]> granicus.if.org Git - python/commitdiff
Apply two small changes to the Windows code, according to SF bug
authorGuido van Rossum <guido@python.org>
Tue, 7 Aug 2001 19:55:10 +0000 (19:55 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 7 Aug 2001 19:55:10 +0000 (19:55 +0000)
#427345.  These are supposed to support binary data and avoid
buffering problems on Windows.

Lib/CGIHTTPServer.py

index d6afaa105f3a0f72f70e2b33309969c4a5e373ff..809cab73c8dc1d0dc9a28cc991d6788ac7375105 100644 (file)
@@ -223,7 +223,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
                 if interp.lower().endswith("w.exe"):
                     # On Windows, use python.exe, not python.exe
                     interp = interp[:-5] = interp[-4:]
-                cmdline = "%s %s" % (interp, cmdline)
+                cmdline = "%s -u %s" % (interp, cmdline)
             if '=' not in query and '"' not in query:
                 cmdline = '%s "%s"' % (cmdline, query)
             self.log_error("command: %s", cmdline)
@@ -231,7 +231,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
                 nbytes = int(length)
             except:
                 nbytes = 0
-            fi, fo = os.popen2(cmdline)
+            fi, fo = os.popen2(cmdline, 'b')
             if self.command.lower() == "post" and nbytes > 0:
                 data = self.rfile.read(nbytes)
                 fi.write(data)