No consensus results in empty 'GETINFO ns/name/*' responses
Hi Nick, spotted an interesting tor oddity during my flight (due to not having any network connectivity). When calling 'GETINFO ns/name/blarg' without a cached consensus it returns an empty string rather than the expected "Unrecognized key" response.
Repro details...
- With a data directory containing a cached consensus things work as expected...
% telnet localhost 9051
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
AUTHENTICATE
250 OK
GETINFO ns/all
[ ... lots of output... ]
GETINFO ns/name/blarg
552 Unrecognized key "ns/name/blarg"
- Blow away your data directory when you lack network connectivity.
% mv ~/.tor ~/.tor_bak
% mkdir ~/.tor
% cp ~/.tor_bak/torrc ~/.tor
% cat ~/.tor/torrc
ControlPort 9051
% tor -f ~/.tor/torrc
...
- Now GETINFO for 'ns/all' and any requrest for a relay returns an empty response.
% telnet localhost 9051
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
AUTHENTICATE
250 OK
GETINFO ns/all
250-ns/all=
250 OK
GETINFO ns/name/blarg
250-ns/name/blarg=
250 OK
Interestingly this only seems to concern router status entries. Server descriptors and microdescriptors give us a 'Unrecognized key'...
GETINFO desc/name/blarg
552 Unrecognized key "desc/name/blarg"
GETINFO md/name/blarg
552 Unrecognized key "md/name/blarg"
For my part I noticed this because it caused an integ testing failure during my flight...
======================================================================
ERROR: test_get_network_status
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 977, in test_get_network_status
self.assertRaises(stem.ControllerError, controller.get_network_status, "blargg")
File "/usr/lib/python2.7/unittest/case.py", line 471, in assertRaises
callableObj(*args, **kwargs)
File "/home/atagar/Desktop/stem/stem/control.py", line 1427, in get_network_status
raise exc
ValueError: Router status entries (v3) must have a 'r' line:
This doesn't seem like the right tor behavior but if you think it is I can simply have stem check for the empty string. :)
Cheers! -Damian