Skip to content

Commit bf781d9

Browse files
committed
Merge branch 'jk/curl-global-trace-components'
Adjust to the way newer versions of cURL selectivel enables tracing options, so that our tests can continue to work. * jk/curl-global-trace-components: curl: add support for curl_global_trace() components
2 parents 9827e07 + 1b5a6bf commit bf781d9

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

git-curl-compat.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
#define GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR 1
4646
#endif
4747

48+
/**
49+
* curl_global_trace() was added in 8.3.0, released September 2023.
50+
*/
51+
#if LIBCURL_VERSION_NUM >= 0x080300
52+
#define GIT_CURL_HAVE_GLOBAL_TRACE 1
53+
#endif
54+
4855
/**
4956
* CURLOPT_TCP_KEEPCNT was added in 8.9.0, released in July, 2024.
5057
*/

http.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,14 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
13481348
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
13491349
die("curl_global_init failed");
13501350

1351+
#ifdef GIT_CURL_HAVE_GLOBAL_TRACE
1352+
{
1353+
const char *comp = getenv("GIT_TRACE_CURL_COMPONENTS");
1354+
if (comp)
1355+
curl_global_trace(comp);
1356+
}
1357+
#endif
1358+
13511359
if (proactive_auth && http_proactive_auth == PROACTIVE_AUTH_NONE)
13521360
http_proactive_auth = PROACTIVE_AUTH_IF_CREDENTIALS;
13531361

t/t5564-http-proxy.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ test_expect_success SOCKS_PROXY 'clone via Unix socket' '
7272
test_when_finished "rm -rf clone" &&
7373
test_config_global http.proxy "socks4://localhost$PWD/%2530.sock" && {
7474
{
75-
GIT_TRACE_CURL=$PWD/trace git clone "$HTTPD_URL/smart/repo.git" clone 2>err &&
75+
GIT_TRACE_CURL=$PWD/trace \
76+
GIT_TRACE_CURL_COMPONENTS=socks \
77+
git clone "$HTTPD_URL/smart/repo.git" clone 2>err &&
7678
grep -i "SOCKS4 request granted" trace
7779
} ||
7880
old_libcurl_error err

0 commit comments

Comments
 (0)