From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH v2] Work around curl-gnutls not liking to be reinitialized
Date: Fri, 8 Feb 2008 23:22:39 +0100 [thread overview]
Message-ID: <1202509359-23840-1-git-send-email-mh@glandium.org> (raw)
In-Reply-To: <20080208220941.GA22199@glandium.org>
curl versions 7.16.3 to 7.18.0 included had a regression in which https
requests following curl_global_cleanup/init sequence would fail with ASN1
parser errors with curl-gnutls. Such sequences happen in some cases such
as git fetch.
We work around this by removing the http_cleanup call from get_refs_via_curl
for broken versions of curl, and allowing http_init to be called several
times without initializing http.c global variables again and leaking old
values, which is a safe thing to have unconditionally.
The remaining calls to http_cleanup are either last (http-push.c), or almost
never called (walker.c; the function it lies in is only called from
transport-disconnect, which is called last, and only in builtin-push.c)
These leaks shall be addressed in the http code refactoring.
Signed-off-by: Mike Hommey <mh@glandium.org>
---
http.c | 5 +++++
transport.c | 2 ++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index d2c11ae..a3aa9e9 100644
--- a/http.c
+++ b/http.c
@@ -215,9 +215,14 @@ static CURL* get_curl_handle(void)
void http_init(void)
{
+ static int init = 0;
char *low_speed_limit;
char *low_speed_time;
+ if (init)
+ return;
+ init = 1;
+
curl_global_init(CURL_GLOBAL_ALL);
pragma_header = curl_slist_append(pragma_header, "Pragma: no-cache");
diff --git a/transport.c b/transport.c
index babaa21..32ab521 100644
--- a/transport.c
+++ b/transport.c
@@ -473,7 +473,9 @@ static struct ref *get_refs_via_curl(struct transport *transport)
return NULL;
}
+#if (LIBCURL_VERSION_NUM < 0x071003) || (LIBCURL_VERSION_NUM > 0x071200)
http_cleanup();
+#endif
data = buffer.buf;
start = NULL;
--
1.5.4.7.gd8534-dirty
next prev parent reply other threads:[~2008-02-08 22:22 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-04 18:25 git-fetch in 1.5.4 fails versus 1.5.3.8 Anand Kumria
2008-02-05 5:07 ` Jeff King
2008-02-05 15:01 ` Jari Aalto
2008-02-06 21:56 ` Anand Kumria
2008-02-07 4:23 ` Jeff King
2008-02-07 6:37 ` Mike Hommey
2008-02-07 10:15 ` Anand Kumria
2008-02-07 11:06 ` Jeff King
2008-02-07 12:10 ` Mike Hommey
2008-02-07 12:28 ` Jeff King
2008-02-07 22:02 ` Mike Hommey
2008-02-08 0:32 ` Jeff King
2008-02-08 7:18 ` Mike Hommey
2008-02-08 7:34 ` Mike Hommey
2008-02-08 20:08 ` [PATCH] Work around curl-gnutls not liking to be reinitialized Mike Hommey
2008-02-08 21:31 ` Mike Hommey
2008-02-08 21:46 ` Junio C Hamano
2008-02-08 21:51 ` Mike Hommey
2008-02-08 22:09 ` Mike Hommey
2008-02-08 22:22 ` Mike Hommey [this message]
2008-02-08 22:51 ` [PATCH v2] " Johannes Schindelin
2008-02-08 23:08 ` [PATCH] " Mike Hommey
2008-02-08 23:14 ` Mike Hommey
2008-02-09 9:41 ` [PATCH v4] " Mike Hommey
2008-02-09 21:51 ` Daniel Stenberg
2008-02-09 9:44 ` [PATCH v2] " Florian Weimer
2008-02-09 10:43 ` Mike Hommey
2008-02-08 21:53 ` [PATCH] " Johannes Schindelin
2008-02-08 22:01 ` Mike Hommey
2008-02-09 2:28 ` Jeff King
2008-02-07 14:23 ` git-fetch in 1.5.4 fails versus 1.5.3.8 Frank Lichtenheld
2008-02-07 18:42 ` Linus Torvalds
2008-02-07 20:14 ` Frank Lichtenheld
2008-02-07 20:54 ` Linus Torvalds
2008-02-07 21:36 ` Anand Kumria
2008-02-07 20:40 ` Jeff King
2008-02-07 21:01 ` Linus Torvalds
2008-02-07 21:47 ` Martin Langhoff
2008-02-07 21:53 ` Dmitry Potapov
2008-02-07 22:46 ` Jeff King
2008-02-07 22:40 ` Jeff King
2008-02-07 23:23 ` Dmitry Potapov
2008-02-08 2:43 ` Anand Kumria
2008-02-08 13:27 ` Dmitry Potapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1202509359-23840-1-git-send-email-mh@glandium.org \
--to=mh@glandium.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).