summaryrefslogtreecommitdiff
path: root/onionshare
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2019-11-10 13:36:35 -0800
committerMicah Lee <micah@micahflee.com>2019-11-10 13:36:35 -0800
commit29620cb39c0de65dee632b30e86e5131eabe8486 (patch)
tree0c98f259bf905d9be87b532ff7bbd47c4e03bead /onionshare
parent699884df80934446ee79bbe6b696b9ca7d064650 (diff)
downloadonionshare-29620cb39c0de65dee632b30e86e5131eabe8486.tar.gz
onionshare-29620cb39c0de65dee632b30e86e5131eabe8486.zip
When shutting down the web server, only use basic auth if there is a password -- this avoids warnings when running tests
Diffstat (limited to 'onionshare')
-rw-r--r--onionshare/web/web.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/onionshare/web/web.py b/onionshare/web/web.py
index a143a22f..bfdd2cac 100644
--- a/onionshare/web/web.py
+++ b/onionshare/web/web.py
@@ -386,10 +386,15 @@ class Web:
# To stop flask, load http://shutdown:[shutdown_password]@127.0.0.1/[shutdown_password]/shutdown
# (We're putting the shutdown_password in the path as well to make routing simpler)
if self.running:
- requests.get(
- f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown",
- auth=requests.auth.HTTPBasicAuth("onionshare", self.password),
- )
+ if self.password:
+ requests.get(
+ f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown",
+ auth=requests.auth.HTTPBasicAuth("onionshare", self.password),
+ )
+ else:
+ requests.get(
+ f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown"
+ )
# Reset any password that was in use
self.password = None