package apt-cacher
merge 682437
thanks

On Thu, Aug 16, 2012 at 01:58:35PM +0300, Arie Skliarouk wrote:
> I tried your patch. The warnings in /var/log/apt-cacher/error.log
> disappeared, but apt-get on the client machine still was not able to
> download indexes:

I think this is a duplicate of #682437, but the patch in there is not 
sufficient as it only covers 200 responses. I think your server is 
returning Transfer-Encoding: chunked for a 404 error!

Anyway, this patch fixes it for me. Could you confirm please?.

Thanks

Mark


diff --git a/apt-cacher b/apt-cacher
index a8affc0..6e5bd47 100755
--- a/apt-cacher
+++ b/apt-cacher
@@ -1624,10 +1628,21 @@ sub libcurl {
                    if ($response->code) {
                        $cfg->{debug} && debug_message('libcurl reading of 
headers complete: ' . $response->code);
                        chomp_message($response);
+                       # Handle chunked
+                       if ($response->header('Transfer-Encoding') && lc 
$response->header('Transfer-Encoding') eq 'chunked') {
+                           # libcurl handles chunked transfer, so just remove 
the Transfer-Encoding header
+                           # so it doesn't get passed to clients and ignore 
any Content-Length header
+                           debug_message('Handle Transfer-Encoding: chunked');
+                           $response->remove_header('Transfer-Encoding');
+                           $response->remove_header('Content-Length');
+                       }
+                                       
                        if ($curl_request->method eq 'GET' && 
$response->is_success) {
+
                            # Check space
                            my $statfs;
                            if (defined($statfs = df($cfg->{'cache_dir'}, 1)) &&
+                               $response->header('Content-Length') &&
                                $response->header('Content-Length') >=  
$statfs->{bavail} ||
                                $cfg->{_disk_usage_limit} && $statfs->{used} + 
$response->header >= $cfg->{_disk_usage_limit}) {
                                info_message('ALARM: Insuffient space for 
Content-Length: '.


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