[tor-commits] [stem/master] Recognize '/tor/status-vote/current/<fp>' DirPort urls

atagar at torproject.org atagar at torproject.org
Wed Jul 17 21:37:10 UTC 2019


commit 4357e5480eb8de01337929e3e6f761f0d6de4833
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jul 17 14:33:23 2019 -0700

    Recognize '/tor/status-vote/current/<fp>' DirPort urls
    
    Our spec doesn't have a clear enumeration of DirPort urls so I've supported
    them on an as-needed basis. Sebastian hit a snag due to lack of support for
    these...
    
      https://trac.torproject.org/projects/tor/ticket/31187
    
    Tested via the following script...
    
      from stem.descriptor import remote
    
      downloader = remote.DescriptorDownloader()
      resource = '/tor/status-vote/current/49015F787433103580E3B66A1707A00E60F2D15B'
    
      for relay in downloader.query(resource):
        print(relay.fingerprint)
---
 stem/descriptor/remote.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index e76181fa..15f46070 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -109,6 +109,7 @@ import stem.descriptor.networkstatus
 import stem.directory
 import stem.prereq
 import stem.util.enum
+import stem.util.tor_tools
 
 from stem.util import log, str_tools
 
@@ -1126,6 +1127,8 @@ def _guess_descriptor_type(resource):
       return 'network-status-microdesc-consensus-3 1.0'
     elif resource.endswith('/consensus-signatures'):
       return '%s 1.0' % DETACHED_SIGNATURE_TYPE
+    elif stem.util.tor_tools.is_valid_fingerprint(resource.split('/')[-1]):
+      return 'network-status-consensus-3 1.0'
     elif resource.endswith('/bandwidth'):
       return 'bandwidth-file 1.0'
 



More information about the tor-commits mailing list