[tor-bugs] #10725 [BridgeDB]: Write a Completely Spec-Compliant Bridge Descriptor Parser
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sun Jan 26 18:17:12 UTC 2014
#10725: Write a Completely Spec-Compliant Bridge Descriptor Parser
-----------------------------+------------------------------
Reporter: sysrqb | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: BridgeDB | Version:
Resolution: | Keywords: bridgedb-parsers
Actual Points: | Parent ID:
Points: |
-----------------------------+------------------------------
Comment (by sysrqb):
Replying to [comment:9 atagar]:
> I'm not sure what you're trying to say. Exactly what code calling stem
with what input is failing?
It's completely possible I'm doing something wrong.
{{{
from stem.descriptor.networkstatus import BridgeNetworkStatusDocument
...
with open(fn_ns, 'r') as fd_ns:
ns_content = fd_ns.read()
bridge_ns = BridgeNetworkStatusDocument(ns_content)
}}}
Where `fn_ns` is the filename of the networkstatus in the current
directory. This yields:
{{{
Traceback (most recent call last):
File "bridge_attributes.py", line 366, in <module>
bridge_ns = BridgeNetworkStatusDocument(ns_content)
File "/home/sysrqb/.virtualenvs/stem/lib/python2.7/site-
packages/stem/descriptor/networkstatus.py", line 1466, in __init__
raise ValueError("Bridge network status documents must start with a
'published' line:\n%s" % stem.util.str_tools._to_unicode(raw_content))
ValueError: Bridge network status documents must start with a 'published'
line:
@type bridge-network-status 1.0
published 2014-01-20 19:37:04
r Unnamed ADXqKmHijTlfCArKIkRTlJDnCVA LKE/QQE82+iECLEEYsTTp6L7EUw
2014-01-20 17:05:06 10.243.41.56 443 0
...
}}}
(It actually prints the entire document, but I won't paste it)
So what I was trying to say was that it looks like
BridgeNetworkStatusDocument only reads the first line of the BytesIO
object and fails to validate because the first lines does not start with
'published '. Am I providing incorrect input?
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/10725#comment:11>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list