Ignore bogus hostnames, and make parsing of timedhosts file
a bit more robust.
---
 urlgrabber/grabber.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 094be77..1d7cfbe 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -2268,7 +2268,7 @@ class _TH:
         if filename and _TH.dirty is None:
             try:
                 for line in open(filename):
-                    host, speed, fail, ts = line.split()
+                    host, speed, fail, ts = line.split(' ', 3)
                     _TH.hosts[host] = int(speed), int(fail), int(ts)
             except IOError: pass
             _TH.dirty = False
@@ -2291,6 +2291,9 @@ class _TH:
     def update(url, dl_size, dl_time, ug_err):
         _TH.load()
         host = urlparse.urlsplit(url).netloc
+        if not host or ' ' in host:
+            DEBUG.warn('malformed url: %s', repr(url))
+            return
         speed, fail, ts = _TH.hosts.get(host) or (0, 0, 0)
         now = time.time()
 
-- 
1.7.4.4

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to