* [PATCH] support older versions of libcurl
@ 2005-07-28 14:49 Johannes Schindelin
2005-07-29 2:24 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2005-07-28 14:49 UTC (permalink / raw)
To: git
Some newer features of libcurl are used which are not strictly necessary
for http-pull. Use them only if libcurl is new enough to know about them.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
http-pull.c | 6 ++++++
1 files changed, 6 insertions
diff --git a/http-pull.c b/http-pull.c
--- a/http-pull.c
+++ b/http-pull.c
@@ -171,19 +171,25 @@ int main(int argc, char **argv)
commit_id = argv[arg];
url = argv[arg + 1];
+#if LIBCURL_VERSION_NUM >= 0x070800
curl_global_init(CURL_GLOBAL_ALL);
+#endif
curl = curl_easy_init();
curl_ssl_verify = gitenv("GIT_SSL_NO_VERIFY") ? 0 : 1;
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
+#if LIBCURL_VERSION_NUM >= 0x070907
curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
+#endif
base = url;
if (pull(commit_id))
return 1;
+#if LIBCURL_VERSION_NUM >= 0x070704
curl_global_cleanup();
+#endif
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] support older versions of libcurl
2005-07-28 14:49 [PATCH] support older versions of libcurl Johannes Schindelin
@ 2005-07-29 2:24 ` Junio C Hamano
2005-07-29 10:23 ` Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2005-07-29 2:24 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Some newer features of libcurl are used which are not strictly necessary
> for http-pull. Use them only if libcurl is new enough to know about them.
Do you need to check against that many versions? Especially
cleanup and init not depending on the same version number looks
really suspicious.
Assuming that the answer is still yes, how about doing things
this way instead?
---
diff --git a/http-pull.c b/http-pull.c
--- a/http-pull.c
+++ b/http-pull.c
@@ -6,6 +6,16 @@
#include <curl/curl.h>
#include <curl/easy.h>
+#if LIBCURL_VERSION_NUM < 0x070704
+#define curl_global_cleanup() do { /* nothing */ } while(0)
+#endif
+#if LIBCURL_VERSION_NUM < 0x070800
+#define curl_global_init(a) do { /* nothing */ } while(0)
+#endif
+#if LIBCURL_VERSION_NUM < 0x070907
+#define curl_easy_setopt(a, b, c) do { /* nothing */ } while(0)
+#endif
+
static CURL *curl;
static char *base;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] support older versions of libcurl
2005-07-29 2:24 ` Junio C Hamano
@ 2005-07-29 10:23 ` Johannes Schindelin
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2005-07-29 10:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Thu, 28 Jul 2005, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Some newer features of libcurl are used which are not strictly necessary
> > for http-pull. Use them only if libcurl is new enough to know about them.
>
> Do you need to check against that many versions? Especially
> cleanup and init not depending on the same version number looks
> really suspicious.
I investigated the issue using curl's CVS. The different version numbers
are easily explained: While curl_global_init is defined starting from
0x070704, CURL_GLOBAL_ALL is only defined starting from 0x070800.
> Assuming that the answer is still yes, how about doing things
> this way instead?
Looks better.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-07-29 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-28 14:49 [PATCH] support older versions of libcurl Johannes Schindelin
2005-07-29 2:24 ` Junio C Hamano
2005-07-29 10:23 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox