{"thread":{"id":"1353","subject":"[PATCH] support older versions of libcurl","startedAt":"2005-07-28T14:49:21Z","lastAt":"2005-07-29T10:23:27Z","messageCount":3,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6504","messageId":"Pine.LNX.4.58.0507281648390.25783@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1353","inReplyTo":null,"subject":"[PATCH] support older versions of libcurl","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-07-28T14:49:21Z","receivedAt":"2005-07-28T14:49:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSome newer features of libcurl are used which are not strictly necessary\nfor http-pull. Use them only if libcurl is new enough to know about them.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n http-pull.c |    6 ++++++\n 1 files changed, 6 insertions\n\ndiff --git a/http-pull.c b/http-pull.c\n--- a/http-pull.c\n+++ b/http-pull.c\n@@ -171,19 +171,25 @@ int main(int argc, char **argv)\n \tcommit_id = argv[arg];\n \turl = argv[arg + 1];\n\n+#if LIBCURL_VERSION_NUM >= 0x070800\n \tcurl_global_init(CURL_GLOBAL_ALL);\n+#endif\n\n \tcurl = curl_easy_init();\n\n \tcurl_ssl_verify = gitenv(\"GIT_SSL_NO_VERIFY\") ? 0 : 1;\n \tcurl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);\n+#if LIBCURL_VERSION_NUM >= 0x070907\n \tcurl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);\n+#endif\n\n \tbase = url;\n\n \tif (pull(commit_id))\n \t\treturn 1;\n\n+#if LIBCURL_VERSION_NUM >= 0x070704\n \tcurl_global_cleanup();\n+#endif\n \treturn 0;\n }\n"},{"id":"6539","messageId":"7vll3qqrhu.fsf@assigned-by-dhcp.cox.net","threadId":"1353","inReplyTo":"Pine.LNX.4.58.0507281648390.25783@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] support older versions of libcurl","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-29T02:24:13Z","receivedAt":"2005-07-29T02:24:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Some newer features of libcurl are used which are not strictly necessary\n> for http-pull. Use them only if libcurl is new enough to know about them.\n\nDo you need to check against that many versions?  Especially\ncleanup and init not depending on the same version number looks\nreally suspicious.\n\nAssuming that the answer is still yes, how about doing things\nthis way instead?\n\n---\n\ndiff --git a/http-pull.c b/http-pull.c\n--- a/http-pull.c\n+++ b/http-pull.c\n@@ -6,6 +6,16 @@\n #include <curl/curl.h>\n #include <curl/easy.h>\n \n+#if LIBCURL_VERSION_NUM < 0x070704\n+#define curl_global_cleanup() do { /* nothing */ } while(0)\n+#endif\n+#if LIBCURL_VERSION_NUM < 0x070800\n+#define curl_global_init(a) do { /* nothing */ } while(0)\n+#endif\n+#if LIBCURL_VERSION_NUM < 0x070907\n+#define curl_easy_setopt(a, b, c) do { /* nothing */ } while(0)\n+#endif\n+\n static CURL *curl;\n \n static char *base;\n"},{"id":"6574","messageId":"Pine.LNX.4.58.0507291220350.5849@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1353","inReplyTo":"7vll3qqrhu.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] support older versions of libcurl","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-07-29T10:23:27Z","receivedAt":"2005-07-29T10:23:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 28 Jul 2005, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n> > Some newer features of libcurl are used which are not strictly necessary\n> > for http-pull. Use them only if libcurl is new enough to know about them.\n>\n> Do you need to check against that many versions?  Especially\n> cleanup and init not depending on the same version number looks\n> really suspicious.\n\nI investigated the issue using curl's CVS. The different version numbers\nare easily explained: While curl_global_init is defined starting from\n0x070704, CURL_GLOBAL_ALL is only defined starting from 0x070800.\n\n> Assuming that the answer is still yes, how about doing things\n> this way instead?\n\nLooks better.\n\nCiao,\nDscho\n"}]}