Skip to content

Commit 0763c3a

Browse files
peffgitster
authored andcommitted
http: update curl http/2 info matching for curl 8.3.0
To redact header lines in http/2 curl traces, we have to parse past some prefix bytes that curl sticks in the info lines it passes to us. That changed once already, and we adapted in db30130 (http: handle both "h2" and "h2h3" in curl info lines, 2023-06-17). Now it has changed again, in curl's fbacb14c4 (http2: cleanup trace messages, 2023-08-04), which was released in curl 8.3.0. Running a build of git linked against that version will fail to redact the trace (and as before, t5559 notices and complains). The format here is a little more complicated than the other ones, as it now includes a "stream id". This is not constant but is always numeric, so we can easily parse past it. We'll continue to match the old versions, of course, since we want to work with many different versions of curl. We can't even select one format at compile time, because the behavior depends on the runtime version of curl we use, not the version we build against. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 39fa527 commit 0763c3a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

http.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ static int redact_sensitive_header(struct strbuf *header, size_t offset)
622622

623623
static int match_curl_h2_trace(const char *line, const char **out)
624624
{
625+
const char *p;
626+
625627
/*
626628
* curl prior to 8.1.0 gives us:
627629
*
@@ -633,6 +635,18 @@ static int match_curl_h2_trace(const char *line, const char **out)
633635
skip_iprefix(line, "h2 [", out))
634636
return 1;
635637

638+
/*
639+
* curl 8.3.0 uses:
640+
* [HTTP/2] [<stream-id>] [<header-name>: <header-val>]
641+
* where <stream-id> is numeric.
642+
*/
643+
if (skip_iprefix(line, "[HTTP/2] [", &p)) {
644+
while (isdigit(*p))
645+
p++;
646+
if (skip_prefix(p, "] [", out))
647+
return 1;
648+
}
649+
636650
return 0;
637651
}
638652

0 commit comments

Comments
 (0)