[PATCH 2 of 2] hgweb: add support for a new fastauth capability for unbundle

Augie Fackler durin42 at gmail.com
Sat Feb 6 06:33:45 CST 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1265407513 21600
# Node ID 561e3fcd990e11d5a44025a1eaf786cb42d12648
# Parent  f983f04cfbd891c862b618c41e967decfa507c4b
hgweb: add support for a new fastauth capability for unbundle

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -112,12 +112,15 @@
             if query:
                 raise ErrorResponse(HTTP_NOT_FOUND)
             try:
+                expecting_continue = (req.env.get('HTTP_EXPECT', '') == '100-Continue')
+
                 if cmd in perms:
                     try:
                         self.check_perm(req, perms[cmd])
                     except ErrorResponse, inst:
                         if cmd == 'unbundle':
-                            req.drain()
+                            if not expecting_continue:
+                                req.drain()
                         raise
                 method = getattr(protocol, cmd)
                 return method(self.repo, req)
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -21,7 +21,8 @@
 ]
 
 HGTYPE = 'application/mercurial-0.1'
-basecaps = 'lookup changegroupsubset branchmap'.split()
+# fastauth means we understand 100-continue expectations
+basecaps = 'lookup changegroupsubset branchmap fastauth'.split()
 
 def lookup(repo, req):
     try:
diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out
--- a/tests/test-hgweb-commands.out
+++ b/tests/test-hgweb-commands.out
@@ -845,7 +845,7 @@
 % capabilities
 200 Script output follows
 
-lookup changegroupsubset branchmap unbundle=HG10GZ,HG10BZ,HG10UN% heads
+lookup changegroupsubset branchmap fastauth unbundle=HG10GZ,HG10BZ,HG10UN% heads
 200 Script output follows
 
 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe


More information about the Mercurial-devel mailing list