diff --git a/deploy/convert_server.py b/deploy/convert_server.py index 9b73019..d4ffe1a 100755 --- a/deploy/convert_server.py +++ b/deploy/convert_server.py @@ -318,27 +318,27 @@ class Handler(BaseHTTPRequestHandler): for i in range(total): chunk = raw[i*CHUNK:(i+1)*CHUNK] - r = httpx.post( - f"{LUCEE_URL}/chunk.cfm?action=put", - json={ - "upload_id": upload_id, - "chunk_index": i, - "total_chunks": total, - "filename": filename, - "data": chunk.hex(), - }, - timeout=30 - ) + with httpx.Client(http2=True, timeout=30) as client: + r = client.post( + f"{LUCEE_URL}/chunk.cfm?action=put", + json={ + "upload_id": upload_id, + "chunk_index": i, + "total_chunks": total, + "filename": filename, + "data": chunk.hex(), + }, + ) if r.status_code != 200: self._send_error_cors(502, f"chunk {i+1}/{total} failed: HTTP {r.status_code}") return # Собрать чанки в Lucee - resp = httpx.post( - f"{LUCEE_URL}/chunk.cfm?action=assemble", - json={"upload_id": upload_id, "contract_id": contract_id}, - timeout=60 - ) + 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}, + ) if resp.status_code == 200: self.send_response(200) self._send_cors()