diff mercurial/hgweb.py @ 751:0b245edec124

When pulling from a non hg repository URL (e.g. http://www.kernel.org/hg) you geta pretty obscure error (zlib: uknown compression type). The attached patch modifies hgweb.py and hg.py to supply and check a 'Content-type: application/hg-0.1' HTTP header for the branches, between and changegroup commands, so that we know it's a proper hg repo before snarfing the input. Comments appreciated!
author Muli Ben-Yehuda <mulix@mulix.org>
date Thu, 21 Jul 2005 18:18:43 -0500
parents b50cd98bb7e4
children 8760d0c83b9b
line wrap: on
line diff
--- a/mercurial/hgweb.py	Thu Jul 21 15:29:35 2005 -0500
+++ b/mercurial/hgweb.py	Thu Jul 21 18:18:43 2005 -0500
@@ -657,12 +657,12 @@
             write(self.filelog(args['file'][0], args['filenode'][0]))
 
         elif args['cmd'][0] == 'heads':
-            httphdr("text/plain")
+            httphdr("application/mercurial-0.1")
             h = self.repo.heads()
             sys.stdout.write(" ".join(map(hex, h)) + "\n")
 
         elif args['cmd'][0] == 'branches':
-            httphdr("text/plain")
+            httphdr("application/mercurial-0.1")
             nodes = []
             if args.has_key('nodes'):
                 nodes = map(bin, args['nodes'][0].split(" "))
@@ -670,7 +670,7 @@
                 sys.stdout.write(" ".join(map(hex, b)) + "\n")
 
         elif args['cmd'][0] == 'between':
-            httphdr("text/plain")
+            httphdr("application/hg-0.1")
             nodes = []
             if args.has_key('pairs'):
                 pairs = [ map(bin, p.split("-"))
@@ -679,7 +679,7 @@
                 sys.stdout.write(" ".join(map(hex, b)) + "\n")
 
         elif args['cmd'][0] == 'changegroup':
-            httphdr("application/hg-changegroup")
+            httphdr("application/mercurial-0.1")
             nodes = []
             if self.viewonly:
                 return