diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-06-28 15:51:33 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-06-28 15:51:33 +0100 |
commit | abd9fcaa723093be0476b594932ed8bfb8307ca4 (patch) | |
tree | ea539f5ee1ac751895b09c09c23a0083f888cf47 /methods/mirror.cc | |
parent | f1ffbc5001afa705e347dcdbcda1c8a54a90372b (diff) | |
parent | 9c76a88155c346666325339c5581a528d70b1f69 (diff) |
merged from lp:~mvo/apt/mvo
Diffstat (limited to 'methods/mirror.cc')
-rw-r--r-- | methods/mirror.cc | 19 |
1 files changed, 17 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 |