Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] portage: HTTP if-modified-since and compression
Date: Thu, 02 Aug 2012 03:04:51
Message-Id: 5019D1B7.5050807@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] portage: HTTP if-modified-since and compression by Mark Kubacki
1 On 08/01/2012 04:32 PM, Mark Kubacki wrote:
2 > Hi Portage devs,
3 >
4 > The attached patches fix some issues I've noticed as maintainer and
5 > user of Gentoo binhost(s). They're made against master/HEAD and can
6 > easily be backported to 2.1*.
7 >
8 > The first patch enables Portage to skip downloading a remote index if
9 > the local copy is recent enough. E.g., the remote index didn't change
10 > between to "emerge"-runs. This is done by setting "If-Modified-Since"
11 > request-header. The server responds with HTTP code 304 and Portage
12 > doesn't even load a single byte of the (large) index file.
13 >
14 > By the second patch Portage will download remote indices—which are
15 > text-files after all—compressed, if the remote server supports that.
16 > Although de-compression introduces a small latency, this will save
17 > bandwidth and transmission time. If the index needs to be fetched at
18 > all, that is (see the patch above).
19 >
20 > An index' TIMESTAMP entry is set before the corresponding file gets
21 > written. If the difference between TIMESTAMP and modification time
22 > ("mtime") is greater than or the times span one second, remote index
23 > files will be loaded despite the "If-Modified-Since" header. This is
24 > because TIMESTAMP of the local copy is compared with the remote index'
25 > "mtime". The third patch fixes that by setting "mtime" = TIMESTAMP.
26 >
27
28 Thanks, I've applied your patches:
29
30 http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e06cb6d66db37ac7ab77acf65038b1f770c13c96
31 http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=cbebf76d8e5666aad4984f87c2be83d474fe5a7e
32 http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=13abe0398fbe724218c8c9ac2597ebe15d7db7e1
33
34 I made a few trivial change in order to make them compatible with
35 python3. Also, I made it use the old behavior for protocols other than
36 http and https, in order to avoid issues with ftp like this one:
37
38 https://bugs.gentoo.org/show_bug.cgi?id=415579
39 --
40 Thanks,
41 Zac

Replies