git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] http.h: Add debug callback and helper routine for implementing the GIT_TRACE_CURL environment variable in http.c

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Apr 19, 2016, 22:11 UTC
Message-ID
<5716AD2B.3050701@ramsayjones.plus.com>
In-Reply-To
<5716A7C6.40507@ramsayjones.plus.com>
On 19/04/16 22:48, Ramsay Jones wrote:
> 
[snip]
> I think the minimal fixup (including Junio's comment on patch #2, which also
> triggered for me) is given in the patch below.

BTW, if you want to have a single static instance of the 'struct trace_key', then the following patch on top should work. (Also, I have compiled and run the testsuite on these patches, but _not_ tested that the trace functionality actually works!) ;-)

HTH
ATB,
Ramsay Jones
-- >8 --
Subject: [PATCH] curl-trace: reduce visibility of the trace key struct
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
 http.c      | 9 +++++++--
 http.h      | 2 +-
 imap-send.c | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/http.c b/http.c
index ce91421..eed6dba 100644
--- a/http.c
+++ b/http.c
@@ -11,7 +11,7 @@
 #include "gettext.h"
 #include "transport.h"
 
-struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
+static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
 #if LIBCURL_VERSION_NUM >= 0x070a08
 long int git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER;
 #else
@@ -516,6 +516,11 @@ static void curl_dump(const char *text, unsigned char *ptr, size_t size, char no
 	}
 }
 
+int curl_trace_want(void)
+{
+	return trace_want(&trace_curl);
+}
+
 int curl_trace(CURL *handle, curl_infotype type,
 	     char *data, size_t size, void *userp)
 {
@@ -652,7 +657,7 @@ static CURL *get_curl_handle(void)
 			"your curl version is too old (>= 7.19.4)");
 #endif
 
-	if (trace_want(&trace_curl)) {
+	if (curl_trace_want()) {
 		curl_easy_setopt(result, CURLOPT_VERBOSE, 1L);
 		curl_easy_setopt(result, CURLOPT_DEBUGFUNCTION, curl_trace);
 		curl_easy_setopt(result, CURLOPT_DEBUGDATA, NULL);
diff --git a/http.h b/http.h
index 00e4ad7..153ff17 100644
--- a/http.h
+++ b/http.h
@@ -225,7 +225,7 @@ extern void abort_http_object_request(struct http_object_request *freq);
 extern void release_http_object_request(struct http_object_request *freq);
 
 /* Debug callback and helper routine for curl_easy_setopt CURLOPT_DEBUGFUNCTION */
-extern struct trace_key trace_curl;
+int curl_trace_want(void);
 int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp);
 
 
diff --git a/imap-send.c b/imap-send.c
index 36ff843..627ffa4 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1444,7 +1444,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
 	if (0 < verbosity || getenv("GIT_CURL_VERBOSE"))
 		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
 
-	if (trace_want(&trace_curl)) {
+	if (curl_trace_want()) {
 		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
 		curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_trace);
 		curl_easy_setopt(curl, CURLOPT_DEBUGDATA, NULL);
-- 
2.8.0
Previous: Ramsay JonesNext: Elia Pinto
Message 5 of 11 in “[PATCHv2 0/4] Implements the GIT_TRACE_CURL environment variable”
  1. Elia PintoApr 19, 2016
  2. 1/4 http.h: Add debug callback and helper routine for implementing the GIT_TRACE_CURL environment variable in http.cElia Pinto, Apr 19, 2016
  3. Junio C HamanoApr 19, 2016
  4. Ramsay JonesApr 19, 2016
  5. Ramsay JonesApr 19, 2016
  6. 2/4 http.c: implements the GIT_TRACE_CURL environment variableElia Pinto, Apr 19, 2016
  7. Junio C HamanoApr 19, 2016
  8. Junio C HamanoApr 19, 2016
  9. 3/4 git.txt: document the new GIT_TRACE_CURL environment variableElia Pinto, Apr 19, 2016
  10. 4/4 imap-send.c: introduce the GIT_TRACE_CURL enviroment variableElia Pinto, Apr 19, 2016
  11. Junio C HamanoApr 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.