Hello.

I've tried to set up apt-cacher on one of my system, using exactly same 
configuration as already works on my other system.

I faced problem that attempts to download packages hang.

I've started to look into code, and found the following. Apt-get isseas 
http GET request:

GET http://my.host:9999/debian/...

Inside apt-cacher, '$path' variable gets all that line, with 
http://my.host:9999/ prefix included.

Later, when the following code works:

        # tolerate CGI specific junk and two slashes in the beginning
        $path =~ s!^/apt-cacher\??/!/!;
        $path =~ s!^//!/!;
        $path =~ s!^http://!!; # allow proxy style

so $path is now "my.host:9999/debian/..."

Then, after

        my($host,$uri) = ($path =~ m#^/?([^/]+)(/.+)#);

line is executed, $host becomes "my.host:9999" and $uri 
becomes "/debian/..."

Which is obviously wrong, because $host here should be not the host of 
apt-cacher itself, but first part of the path (i.e. host from where to 
download).

So later apt-cacher tries to connect to itself. While processing this 
request, it detects that file in question is already being downloaded, and 
just hangs.

I was able to fix the situation by replacing
        $path =~ s!^http://!!; # allow proxy style
with
        $path =~ s!^http://[^/]*!!; # allow proxy style

I have no idea why the code works in some situations and does not work in 
others.

Attachment: pgpiKOfwLGvF5.pgp
Description: PGP signature

Reply via email to