[tor-commits] [stem/master] Drop special handling for detached signature @type
atagar at torproject.org
atagar at torproject.org
Mon Feb 10 03:14:50 UTC 2020
commit 93a132b1c8ae97440be4831dc3e6173bca2f8720
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Feb 9 18:14:59 2020 -0800
Drop special handling for detached signature @type
Huh, wonder why this code was still around. Ticket 28615 was closed a long
while ago...
---
stem/descriptor/remote.py | 35 ++++++++---------------------------
1 file changed, 8 insertions(+), 27 deletions(-)
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index be633862..0f411a71 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -111,14 +111,6 @@ MAX_MICRODESCRIPTOR_HASHES = 90
SINGLETON_DOWNLOADER = None
-# Detached signatures do *not* have a specified type annotation. But our
-# parsers expect that all descriptors have a type. As such making one up.
-# This may change in the future if these ever get an official @type.
-#
-# https://trac.torproject.org/projects/tor/ticket/28615
-
-DETACHED_SIGNATURE_TYPE = 'detached-signature'
-
# Some authorities intentionally break their DirPort to discourage DOS. In
# particular they throttle the rate to such a degree that requests can take
# hours to complete. Unfortunately Python's socket timeouts only kick in
@@ -496,24 +488,13 @@ class Query(object):
raise ValueError('BUG: _download_descriptors() finished without either results or an error')
try:
- # TODO: special handling until we have an official detatched
- # signature @type...
- #
- # https://trac.torproject.org/projects/tor/ticket/28615
-
- if self.descriptor_type.startswith(DETACHED_SIGNATURE_TYPE):
- results = stem.descriptor.networkstatus._parse_file_detached_sigs(
- io.BytesIO(self.content),
- validate = self.validate,
- )
- else:
- results = stem.descriptor.parse_file(
- io.BytesIO(self.content),
- self.descriptor_type,
- validate = self.validate,
- document_handler = self.document_handler,
- **self.kwargs
- )
+ results = stem.descriptor.parse_file(
+ io.BytesIO(self.content),
+ self.descriptor_type,
+ validate = self.validate,
+ document_handler = self.document_handler,
+ **self.kwargs
+ )
for desc in results:
yield desc
@@ -1082,7 +1063,7 @@ def _guess_descriptor_type(resource):
elif resource.endswith('/consensus-microdesc'):
return 'network-status-microdesc-consensus-3 1.0'
elif resource.endswith('/consensus-signatures'):
- return '%s 1.0' % DETACHED_SIGNATURE_TYPE
+ return 'detached-signature-3 1.0'
elif stem.util.tor_tools.is_valid_fingerprint(resource.split('/')[-1]):
return 'network-status-consensus-3 1.0'
elif resource.endswith('/bandwidth'):
More information about the tor-commits
mailing list