[PATCH] httprepo: make sure we have auth before sending large bundles
Augie Fackler
durin42 at gmail.com
Sat Sep 26 11:17:42 CDT 2009
On Sep 26, 2009, at 1:58 AM, Dirkjan Ochtman wrote:
> On Sat, Sep 26, 2009 at 05:01, <durin42 at gmail.com> wrote:
>> # HG changeset patch
>> # User Augie Fackler <durin42 at gmail.com>
>> # Date 1253039420 18000
>> # Node ID 50883d84b6583c3fc8ae1408923b76ebb2c6e0eb
>> # Parent 32ec707991726bd58b9190862ab98f204797eea4
>> 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,12 +211,23 @@
>>
>> tempname = changegroup.writebundle(cg, None, type)
>> fp = url.httpsendfile(tempname, "rb")
>> +
>> + headsparam = ' '.join(map(hex, heads))
>> + if len(fp) > 1024 or True:
>
> Debugging?
Whoops! Thanks! New patch inbound.
>
> Cheers,
>
> Dirkjan
>
>> + self.ui.debug('push empty bundle to check for auth\n')
>> + # TODO check what comes back, we can fast-fail for
>> certain non-push
>> + # conditions (ssl required comes to mind).
>> + resp = self.do_read('unbundle', data='',
>> + headers={'Content-Type':
>> 'application/octet-stream'},
>> + heads=headsparam)
>> + resp_code, output = resp.split('\n', 1)
>> + self.ui.status(output)
>> try:
>> try:
>> resp = self.do_read(
>> 'unbundle', data=fp,
>> headers={'Content-Type': 'application/octet-
>> stream'},
>> - heads=' '.join(map(hex, heads)))
>> + heads=headsparam)
>> resp_code, output = resp.split('\n', 1)
>> try:
>> ret = int(resp_code)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
More information about the Mercurial-devel
mailing list