On Tue, Mar 17, 2009 at 12:13:34PM +0100, Patrice Pillot wrote:
> Mark Hindley a écrit :
> > I am at a slight disadvantage here as I can't actually reproduce this
> > behaviour which makes debugging and testing difficult.
> > 
> > Could you try this patch instead and see if it is better?
> > 
> 
> Well, this doesn't work any better. But as I tried your patch it
> happened I discovered something that might be of interest.

Can you try this one instead. It addresses the only problem  can see
with the logs.


diff --git a/apt-cacher b/apt-cacher
index 48741b6..feee576 100755
--- a/apt-cacher2
+++ b/apt-cacher2
@@ -844,14 +844,20 @@ sub return_file {
                $headstring .= 'Connection: '.($concloseflag ? 'Close' : 
'Keep-Alive')."\r\n";
 
                # keep only parts interesting for apt
-               for(<$in>) {
-                   if(/^Last-Modified|Content|Accept|ETag|Age/) {
-                       $headstring.=$_;
-                       if(/^Content-Length:\ *(\d+)/) {
-                           $explen=$1;
+               if ($code==200) {
+                   for(<$in>) {
+                       chomp;
+                       if(/^Last-Modified|Content|Accept|ETag|Age/) {
+                           $headstring.=$_."\r\n";
+                           if(/^Content-Length:\ *(\d+)/) {
+                               $explen=$1;
+                           }
                        }
                    }
                }
+               else {
+                   $headstring.="Content-Length: 0\r\n";
+               }
                close($in);
                &release_global_lock;
 
@@ -861,7 +867,7 @@ sub return_file {
                debug_message("Header sent: $headstring");
 
                # Stop after sending the header with errors
-               return if HTTP::Status::is_server_error($code);
+               return if HTTP::Status::is_error($code);
 
            }
            else {



-- 
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