From 95f395cc774d522eda1b80b310bd75767aa11bd4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Jun 2011 08:48:09 +0200 Subject: * methods/mirror.cc: - ignore lines starting with "#" in the mirror file - ignore non http urls in the mirrors --- methods/mirror.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/mirror.cc b/methods/mirror.cc index 2cf5c9ce1..8a7228def 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -274,8 +274,18 @@ bool MirrorMethod::InitMirrors() while (!in.eof()) { getline(in, s); - if (s.size() > 0) - AllMirrors.push_back(s); + + // ignore lines that start with # + if (s.find("#") == 0) + continue; + // ignore empty lines + if (s.size() == 0) + continue; + // ignore non http lines + if (s.find("http://") != 0) + continue; + + AllMirrors.push_back(s); } Mirror = AllMirrors[0]; UsedMirror = Mirror; -- cgit v1.2.3 From 6885f3def825a5a0be6bb1715c800fada22f9b73 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Jun 2011 13:21:47 +0200 Subject: append the dist (e.g. sid, wheezy) as a query string when asking for a suitable mirror --- methods/mirror.cc | 5 +++++ methods/mirror.h | 1 + 2 files changed, 6 insertions(+) (limited to 'methods') diff --git a/methods/mirror.cc b/methods/mirror.cc index 8a7228def..713dc211a 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -134,6 +134,10 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) string fetch = BaseUri; fetch.replace(0,strlen("mirror://"),"http://"); + // append the dist as a query string + if (Dist != "") + fetch += "?dist=" + Dist; + if(Debug) clog << "MirrorMethod::DownloadMirrorFile(): '" << fetch << "'" << " to " << MirrorFile << endl; @@ -339,6 +343,7 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str) if(Debug) std::cerr << "found BaseURI: " << uristr << std::endl; BaseUri = uristr.substr(0,uristr.size()-1); + Dist = (*I)->GetDist(); } } // get new file diff --git a/methods/mirror.h b/methods/mirror.h index bd807e122..97d18144a 100644 --- a/methods/mirror.h +++ b/methods/mirror.h @@ -29,6 +29,7 @@ class MirrorMethod : public HttpMethod vector AllMirrors; // all available mirrors string MirrorFile; // the file that contains the list of mirrors bool DownloadedMirrorFile; // already downloaded this session + string Dist; // the target distrubtion (e.g. sid, oneiric) bool Debug; -- cgit v1.2.3