[tor-commits] [bridgedb/master] Allow 'a'-lines which don't start with 'a' for backward compatibility.

isis at torproject.org isis at torproject.org
Sun Jan 12 06:06:34 UTC 2014


commit 2c79e849c06443f20e949b4db648a451e3bfd873
Author: Isis Lovecruft <isis at torproject.org>
Date:   Fri Dec 20 05:19:08 2013 +0000

    Allow 'a'-lines which don't start with 'a' for backward compatibility.
    
    The removed bridgedb.Bridges.parseORAddressLine() function was able to take a
    networkstatus line which started with 'a' or didn't. It's a mess to change all
    the code, so for now just log a warning when we recieve a line in
    bridgedb.parse.networkstatus.parseALine() which doesn't start with 'a'.
---
 lib/bridgedb/parse/networkstatus.py |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/bridgedb/parse/networkstatus.py b/lib/bridgedb/parse/networkstatus.py
index 09c9a65..846c39b 100644
--- a/lib/bridgedb/parse/networkstatus.py
+++ b/lib/bridgedb/parse/networkstatus.py
@@ -165,12 +165,11 @@ def parseALine(line, fingerprint=None):
     ip = None
     portlist = None
 
-    if not line.startswith('a '):
-        logging.error("Networkstatus parser received non 'a'-line for %r:"\
-                      "  %r" % (fingerprint or 'Unknown', line))
-        return ip, portlist
-
-    line = line[2:] # Chop off the 'a '
+    if line.startswith('a '):
+        line = line[2:] # Chop off the 'a '
+    else:
+        logging.warn("Networkstatus parser received non 'a'-line for %r:"\
+                     "  %r" % (fingerprint or 'Unknown', line))
 
     try:
         ip, portlist = line.rsplit(':', 1)





More information about the tor-commits mailing list