diff mercurial/hgweb/hgweb_mod.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 f4b7d71c1c60
children 0875cda033fd
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -932,10 +932,11 @@ class hgweb(object):
 
                 try:
                     ret = self.repo.addchangegroup(fp, 'serve')
-                    req.write('%d\n' % ret)
-                    req.write(sys.stdout.getvalue())
                 finally:
+                    val = sys.stdout.getvalue()
                     sys.stdout = old_stdout
+                req.write('%d\n' % ret)
+                req.write(val)
             finally:
                 lock.release()
         finally: