[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#710924: apt: HTTP 406 Not Acceptable with alternates breaks update



Package: apt
Version: 0.8.16~exp12ubuntu10.10
Severity: normal
Tags: patch

apt-get update breaks when the server replies with a "HTTP/1.1 406 Not
Acceptable" to a Range/If-Range request.

The proper solution would be to handle the Alternates header in the
response but as this would introduce a lot of additional complexity
the attached patch offers a option to disable Range requests instead.

Please consider applying the patch.

-- Package-specific info:

-- (no /etc/apt/preferences present) --


-- (/etc/apt/sources.list present, but not submitted) --


-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 'precise'), (100, 'precise-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-29-generic (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt depends on:
ii  dpkg            1.16.1.2ubuntu7.1
ii  gnupg           1.4.11-3ubuntu2.2
ii  libapt-pkg4.12  0.8.16~exp12ubuntu10.10
ii  libc6           2.15-0ubuntu10.4
ii  libgcc1         1:4.6.3-1ubuntu5
ii  libstdc++6      4.6.3-1ubuntu5
ii  ubuntu-keyring  2011.11.21.1

apt recommends no packages.

Versions of packages apt suggests:
ii  apt-doc         <none>
ii  aptitude        0.6.6-1ubuntu1.2
ii  bzip2           1.0.6-1
ii  dpkg-dev        1.16.1.2ubuntu7.1
ii  python-apt      0.8.3ubuntu7.1
ii  xz-lzma [lzma]  5.1.1alpha+20110809-3

-- no debconf information
>From e44f7f4b889f8e0113ab1441fbb9c5bbf8a389bc Mon Sep 17 00:00:00 2001
From: Dominik Schulz <dominik.schulz@gauner.org>
Date: Mon, 3 Jun 2013 16:49:15 +0200
Subject: [PATCH] Add Acquire::http::SendRange option

This commit adds the option Acquire::http::SendRange which allows for
disabling sending of Range/If-Range headers. Support for these headers
is not fully implemented and may break the update process. By providing
this option the operator gains control over this behavior while
not changing any defaults for the majority of our users.
---
 methods/http.cc |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/methods/http.cc b/methods/http.cc
index db1085a..baaf7e9 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -740,7 +740,10 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
 
    // Check for a partial file
    struct stat SBuf;
-   if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
+   if (
+      _config->FindB("Acquire::http::SendRange", true) == true
+      && stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0
+   )
    {
       // In this case we send an if-range query with a range header
       sprintf(Buf,"Range: bytes=%lli-\r\nIf-Range: %s\r\n",(long long)SBuf.st_size - 1,
-- 
1.7.9.5


Reply to: