]> git.kaiwu.me - haproxy.git/commit
DEV: patchbot: update: never write to stderr, thttpd sends it first
authorWilly Tarreau <w@1wt.eu>
Mon, 6 Jul 2026 21:13:29 +0000 (23:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Jul 2026 12:45:32 +0000 (14:45 +0200)
commit75e013727cca90626257fe3c2811db1e99bf40cd
treeecfbb657c5e87adb5bc5a7085fd7fa67d2a7412f
parentd5c6431907ffa0041306e8ee1233d16a414d4d92
DEV: patchbot: update: never write to stderr, thttpd sends it first

thttpd forwards the CGI's stderr to the client *ahead* of its stdout:
the socket receives the HTTP status line, then any stderr log line, and
only then the CGI headers, turning the log line into a bogus response
header; on an error path the same mechanism could push garbage in front
of the "Status:" header and corrupt the response entirely.

All diagnostics are already carried by the response itself (die()'s
body, the in-band "warning:" line with git's captured error), so the
duplicated stderr logging brings nothing and only risks breaking the
channel it leaks into: drop it, and state the constraint in a comment
above die() so it doesn't come back. The usage text for a bad command
line is folded into the 500 response body, which is also what a shell
user sees when testing by hand.
dev/patchbot/cgi/update.awk