mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-02 22:45:03 -04:00
Switch to Waitress and Flask-Compress in lieu of werkzeug server
This commit is contained in:
parent
8528698971
commit
f50a552df4
5 changed files with 342 additions and 231 deletions
|
@ -181,7 +181,6 @@ class ShareModeWeb(SendBaseModeWeb):
|
|||
|
||||
# Prepare some variables to use inside generate() function below
|
||||
# which is outside of the request context
|
||||
shutdown_func = request.environ.get("werkzeug.server.shutdown")
|
||||
request_path = request.path
|
||||
|
||||
# If this is a zipped file, then serve as-is. If it's not zipped, then,
|
||||
|
@ -218,7 +217,6 @@ class ShareModeWeb(SendBaseModeWeb):
|
|||
else:
|
||||
r = Response(
|
||||
self.generate(
|
||||
shutdown_func,
|
||||
range_,
|
||||
file_to_download,
|
||||
request_path,
|
||||
|
@ -303,7 +301,7 @@ class ShareModeWeb(SendBaseModeWeb):
|
|||
return range_, status_code
|
||||
|
||||
def generate(
|
||||
self, shutdown_func, range_, file_to_download, path, history_id, filesize
|
||||
self, range_, file_to_download, path, history_id, filesize
|
||||
):
|
||||
# The user hasn't canceled the download
|
||||
self.client_cancel = False
|
||||
|
@ -390,9 +388,7 @@ class ShareModeWeb(SendBaseModeWeb):
|
|||
print("Stopped because transfer is complete")
|
||||
self.web.running = False
|
||||
try:
|
||||
if shutdown_func is None:
|
||||
raise RuntimeError("Not running with the Werkzeug Server")
|
||||
shutdown_func()
|
||||
self.web.stop()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue