mirror of
https://github.com/9001/copyparty.git
synced 2025-10-03 09:49:29 +02:00
up2k: shrink request headers
v1.13.5 made some proxies angry with its massive chunklists when stitching chunks, only list the first chunk hash in full, and include a truncated hash for the consecutive chunks should be enough for logfiles to make sense and to smoketest that clients are behaving
This commit is contained in:
parent
373194c38a
commit
0da719f4c2
4 changed files with 61 additions and 13 deletions
13
bin/u2c.py
13
bin/u2c.py
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
S_VERSION = "1.21"
|
||||
S_BUILD_DT = "2024-07-26"
|
||||
S_VERSION = "1.22"
|
||||
S_BUILD_DT = "2024-08-08"
|
||||
|
||||
"""
|
||||
u2c.py: upload to copyparty
|
||||
|
@ -660,8 +660,15 @@ def upload(fsl, pw, stats):
|
|||
# type: (FileSlice, str, str) -> None
|
||||
"""upload a range of file data, defined by one or more `cid` (chunk-hash)"""
|
||||
|
||||
ctxt = fsl.cids[0]
|
||||
if len(fsl.cids) > 1:
|
||||
n = 192 // len(fsl.cids)
|
||||
n = 9 if n > 9 else 2 if n < 2 else n
|
||||
zsl = [zs[:n] for zs in fsl.cids[1:]]
|
||||
ctxt += ",%d,%s" % (n, "".join(zsl))
|
||||
|
||||
headers = {
|
||||
"X-Up2k-Hash": ",".join(fsl.cids),
|
||||
"X-Up2k-Hash": ctxt,
|
||||
"X-Up2k-Wark": fsl.file.wark,
|
||||
"Content-Type": "application/octet-stream",
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue