commit 80647b6a64551ba725da8433da90e263741a707a Author: Damian Johnson <ata...@torproject.org> Date: Tue May 7 09:02:37 2019 -0700
Fix exception type for ephemeral hidden service fallback Modern tor versions provide an empty response when no ephemereal hidden service is present... >>> GETINFO onions/current 250-onions/current= 250 OK >>> GETINFO onions/detached 250-onions/detached= 250 OK But at least as of our tor-0.2.9.14 branch we raise an exception instead. We attempted to catch these exceptions, but evidently caught the wrong type. Iirc I changed our GETINFO exception raising behavior a while back so maybe this slipped in then. Caught thanks to 0xrichard... https://trac.torproject.org/projects/tor/ticket/30422 ====================================================================== ERROR: test_ephemeral_hidden_services_v2 ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/atagar/Desktop/stem/test/require.py", line 57, in wrapped return func(self, *args, **kwargs) File "/home/atagar/Desktop/stem/test/require.py", line 57, in wrapped return func(self, *args, **kwargs) File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 559, in test_ephemeral_hidden_services_v2 self.assertEqual([], controller.list_ephemeral_hidden_services()) File "/home/atagar/Desktop/stem/stem/control.py", line 480, in wrapped return func(self, *args, **kwargs) File "/home/atagar/Desktop/stem/stem/control.py", line 2916, in list_ephemeral_hidden_services result += self.get_info('onions/current').split('\n') File "/home/atagar/Desktop/stem/stem/control.py", line 480, in wrapped return func(self, *args, **kwargs) File "/home/atagar/Desktop/stem/stem/control.py", line 1200, in get_info stem.response.convert('GETINFO', response) File "/home/atagar/Desktop/stem/stem/response/__init__.py", line 123, in convert message._parse_message(**kwargs) File "/home/atagar/Desktop/stem/stem/response/getinfo.py", line 46, in _parse_message raise stem.OperationFailed(error_code, error_msg) OperationFailed: No onion services of the specified type. --- stem/control.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stem/control.py b/stem/control.py index 3ea3752f..9c689ae6 100644 --- a/stem/control.py +++ b/stem/control.py @@ -2914,7 +2914,7 @@ class Controller(BaseController): if our_services: try: result += self.get_info('onions/current').split('\n') - except stem.ProtocolError as exc: + except (stem.ProtocolError, stem.OperationFailed) as exc: # TODO: Tor's behavior around this was changed in Feb 2017, we should # drop it when all versions that did this are deprecated... # @@ -2926,7 +2926,7 @@ class Controller(BaseController): if detached: try: result += self.get_info('onions/detached').split('\n') - except stem.ProtocolError as exc: + except (stem.ProtocolError, stem.OperationFailed) as exc: if 'No onion services of the specified type.' not in str(exc): raise _______________________________________________ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits