diff mercurial/hgweb/wsgicgi.py @ 2558:1120302009d7

hgweb: fix unbundle. After the WSGI changes, even if a push over HTTP succeeds, apache complains about "Premature end of script headers: hgwebdir.cgi" and returns a "HTTP Error 500: Internal Server Error", making the local hg abort. The change to either of the files touched by this patch is enough to fix this, but I think changing both is a more robust solution.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 03 Jul 2006 00:33:19 -0300
parents d0db3462d568
children eb0b4a2d70a9
line wrap: on
line diff
--- a/mercurial/hgweb/wsgicgi.py	Mon Jul 03 00:23:58 2006 -0300
+++ b/mercurial/hgweb/wsgicgi.py	Mon Jul 03 00:33:19 2006 -0300
@@ -27,6 +27,7 @@
 
     headers_set = []
     headers_sent = []
+    out = sys.stdout
 
     def write(data):
         if not headers_set:
@@ -35,13 +36,13 @@
         elif not headers_sent:
              # Before the first output, send the stored headers
              status, response_headers = headers_sent[:] = headers_set
-             sys.stdout.write('Status: %s\r\n' % status)
+             out.write('Status: %s\r\n' % status)
              for header in response_headers:
-                 sys.stdout.write('%s: %s\r\n' % header)
-             sys.stdout.write('\r\n')
+                 out.write('%s: %s\r\n' % header)
+             out.write('\r\n')
 
-        sys.stdout.write(data)
-        sys.stdout.flush()
+        out.write(data)
+        out.flush()
 
     def start_response(status,response_headers,exc_info=None):
         if exc_info: