From dd26b8f1839ff5bb8b179207cebc9b15c6c0ab1e Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 30 Oct 2022 16:53:15 +0000 Subject: [PATCH] webdav: bump chunksize from 2048 to 32760 byte --- copyparty/httpcli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index db40bf67..43d0d82b 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -784,6 +784,8 @@ class HttpCli(object): fgen = itertools.chain([topdir], fgen) # type: ignore vtop = vjoin(vn.vpath, rem) + chunksz = 0x7FF8 # preferred by nginx or cf (dunno which) + self.send_headers( None, 207, "text/xml; charset=" + enc, {"Transfer-Encoding": "chunked"} ) @@ -827,14 +829,14 @@ class HttpCli(object): ret += t.format("".join(missing)) ret += "" - while len(ret) >= 0x800: - ret = self.send_chunk(ret, enc, 0x800) + while len(ret) >= chunksz: + ret = self.send_chunk(ret, enc, chunksz) ret += "" while ret: - ret = self.send_chunk(ret, enc, 0x800) + ret = self.send_chunk(ret, enc, chunksz) - self.send_chunk("", enc, 0x800) + self.send_chunk("", enc, chunksz) return True def handle_proppatch(self) -> bool: