v1.0.139: separate HTTP/2 client per chunk (Lucee resets stream)

This commit is contained in:
2026-06-23 09:14:05 +04:00
parent 948ec626c9
commit d493d77017
+3 -3
View File
@@ -310,15 +310,15 @@ class Handler(BaseHTTPRequestHandler):
self._send_error_cors(400, "no file in request") self._send_error_cors(400, "no file in request")
return return
# Режем на чанки и шлём через один клиент # Режем на чанки (Lucee сбрасывает HTTP/2 стрим — новый клиент на каждый)
CHUNK = 12000 CHUNK = 12000
upload_id = str(uuid.uuid4()) upload_id = str(uuid.uuid4())
raw = file_data raw = file_data
total = (len(raw) + CHUNK - 1) // CHUNK total = (len(raw) + CHUNK - 1) // CHUNK
with httpx.Client(http2=True, timeout=30) as client:
for i in range(total): for i in range(total):
chunk = raw[i*CHUNK:(i+1)*CHUNK] chunk = raw[i*CHUNK:(i+1)*CHUNK]
with httpx.Client(http2=True, timeout=30) as client:
r = client.post( r = client.post(
f"{LUCEE_URL}/chunk.cfm?action=put", f"{LUCEE_URL}/chunk.cfm?action=put",
json={ json={
@@ -334,10 +334,10 @@ class Handler(BaseHTTPRequestHandler):
return return
# Собрать чанки # Собрать чанки
with httpx.Client(http2=True, timeout=60) as client:
resp = client.post( resp = client.post(
f"{LUCEE_URL}/chunk.cfm?action=assemble", f"{LUCEE_URL}/chunk.cfm?action=assemble",
json={"upload_id": upload_id, "contract_id": contract_id}, json={"upload_id": upload_id, "contract_id": contract_id},
timeout=60
) )
if resp.status_code == 200: if resp.status_code == 200:
self.send_response(200) self.send_response(200)