* methods/mirror.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 7 Jun 2011 06:48:09 +0000 (08:48 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 7 Jun 2011 06:48:09 +0000 (08:48 +0200)
  - ignore lines starting with "#" in the mirror file
  - ignore non http urls in the mirrors

debian/changelog
methods/mirror.cc

index d02091f..9fbcf0a 100644 (file)
@@ -73,6 +73,11 @@ apt (0.8.15) UNRELEASED; urgency=low
   * apt-pkg/packagemanager.cc:
     - ensure for Multi-Arch:same packages that they are unpacked in
       lock step even in immediate configuration (Closes: #618288)
+  
+  [ Michael Vogt ]
+  * methods/mirror.cc:
+    - ignore lines starting with "#" in the mirror file
+    - ignore non http urls in the mirrors
 
  -- Michael Vogt <mvo@debian.org>  Mon, 16 May 2011 14:57:52 +0200
 
index 2cf5c9c..8a7228d 100644 (file)
@@ -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;