[zypp-devel] libzypp download failover - server side implemented
Hi, I have implemented a text mirror list for libzypp, which is returned for requests containing the rfc 2295 header shown below. I slightly changed the format. The returned mime type is application/mirrorlist-txt. A Vary header is set on the header for proper caching. % curl -sH "Accept-Features: mirrorlist-txt" 'http://download.opensuse.org/distribution/10.3/repo/oss/suse/repodata/primar...' | head -6 # mirrorlist-txt version=1.0 # url baseurl_len mirrorid region:country power http://ftp.tu-chemnitz.de/pub/linux/opensuse/distribution/10.3/repo/oss/suse... 45 39 EU:de 100 http://download.uni-hd.de/ftp/pub/linux/opensuse/distribution/10.3/repo/oss/... 49 41 EU:de 100 http://opensuse.intergenia.de/distribution/10.3/repo/oss/suse/repodata/prima... 30 75 EU:de 100 http://widehat.opensuse.org/distribution/10.3/repo/oss/suse/repodata/primary... 28 97 EU:de 50 I have updated http://en.opensuse.org/Libzypp/Failover accordingly. Peter -- "WARNING: This bug is visible to non-employees. Please be respectful!" SUSE LINUX Products GmbH Research & Development
Hi, On Mon, Apr 21, 2008 at 07:41:46PM +0200, Dr. Peter Poeml wrote:
I have implemented a text mirror list for libzypp, which is returned for requests containing the rfc 2295 header shown below. I slightly changed the format. The returned mime type is application/mirrorlist-txt. A Vary header is set on the header for proper caching.
% curl -sH "Accept-Features: mirrorlist-txt" 'http://download.opensuse.org/distribution/10.3/repo/oss/suse/repodata/primar...' | head -6 # mirrorlist-txt version=1.0 # url baseurl_len mirrorid region:country power http://ftp.tu-chemnitz.de/pub/linux/opensuse/distribution/10.3/repo/oss/suse... 45 39 EU:de 100 http://download.uni-hd.de/ftp/pub/linux/opensuse/distribution/10.3/repo/oss/... 49 41 EU:de 100 http://opensuse.intergenia.de/distribution/10.3/repo/oss/suse/repodata/prima... 30 75 EU:de 100 http://widehat.opensuse.org/distribution/10.3/repo/oss/suse/repodata/primary... 28 97 EU:de 50
Two things: 1) After more research, it is not needed to use Accept-Features, using Accept request header is enough, and also straightforward. Thus, the client needs to send "application/mirrorlist-txt" (the mime type) in the Accept header from now on. (The above method still works but we can remove it later on.) ((The mime-type is not well though-out, text/mirrorlist-something might be better, or a vendor specific mime type, let's see that later.)) 2) I have implemented injection of broken mirrors at the top of the list for testing failover. Any client with "getPrimaryFailover-agent/0.1" in User-Agent will get the following mirrors at the top of the list: % curl -s -A "getPrimaryFailover-agent/0.1" -H "Accept: foobar, application/mirrorlist-txt, */*" 'http://localhost:80/zrkadlo/distribution/10.3/repo/oss/GPLv3.txt?clientip=12...' | head # mirrorlist-txt version=1.0 # url baseurl_len mirrorid region:country power http://doesnotexist/distribution/10.3/repo/oss/GPLv3.txt 20 10001 EU:DE 100 http://www.poeml.de/nonexisting_file_for_libzypp 20 10002 EU:DE 100 http://www.poeml.de:83/nonexisting_file_for_libzypp 23 10003 EU:DE 100 http://ftp.opensuse.org:21/foobar 27 10004 EU:DE 100 http://download.opensuse.org/server-status 42 10005 EU:DE 100 http://widehat.opensuse.org:22/foobar 37 10006 EU:DE 100 I'll put it it into production onto download.opensuse.org in a few minutes.
I have updated http://en.opensuse.org/Libzypp/Failover accordingly.
...and updated again. Nice weekend, Peter -- "WARNING: This bug is visible to non-employees. Please be respectful!" SUSE LINUX Products GmbH Research & Development
participants (2)
-
Dr. Peter Poeml
-
Peter Poeml