From 5b6194d1318d529401c7bcb1e04535b0c1d7d536 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 24 Oct 2022 02:33:23 +0200 Subject: [PATCH] stop win10-webdav from flooding the server --- README.md | 16 +++++++++++----- copyparty/httpcli.py | 6 ++++-- copyparty/smbd.py | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d48486e7..a1212c52 100644 --- a/README.md +++ b/README.md @@ -715,16 +715,16 @@ an FTP server can be started using `--ftp 3921`, and/or `--ftps` for explicit T ## webdav server -with read-write support, supports winxp, win7/8/10, macos, nautilus/gvfs +with read-write support, supports winXP and later, macos, nautilus/gvfs general usage: * login with any username + your password, or put your password in the username field and leave password empty -on windows xp/7/8/10, connect using the explorer UI: +on windows xp/7+, connect using the explorer UI: * rightclick [my computer] -> [map network drive] -> [Connect to a network server] hyperlink -> [Choose a custom network location] -> `http://192.168.123.1:3923/` -on windows 7/8/10, connect using command prompt (`wark`=password): -* `net use w: http://192.168.123.1:3923/ wark /user:a` +on windows 7+, connect using command prompt (`wark`=password): +* `net use w: http://192.168.123.1:3923/ k /user:wark` on windows (xp or later), disable wpad for performance: * control panel -> [network and internet] -> [internet options] -> [connections] tab -> [lan settings] -> automatically detect settings: Nope @@ -734,6 +734,8 @@ known client bugs: * or just type your password into the username field instead to get around it entirely * win7+ cannot access servers which require authentication unless you use https or [enable basic auth](./contrib/webdav-basicauth.reg) for http * win7+ cannot download files larger than 47.6 MiB by default; [registry fix](./contrib/webdav-unlimit.bat) to allow files up to 4 GiB (actual absolute max on windows) +* win7+ opens a new tcp connection for every file and sometimes forgets to close them, eventually needing a reboot + * maybe NIC-related (??), happens with win10-ltsc on e1000e but not virtio * windows cannot access folders which contain filenames with invalid unicode or forbidden characters (`<>:"/\|?*`), or names ending with `.` * winxp cannot show unicode characters outside of *some range* * latin-1 is fine, hiragana is not (not even as shift-jis on japanese xp) @@ -761,7 +763,8 @@ and some minor issues, * slow known client bugs: -* on win7 only, `--smb1` is much faster than smb2 (default) because it keeps rescanning folders on smb2, however win10 onwards does not have smb1 +* on win7 only, `--smb1` is much faster than smb2 (default) because it keeps rescanning folders on smb2 + * however smb1 is buggy and is not enabled by default on win10 onwards * windows cannot access folders which contain filenames with invalid unicode or forbidden characters (`<>:"/\|?*`), or names ending with `.` the smb protocol listens on TCP port 445, which is a privileged port on linux and macos, which would require running copyparty as root. However, this can be avoided by listening on another port using `--smb-port 3945` and then using NAT to forward the traffic from 445 to there; @@ -771,6 +774,9 @@ authenticate with one of the following: * username `$username`, password `$password` * username `$password`, password blank +on windows 7+, connect using command prompt (`wark`=password): +* `net use w: \\192.168.123.1\a k /user:wark` + ## file indexing diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 93286aae..5e21e0e8 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -252,8 +252,10 @@ class HttpCli(object): self.is_ancient = self.ua.startswith("Mozilla/4.") zs = self.headers.get("connection", "").lower() - self.keepalive = not zs.startswith("close") and ( - self.http_ver != "HTTP/1.0" or zs == "keep-alive" + self.keepalive = ( + not zs.startswith("close") + and (self.http_ver != "HTTP/1.0" or zs == "keep-alive") + and "Microsoft-WebDAV" not in self.ua ) self.is_https = ( self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls diff --git a/copyparty/smbd.py b/copyparty/smbd.py index 3fae053c..1e07655b 100644 --- a/copyparty/smbd.py +++ b/copyparty/smbd.py @@ -132,7 +132,7 @@ class SMB(object): def _listdir(self, vpath: str, *a: Any, **ka: Any) -> list[str]: vpath = vpath.replace("\\", "/").lstrip("/") # caller = inspect.currentframe().f_back.f_code.co_name - logging.info('listdir("%s", %s)\033[K\033[0m', vpath, str(a)) + logging.debug('listdir("%s", %s)\033[K\033[0m', vpath, str(a)) vfs, rem = self.asrv.vfs.get(vpath, LEELOO_DALLAS, False, False) _, vfs_ls, vfs_virt = vfs.ls( rem, LEELOO_DALLAS, not self.args.no_scandir, [[False, False]]