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

Bug#795284: troubles with range requests



Control: severity 795284 important

On Tue, 25 Aug 2015 15:04:29 +0100 Mark Hindley <mark@hindley.org.uk> wrote:
> package apt-cacher
> reassign 795284 apt
> thanks
>
> I have looked at this some more and I think apt-cacher is following the spec
> correctly. It seems as if apt-get doesn't realise that the 416 response with the
> Content-Range denominator equal to the size it already has indicates the file is
> complete.
>
> So I am going to reassign to apt.
>
> Apt team, if I have got this analysis wrong, sorry, do point out my error and assign
> back.

Dear apt team,

I came recently to erratical behavior of apt with apt-cacher-ng (not
apt-cacher but similar). Checking the wireshark trace, I see strange
things, see below. For me, what apt's http client is doing there DOES
NOT MAKE MUCH SENSE.

The ancient version, like 10 years ago, used a very simple and effective
trick. It specified If-Range but also a Range which started one byte
_before_ the previous body length. So the server could either return
just a byte or start returning a completely new resource body with a 200
response, no extra rounds needed.

What does the current version do?

It requests the file but the with If-Range (which is okay) and Range
which starts AFTER the body. This obviously causes a code 416 even if
the response body hasn't changed.

In response, apt makes another request, with "If-Modified-Since" from a
day ago - so I guess it has another version in cache, which it takes as
replacement now. It also does not specify the Range. So I guess the
issue 795284 is mostly solved but not fully, we got another pointless
behavior now.

So, the current version behaves better than in 2015, but still worse
than ~10 years ago.

Please restore the original algorithm, which refetched the last byte.
This causes less bandwith waste than doing a second request which will
almost always become necessary.


(local trace, input/output interleaved but you see the point).

GET http://ftp.de.debian.org/debian/dists/testing/InRelease HTTP/1.1
Host: ftp.de.debian.org
Cache-Control: max-age=0
Accept: text/*
Range: bytes=128490-
If-Range: Fri, 08 Oct 2021 14:16:00 GMT
User-Agent: Debian APT-HTTP/1.3 (2.3.9)

HTTP/1.1 416 Requested Range Not Satisfiable
Content-Length: 512
Content-Type: text/html
Date: Fri, 08 Oct 2021 18:26:45 GMT
Server: Debian Apt-Cacher NG/3.7.3

<!DOCTYPE html>
...
href="http://www.unix-ag.uni-kl.de/~bloch/acng/";>Apt-Cacher NG homepage</a></address></html>
GET http://ftp.de.debian.org/debian/dists/testing/InRelease HTTP/1.1
Host: ftp.de.debian.org
Cache-Control: max-age=0
Accept: text/*
If-Modified-Since: Thu, 07 Oct 2021 14:15:24 GMT
User-Agent: Debian APT-HTTP/1.3 (2.3.9)

HTTP/1.1 200 OK
Content-Type: octet/stream
Last-Modified: Fri, 08 Oct 2021 14:16:00 GMT
Content-Length: 128490
X-Original-Source: http://deb.debian.org/debian/dists/testing/InRelease
Date: Fri, 08 Oct 2021 18:26:45 GMT
Server: Debian Apt-Cacher NG/3.7.3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Origin: Debian
Label: Debian
...

Best regards,
Eduard.


Reply to: