[issue1379] Clone large repositories through a proxy fails

azraiyl mercurial-bugs at selenic.com
Wed Nov 5 09:37:59 CST 2008

New submission from azraiyl <azraiyl at gmail.com>:

When I clone http://hg.mozilla.org/mozilla-central/ at home with Mercurial 1.0.2
I don't have any problems (compressed archive is about 102 MB). When I clone the
same repository at work, I get the following error:

zlib.error: Error -3 while decompressing: invalid code lengths set

When I clone the repository http://hg.mozilla.org/ast/ at work I have no problems.

After analyzing it a bit I discovered that the problem is that the data from the
server is wrong. I started debugging the function filechunkiter. f.url is:


and f.headers is (maybe proxy version matters here):

Date: Wed, 05 Nov 2008 15:11:37 GMT
Server: Apache/2.2.3 (Red Hat)
Content-Type: application/mercurial-0.1
Via: 1.0 REMOVED.org:8080 (squid/2.6.STABLE20)
Proxy-Connection: close

Downloading any file with FireFox, Internet Explorer or downloading Debian
packages through this proxy was never a problem (ISOs with 600MB+ e.g.). When I
download the previous URL with FireFox I can see the same output (after
modifiend the source to see it) as when I "download" it with clone. But when I
look at the output I see a weird string in the first bytes.

x\x9c\xb4\xbd\xbbn$HTTP/1.1 200 Script output follows\r\nDate: Wed, 05 Nov 2008
15:19:10 GMT\r\nServer: Apache/2.2.3 (Red Hat)\r\nContent-Type:

When I add an awfull hack that checks if the first packet includes this header
and strips everything before (and including) \r\n\r\n everything works well. BTW
I have replaced the keepalive handler with the standard handler, but that
doesn't change anything. The problem exist on Windows and Linux.

My conclusion: If there is an bug in mercurial (only disovered this with
mercurial so far in our company) if is on the server side and not the client side.

messages: 7843
nosy: azraiyl
priority: bug
status: unread
title: Clone large repositories through a proxy fails

Mercurial issue tracker <mercurial-bugs at selenic.com>

More information about the Mercurial-devel mailing list