[PATCH] httprepo: make sure we have auth before sending large bundles
durin42 at gmail.com
durin42 at gmail.com
Wed Sep 16 22:54:08 CDT 2009
# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1253039420 18000
# Node ID d63d385f0f1c542bb789fc592455ed50db138393
# Parent de414835d1405ccec77f6cc5211859368ae8274f
httprepo: make sure we have auth before sending large bundles
Send an empty bundle to the server to verify we are properly
authenticated before sending a large bundle. This prevents doing an
unbundle of many megabytes and then immediately do it again with auth.
diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -211,6 +211,13 @@
tempname = changegroup.writebundle(cg, None, type)
fp = url.httpsendfile(tempname, "rb")
+
+ if len(fp) > 1024:
+ self.ui.debug('push empty bundle to check for auth\n')
+ self.do_read('unbundle', data=''
+ headers={'Content-Type': 'application/octet-stream'},
+ heads=' '.join(map(hex, self.heads())))
+
try:
try:
resp = self.do_read(
More information about the Mercurial-devel
mailing list