From 9adbb6ae671900f7d64275db02ea199a2fd68cf0 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sat, 12 Sep 2026 09:20:13 -0300 Subject: [PATCH] fix(provtest): a fetch is ok only when curl finished it _decode in provtest_lib/httpc.py builds the reply's "ok" field from the HTTP status alone. curl writes the status as soon as the response header arrives, so a connection closed in the middle of the body, or a transfer killed by --max-time, still produces status 200. The http.conf scenario that fetches the kernel and initrd "byte for byte" then reads a partial file as served. The reply already carries the reason curl gave. "ok" now also requires that reason to be absent. xCAT-test/provtest/tests/test_parsers.py asserts it for a body cut short (curl exit 18) and for a timeout while reading the body. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/provtest/src/provtest_lib/httpc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-test/provtest/src/provtest_lib/httpc.py b/xCAT-test/provtest/src/provtest_lib/httpc.py index ea3530045..34927190b 100644 --- a/xCAT-test/provtest/src/provtest_lib/httpc.py +++ b/xCAT-test/provtest/src/provtest_lib/httpc.py @@ -106,7 +106,11 @@ def _decode(done, url, body_file, header_file): "header": _headers(header_file), "content_type": content_type, "error": error, - "ok": bool(status and 200 <= status < 400), + # curl prints the status as soon as the response header arrives. A + # transfer that then stopped -- the connection closed mid-body, the + # clock ran out -- leaves a status of 200 and a file holding part of a + # kernel, so the status alone does not say the fetch worked. + "ok": bool(status and 200 <= status < 400 and not error), } return Reply(kind="http", fields=fields, ok=fields["ok"], error=error, sent=done.command(), raw=body)