[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torflow/master] SearchBasedHTTPTest.get_targets duplicated the effort of BaseHTTP.add_target. BaseHTTPTest.remove_target became confused



commit 1248e73fd061257bee960df54b53b6c4d8f7e648
Author: Christian Anderson <christian@xxxxxxxxx>
Date:   Tue May 24 14:14:44 2011 -0400

    SearchBasedHTTPTest.get_targets duplicated the effort of BaseHTTP.add_target. BaseHTTPTest.remove_target became confused
---
 NetworkScanners/ExitAuthority/soat.py |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/NetworkScanners/ExitAuthority/soat.py b/NetworkScanners/ExitAuthority/soat.py
index 97d310b..f2552e2 100755
--- a/NetworkScanners/ExitAuthority/soat.py
+++ b/NetworkScanners/ExitAuthority/soat.py
@@ -2188,16 +2188,19 @@ class SearchBasedHTTPTest(SearchBasedTest, BaseHTTPTest):
         plog("NOTICE", self.proto+" scanner short on "+ftype+" targets. Adding more")
         map(self.add_target, self.get_search_urls_for_filetype(ftype))
 
-  def get_targets(self):
-    raw_urls = self.get_search_urls()
-    new = {}
-    for url in raw_urls:
-      split = url.rsplit('.',1) # Try to get filetype
-      if len(split) > 1 and split[-1] in self.scan_filetypes:
-        new.setdefault(split[-1],[]).append(url)
-    for k,v in new.items():
-      self.targets_by_type.setdefault(k, []).extend(v)
-    return raw_urls
+# This duplicated the effort of BaseHTTPTest.add_target which is invoked by
+# SearchBasedHTTPTest.rewind -> BaseHTTPTest.rewind = Test.rewind
+# Instead we should fall back on SearchBasedTest.get_targets
+#  def get_targets(self):
+#    raw_urls = self.get_search_urls()
+#    new = {}
+#    for url in raw_urls:
+#      split = url.rsplit('.',1) # Try to get filetype
+#      if len(split) > 1 and split[-1] in self.scan_filetypes:
+#        new.setdefault(split[-1],[]).append(url)
+#    for k,v in new.items():
+#      self.targets_by_type.setdefault(k, []).extend(v)
+#      return raw_urls
 
 HTTPTest = SearchBasedHTTPTest # For resuming from old HTTPTest.*.test files
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits