[Pkg-anonymity-tools] [onionshare] 77/140: squash bug in closing Flask web server (fixes #131)
Ulrike Uhlig
u-guest at moszumanska.debian.org
Mon Sep 29 20:33:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository onionshare.
commit 2c1534979e0ae750d07a196bf17867b7074d595d
Author: Micah Lee <micah at micahflee.com>
Date: Wed Sep 3 00:11:15 2014 -0700
squash bug in closing Flask web server (fixes #131)
---
onionshare/web.py | 23 ++++++++++-------------
onionshare_gui/onionshare_gui.py | 2 +-
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/onionshare/web.py b/onionshare/web.py
index 07580cd..5cf8c6e 100644
--- a/onionshare/web.py
+++ b/onionshare/web.py
@@ -195,17 +195,14 @@ def start(port, stay_open=False):
set_stay_open(stay_open)
app.run(port=port)
-def stop():
+def stop(port):
# to stop flask, load http://127.0.0.1:<port>/<shutdown_slug>/shutdown
- try:
- if helpers.get_platform() == 'Tails':
- # in Tails everything is proxies over Tor, so we need to get lower level
- # to connect not over the proxy
- import socket
- s = socket.socket()
- s.connect(('127.0.0.1', app.port))
- s.sendall('GET /{0}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))
- else:
- urllib2.urlopen('http://127.0.0.1:{0}/{1}/shutdown'.format(app.port, shutdown_slug)).read()
- except:
- pass
+ if helpers.get_platform() == 'Tails':
+ # in Tails everything is proxies over Tor, so we need to get lower level
+ # to connect not over the proxy
+ import socket
+ s = socket.socket()
+ s.connect(('127.0.0.1', port))
+ s.sendall('GET /{0}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))
+ else:
+ urllib2.urlopen('http://127.0.0.1:{0}/{1}/shutdown'.format(port, shutdown_slug)).read()
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index b7122a3..3167f8f 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -138,7 +138,7 @@ class OnionShareGui(QtGui.QWidget):
t.start()
def stop_server(self):
- web.stop()
+ web.stop(self.app.port)
self.app.cleanup()
self.stop_server_finished.emit()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/onionshare.git
More information about the Pkg-anonymity-tools
mailing list