mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
avoid sendfile bugs on 32bit machines:
https://github.com/python/cpython/issues/114077
This commit is contained in:
parent
3313503ea5
commit
b9d0c8536b
|
@ -43,6 +43,7 @@ from .util import (
|
||||||
DEF_MTH,
|
DEF_MTH,
|
||||||
IMPLICATIONS,
|
IMPLICATIONS,
|
||||||
JINJA_VER,
|
JINJA_VER,
|
||||||
|
PY_DESC,
|
||||||
PYFTPD_VER,
|
PYFTPD_VER,
|
||||||
SQLITE_VER,
|
SQLITE_VER,
|
||||||
UNPLICATIONS,
|
UNPLICATIONS,
|
||||||
|
@ -50,7 +51,6 @@ from .util import (
|
||||||
ansi_re,
|
ansi_re,
|
||||||
dedent,
|
dedent,
|
||||||
min_ex,
|
min_ex,
|
||||||
py_desc,
|
|
||||||
pybin,
|
pybin,
|
||||||
termsize,
|
termsize,
|
||||||
wrap,
|
wrap,
|
||||||
|
@ -1380,7 +1380,7 @@ def main(argv: Optional[list[str]] = None) -> None:
|
||||||
S_VERSION,
|
S_VERSION,
|
||||||
CODENAME,
|
CODENAME,
|
||||||
S_BUILD_DT,
|
S_BUILD_DT,
|
||||||
py_desc().replace("[", "\033[90m["),
|
PY_DESC.replace("[", "\033[90m["),
|
||||||
SQLITE_VER,
|
SQLITE_VER,
|
||||||
JINJA_VER,
|
JINJA_VER,
|
||||||
PYFTPD_VER,
|
PYFTPD_VER,
|
||||||
|
@ -1545,6 +1545,9 @@ def main(argv: Optional[list[str]] = None) -> None:
|
||||||
if sys.version_info < (3, 6):
|
if sys.version_info < (3, 6):
|
||||||
al.no_scandir = True
|
al.no_scandir = True
|
||||||
|
|
||||||
|
if not hasattr(os, "sendfile"):
|
||||||
|
al.no_sendfile = True
|
||||||
|
|
||||||
# signal.signal(signal.SIGINT, sighandler)
|
# signal.signal(signal.SIGINT, sighandler)
|
||||||
|
|
||||||
SvcHub(al, dal, argv, "".join(printed)).run()
|
SvcHub(al, dal, argv, "".join(printed)).run()
|
||||||
|
|
|
@ -38,6 +38,7 @@ from .sutil import StreamArc, gfilter
|
||||||
from .szip import StreamZip
|
from .szip import StreamZip
|
||||||
from .util import (
|
from .util import (
|
||||||
APPLESAN_RE,
|
APPLESAN_RE,
|
||||||
|
BITNESS,
|
||||||
HTTPCODE,
|
HTTPCODE,
|
||||||
META_NOBOTS,
|
META_NOBOTS,
|
||||||
UTC,
|
UTC,
|
||||||
|
@ -2962,7 +2963,7 @@ class HttpCli(object):
|
||||||
use_sendfile = (
|
use_sendfile = (
|
||||||
not self.tls #
|
not self.tls #
|
||||||
and not self.args.no_sendfile
|
and not self.args.no_sendfile
|
||||||
and hasattr(os, "sendfile")
|
and (BITNESS > 32 or file_sz < 0x7fffFFFF)
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -167,6 +167,12 @@ except:
|
||||||
return struct.unpack(fmt.decode("ascii"), a)
|
return struct.unpack(fmt.decode("ascii"), a)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
BITNESS = struct.calcsize(b"P") * 8
|
||||||
|
except:
|
||||||
|
BITNESS = struct.calcsize("P") * 8
|
||||||
|
|
||||||
|
|
||||||
ansi_re = re.compile("\033\\[[^mK]*[mK]")
|
ansi_re = re.compile("\033\\[[^mK]*[mK]")
|
||||||
|
|
||||||
|
|
||||||
|
@ -371,11 +377,6 @@ def py_desc() -> str:
|
||||||
if ofs > 0:
|
if ofs > 0:
|
||||||
py_ver = py_ver[:ofs]
|
py_ver = py_ver[:ofs]
|
||||||
|
|
||||||
try:
|
|
||||||
bitness = struct.calcsize(b"P") * 8
|
|
||||||
except:
|
|
||||||
bitness = struct.calcsize("P") * 8
|
|
||||||
|
|
||||||
host_os = platform.system()
|
host_os = platform.system()
|
||||||
compiler = platform.python_compiler().split("http")[0]
|
compiler = platform.python_compiler().split("http")[0]
|
||||||
|
|
||||||
|
@ -383,7 +384,7 @@ def py_desc() -> str:
|
||||||
os_ver = m.group(1) if m else ""
|
os_ver = m.group(1) if m else ""
|
||||||
|
|
||||||
return "{:>9} v{} on {}{} {} [{}]".format(
|
return "{:>9} v{} on {}{} {} [{}]".format(
|
||||||
interp, py_ver, host_os, bitness, os_ver, compiler
|
interp, py_ver, host_os, BITNESS, os_ver, compiler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -422,8 +423,10 @@ except:
|
||||||
PYFTPD_VER = "(None)"
|
PYFTPD_VER = "(None)"
|
||||||
|
|
||||||
|
|
||||||
|
PY_DESC = py_desc()
|
||||||
|
|
||||||
VERSIONS = "copyparty v{} ({})\n{}\n sqlite v{} | jinja v{} | pyftpd v{}".format(
|
VERSIONS = "copyparty v{} ({})\n{}\n sqlite v{} | jinja v{} | pyftpd v{}".format(
|
||||||
S_VERSION, S_BUILD_DT, py_desc(), SQLITE_VER, JINJA_VER, PYFTPD_VER
|
S_VERSION, S_BUILD_DT, PY_DESC, SQLITE_VER, JINJA_VER, PYFTPD_VER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue