On Sat, Jan 03, 2009 at 11:05:35AM +0100, Robert Luberda wrote:
> Package: apt-cacher
> Version: 1.6.7
> Severity: important
> Tags: patch
> 
> Hi,
> 
> CGI mode doesn't work. After turning debugging on, I've got the
> following infos in error.log file:
> Sat Jan  3 10:21:02 2009|debug [8421]: New CGI connection
> Sat Jan  3 10:21:02 2009|debug [8421]: client is localhost
> Sat Jan  3 10:21:02 2009|debug [8421]: Client 127.0.0.1 passed access control 
> rules
> Sat Jan  3 10:21:02 2009|debug [8421]: Processing a new request line
> Sat Jan  3 10:21:02 2009|debug [8421]: got: GET 
> /ftp.pl.debian.org/debian/dists/sid/Release.gpg
> Sat Jan  3 10:21:02 2009|debug [8421]: Processing a new request line
> Sat Jan  3 10:21:02 2009|debug [8421]: got:
> Sat Jan  3 10:21:02 2009|debug [8421]: Checking host localhost in absolute URI
> Sat Jan  3 10:21:02 2009|debug [8421]: Host in Absolute URI is not this server

^^^^^^^ This is the error. localhost should be recognised as the local server
and ignored.

> Sat Jan  3 10:21:02 2009|debug [8421]: Resolved request is 
> /localhost//ftp.pl.debian.org/debian/di
> Sat Jan  3 10:21:02 2009|debug [8421]: new index file: 
> localhost_ftp.pl.debian.org_debian_dists_si
> Sat Jan  3 10:21:02 2009|debug [8421]: looking for 
> /var/cache/apt-cacher/packages/localhost_ftp.pl.
> Sat Jan  3 10:21:02 2009|debug [8421]: known as index file: Release.gpg
> Sat Jan  3 10:21:02 2009|debug [8421]: Entering critical section : file 
> download decision
> Sat Jan  3 10:21:02 2009|debug [8421]: file does not exist or download 
> required, forking fetcher
> Sat Jan  3 10:21:02 2009|debug [8421]: MISS
> Sat Jan  3 10:21:02 2009|debug [8422]: Exiting critical section
> Sat Jan  3 10:21:02 2009|debug [8422]: fetcher: try to fetch 
> http://localhost/ftp.pl.debian.org/de
> Sat Jan  3 10:21:02 2009|debug [8422]: download agent: getting 
> http://localhost/ftp.pl.debian.org/
> 
> Note that it should be trying to download from  http://ftp.pl.debian.org not
> from http://localhost.
> 
> The following patch fixes this issue for me:
> 
> --- apt-cacher.distrib        2008-11-06 21:46:45.000000000 +0100
> +++ apt-cacher        2009-01-03 10:32:49.000000000 +0100
> @@ -368,7 +368,7 @@
>           if(/^$/) {
>               if(defined($testpath)) {
>                   # done reading request
> -                 $testpath="http://$ENV{SERVER_NAME}/$testpath"; if $mode && 
> $mode eq 'cgi';
> +                 # $testpath="http://$ENV{SERVER_NAME}/$testpath"; if $mode 
> && $mode eq 'cgi';
>                   $path=$testpath;
>                   last CLIENTLINE;
>               }
> 

Thanks for this.

I don't want to use this patch as it will break transparent proxying in
CGI mode. Could you try the patch below and tell me if it is fixed

Thanks

Mark


commit 7d434ff05b1aed07f17c82c755f20ee9f8782e24
Author: Mark Hindley <m...@hindley.org.uk>
Date:   Fri Oct 31 15:01:54 2008 +0000

    Set daemon_port from environment in CGI mode

diff --git a/apt-cacher2 b/apt-cacher2
index 75a777f..511d6b7 100755
--- a/apt-cacher2
+++ b/apt-cacher2
@@ -261,6 +261,7 @@ sub handle_connection {
        # identify client in the logs.
        if (exists $ENV{REMOTE_ADDR}){ # CGI/apt-cacher-cleanup mode
            $client=$ENV{REMOTE_ADDR};
+           $cfg->{daemon_port}=$ENV{SERVER_PORT};
        }
        else { # inetd mode
            $client='INETD';



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to