diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-06-29 16:29:54 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-06-29 16:29:54 +0200 |
commit | a9d2fdce1f1d5b4b428c215189a5b204ff91108b (patch) | |
tree | 87870e8f3c6c66653dabe165fde5cc78a8b337e4 /methods | |
parent | aaa7858c3583617b068bd87af4e17be4d02da0bf (diff) | |
parent | e449f717078978396b76a2fdae844196888d0211 (diff) |
merge with debian-sid release 0.8.15
Diffstat (limited to 'methods')
-rw-r--r-- | methods/mirror.cc | 19 | ||||
-rw-r--r-- | methods/mirror.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc index 2cf5c9ce1..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; @@ -274,8 +278,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; @@ -329,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<string> 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; |