[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] fix: scanner: catch all possible exceptions
commit eb749c09cc28ff5297b4ac770543a6bfbcb996ba
Author: juga0 <juga@xxxxxxxxxx>
Date: Sat Mar 23 13:28:31 2019 +0000
fix: scanner: catch all possible exceptions
calling requests.get, since RequestException does not catch all.
---
sbws/core/scanner.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index 5b28637..32752ca 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -98,8 +98,11 @@ def timed_recv_from_server(session, dest, byte_range):
try:
# headers are merged with the session ones, not overwritten.
session.get(dest.url, headers=HTTP_GET_HEADERS, verify=dest.verify)
- # Catch any `requests` exception, so that it can stored in the Result
- except requests.exceptions.RequestException as e:
+ # All `requests` exceptions could be caught with
+ # `requests.exceptions.RequestException`, but it seems that `requests`
+ # does not catch all the ssl exceptions and urllib3 doesn't seem to have
+ # a base exception class.
+ except Exception as e:
log.debug(e)
return False, e
end_time = time.time()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits