From d493d770174be0d3a8ee457b531d990af49a4ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Tue, 23 Jun 2026 09:14:05 +0400 Subject: [PATCH] v1.0.139: separate HTTP/2 client per chunk (Lucee resets stream) --- deploy/convert_server.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/deploy/convert_server.py b/deploy/convert_server.py index 1d18e4c..378a41f 100755 --- a/deploy/convert_server.py +++ b/deploy/convert_server.py @@ -310,15 +310,15 @@ class Handler(BaseHTTPRequestHandler): self._send_error_cors(400, "no file in request") return - # Режем на чанки и шлём через один клиент + # Режем на чанки (Lucee сбрасывает HTTP/2 стрим — новый клиент на каждый) CHUNK = 12000 upload_id = str(uuid.uuid4()) raw = file_data total = (len(raw) + CHUNK - 1) // CHUNK - with httpx.Client(http2=True, timeout=30) as client: - for i in range(total): - chunk = raw[i*CHUNK:(i+1)*CHUNK] + for i in range(total): + chunk = raw[i*CHUNK:(i+1)*CHUNK] + with httpx.Client(http2=True, timeout=30) as client: r = client.post( f"{LUCEE_URL}/chunk.cfm?action=put", json={ @@ -329,15 +329,15 @@ class Handler(BaseHTTPRequestHandler): "data": chunk.hex(), }, ) - if r.status_code != 200: - self._send_error_cors(502, f"chunk {i+1}/{total} failed: HTTP {r.status_code}") - return + if r.status_code != 200: + self._send_error_cors(502, f"chunk {i+1}/{total} failed: HTTP {r.status_code}") + return - # Собрать чанки + # Собрать чанки + with httpx.Client(http2=True, timeout=60) as client: resp = client.post( f"{LUCEE_URL}/chunk.cfm?action=assemble", json={"upload_id": upload_id, "contract_id": contract_id}, - timeout=60 ) if resp.status_code == 200: self.send_response(200)