[Pkg-privacy-commits] [onionshare] 145/256: Handle UpdateCheckerSOCKSHTTPError exception in the update_checker module
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:29 UTC 2017
This is an automated email from the git hooks/post-receive script.
ulrike pushed a commit to branch master
in repository onionshare.
commit ca16600d29ed1a07d6f6fa876c53030928fc68f1
Author: Micah Lee <micah at micahflee.com>
Date: Sat Apr 15 18:15:01 2017 -0700
Handle UpdateCheckerSOCKSHTTPError exception in the update_checker module
---
onionshare_gui/update_checker.py | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/onionshare_gui/update_checker.py b/onionshare_gui/update_checker.py
index d180e18..aaaa59b 100644
--- a/onionshare_gui/update_checker.py
+++ b/onionshare_gui/update_checker.py
@@ -78,32 +78,32 @@ def check_for_updates(force=False, bundled_tor_func=None):
raise UpdateCheckerTorError
# Download the latest-version file over Tor
- #try:
- (socks_address, socks_port) = onion.get_tor_socks_port()
- socks.set_default_proxy(socks.SOCKS5, socks_address, socks_port)
+ try:
+ (socks_address, socks_port) = onion.get_tor_socks_port()
+ socks.set_default_proxy(socks.SOCKS5, socks_address, socks_port)
- s = socks.socksocket()
- s.connect(('elx57ue5uyfplgva.onion', 80))
+ s = socks.socksocket()
+ s.connect(('elx57ue5uyfplgva.onion', 80))
- http_request = 'GET /latest-version.txt HTTP/1.0\r\n'
- http_request += 'Host: elx57ue5uyfplgva.onion\r\n'
- http_request += 'User-Agent: OnionShare {}, {}\r\n'.format(helpers.get_version(), platform.system())
- http_request += '\r\n'
- s.sendall(http_request.encode('utf-8'))
+ http_request = 'GET /latest-version.txt HTTP/1.0\r\n'
+ http_request += 'Host: elx57ue5uyfplgva.onion\r\n'
+ http_request += 'User-Agent: OnionShare {}, {}\r\n'.format(helpers.get_version(), platform.system())
+ http_request += '\r\n'
+ s.sendall(http_request.encode('utf-8'))
- http_response = s.recv(1024)
- latest_version = http_response[http_response.find(b'\r\n\r\n'):].strip().decode('utf-8')
+ http_response = s.recv(1024)
+ latest_version = http_response[http_response.find(b'\r\n\r\n'):].strip().decode('utf-8')
- # Clean up from Onion
- onion.cleanup()
- #except:
- # raise UpdateCheckerSOCKSHTTPError
+ # Clean up from Onion
+ onion.cleanup()
+ except:
+ raise UpdateCheckerSOCKSHTTPError
# Validate that latest_version looks like a version string
# This regex is: 1-3 dot-separated numeric components
version_re = r"^(\d+\.)?(\d+\.)?(\d+)$"
if not re.match(version_re, latest_version):
- raise UpdateCheckerInvalidLatestVersion
+ raise UpdateCheckerInvalidLatestVersion(latest_version)
# Update the last checked timestamp (dropping the seconds and milliseconds)
timestamp = datetime.datetime.now().replace(microsecond=0).replace(second=0).timestamp()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git
More information about the Pkg-privacy-commits
mailing list