From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] Work around curl-gnutls not liking to be reinitialized
Date: Sat, 9 Feb 2008 00:08:44 +0100 [thread overview]
Message-ID: <1202512124-28669-1-git-send-email-mh@glandium.org> (raw)
In-Reply-To: <alpine.LSU.1.00.0802082250550.11591@racer.site>
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 the 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>
---
> Don't you have to make this conditional on the CURL version as well? I
> mean, that cleanup:
> > 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
>
> requires us to init again, no?
Damn, you're right. But it would actually be better to just have the init
variable set to 0 again in http_cleanup, and actually, we already have a
global variable that is set in http_init and reset in http_cleanup that
could be used for this test...
http.c | 3 +++
transport.c | 2 ++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index d2c11ae..d69ba90 100644
--- a/http.c
+++ b/http.c
@@ -218,6 +218,9 @@ void http_init(void)
char *low_speed_limit;
char *low_speed_time;
+ if (pragma_header)
+ return;
+
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.8.g95ac
next prev parent reply other threads:[~2008-02-08 23:08 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 ` [PATCH v2] " Mike Hommey
2008-02-08 22:51 ` Johannes Schindelin
2008-02-08 23:08 ` Mike Hommey [this message]
2008-02-08 23:14 ` [PATCH] " 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=1202512124-28669-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).