On Mon, May 20, 2013 at 03:25:21PM +0100, Mark Hindley wrote: > On Sun, May 19, 2013 at 07:37:44PM +0800, Michael Deegan wrote: > > Package: apt-cacher > > Version: 1.7.6 > > Severity: normal > > > > Dear Maintainer, > > > > It appears that when an InRelease file disappears (as seems to have > > happened to wheezy following its release), apt-cacher returns the old file > > instead, albeit with the 404 message body overwriting the beginning of the > > file: > > Thanks > > > A glance at the code around line 770 suggests that all errors result in the > > cached file being returned (and an 'OFFLINE' status). I'm not convinced > > that this is a good idea, at least with 404s. :P > > Yes, agreed. This should only apply to Server errors. Try this patch:
Sorry, there was a mistake in that. I think this is better. Mark commit c07dea544c573405959fb743e177773bd3dfe712 Author: Mark Hindley <m...@hindley.org.uk> Date: Mon May 20 15:19:07 2013 +0100 Reorder handling of If-Modified request response. Client errors also count as EXPIRED diff --git a/apt-cacher b/apt-cacher index 3626738..c3816f0 100755 --- a/apt-cacher +++ b/apt-cacher @@ -758,19 +758,20 @@ sub handle_connection { $ifmod_request->header('If-Modified-Since' => $since); $response = fetch_store($ifmod_request, $cache); $cfg->{debug} && debug_message('Got '.$response->code); - if ($response->code == 200) { - $cache->{status} = 'EXPIRED'; - $cfg->{debug} && debug_message($cache->{status}); - } - elsif ($response->code == 304) { + if ($response->code == 304) { # Update cached Date and Client-Date headers $cached_response->date($response->date || time); write_header($cache->{header}, $cached_response); } - elsif ($response->is_error) { + elsif (HTTP::Status::is_server_error($response->code)) { # Offline, used cached $cache->{status} = 'OFFLINE'; } + else { # Success or client error + $cache->{status} = 'EXPIRED'; + $cfg->{debug} && debug_message($cache->{status}); + } + } # Still don't know what to do? # use HTTP timestamping/ETag -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org