Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-09-15 14:34:43 +0300
committerJunio C Hamano <gitster@pobox.com>2023-09-15 20:54:11 +0300
commit0763c3a2c4f21a9e81990cc5cbee4a66d4efefcb (patch)
treed5fff5eefbd3cdf9589ea6d4716bcced06a9151f /http.c
parent39fa527c8976da84cf70a9ea6b6d92a1fd9bd772 (diff)
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 db30130165 (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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/http.c b/http.c
index 7f7bc85dd0..fb4ecf911f 100644
--- a/http.c
+++ b/http.c
@@ -622,6 +622,8 @@ static int redact_sensitive_header(struct strbuf *header, size_t offset)
static int match_curl_h2_trace(const char *line, const char **out)
{
+ const char *p;
+
/*
* curl prior to 8.1.0 gives us:
*
@@ -633,6 +635,18 @@ static int match_curl_h2_trace(const char *line, const char **out)
skip_iprefix(line, "h2 [", out))
return 1;
+ /*
+ * curl 8.3.0 uses:
+ * [HTTP/2] [<stream-id>] [<header-name>: <header-val>]
+ * where <stream-id> is numeric.
+ */
+ if (skip_iprefix(line, "[HTTP/2] [", &p)) {
+ while (isdigit(*p))
+ p++;
+ if (skip_prefix(p, "] [", out))
+ return 1;
+ }
+
return 0;
}