mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Removed some deprecation warnings spotted in pytest output. Harden waitress
This commit is contained in:
parent
61652f0b6d
commit
9a19c47185
@ -25,7 +25,7 @@ import mimetypes
|
||||
import gzip
|
||||
from flask import Response, request
|
||||
from unidecode import unidecode
|
||||
from werkzeug.urls import url_quote
|
||||
from urllib.parse import quote
|
||||
|
||||
|
||||
class SendBaseModeWeb:
|
||||
@ -284,7 +284,7 @@ class SendBaseModeWeb:
|
||||
r.headers.set("Content-Length", filesize)
|
||||
filename_dict = {
|
||||
"filename": unidecode(basename),
|
||||
"filename*": "UTF-8''%s" % url_quote(basename),
|
||||
"filename*": "UTF-8''%s" % quote(basename),
|
||||
}
|
||||
r.headers.set("Content-Disposition", "inline", **filename_dict)
|
||||
(content_type, _) = mimetypes.guess_type(basename, strict=False)
|
||||
|
@ -29,7 +29,7 @@ from datetime import datetime, timezone
|
||||
from flask import Response, request, render_template, make_response, abort
|
||||
from unidecode import unidecode
|
||||
from werkzeug.http import parse_date, http_date
|
||||
from werkzeug.urls import url_quote
|
||||
from urllib.parse import quote
|
||||
|
||||
from .send_base_mode import SendBaseModeWeb
|
||||
|
||||
@ -231,7 +231,7 @@ class ShareModeWeb(SendBaseModeWeb):
|
||||
r.headers.set("Content-Length", range_[1] - range_[0] + 1)
|
||||
filename_dict = {
|
||||
"filename": unidecode(basename),
|
||||
"filename*": "UTF-8''%s" % url_quote(basename),
|
||||
"filename*": "UTF-8''%s" % quote(basename),
|
||||
}
|
||||
r.headers.set("Content-Disposition", "attachment", **filename_dict)
|
||||
# guess content type
|
||||
|
@ -23,7 +23,7 @@ import os
|
||||
import queue
|
||||
import requests
|
||||
import shutil
|
||||
from distutils.version import LooseVersion as Version
|
||||
from packaging.version import Version
|
||||
from waitress.server import create_server
|
||||
|
||||
import flask
|
||||
@ -349,7 +349,13 @@ class Web:
|
||||
if self.mode == "chat":
|
||||
self.socketio.run(self.app, host=host, port=port)
|
||||
else:
|
||||
self.waitress = create_server(self.app, host=host, port=port)
|
||||
self.waitress = create_server(
|
||||
self.app,
|
||||
host=host,
|
||||
port=port,
|
||||
clear_untrusted_proxy_headers=True,
|
||||
ident="OnionShare",
|
||||
)
|
||||
self.waitress.run()
|
||||
|
||||
def stop(self, port):
|
||||
|
Loading…
Reference in New Issue
Block a user