Re: [PATCH] Work around curl-gnutls not liking to be reinitialized
- From
Mike Hommey <mh@glandium.org>
- Date
- Feb 8, 2008, 22:01 UTC
- Message-ID
- <20080208220123.GA21882@glandium.org>
- In-Reply-To
- <alpine.LSU.1.00.0802082152410.11591@racer.site>
On Fri, Feb 08, 2008 at 09:53:47PM +0000, Johannes Schindelin wrote:
Show 35 quoted lines
> Hi,
>
> On Fri, 8 Feb 2008, Mike Hommey wrote:
>
> > > In the end, it was a bit of git's fault, but either curl or gnutls is
> > > the actual culprit. I've not looked into either code to find out
> > > who's responsible, but a very simplified testcase is as follows:
> > >
> > > #include <curl/curl.h>
> > > #include <curl/easy.h>
> > >
> > > int main(void) {
> > > CURL *easy = curl_easy_init();
> > > curl_easy_setopt(easy, CURLOPT_VERBOSE, 1);
> > > curl_easy_setopt(easy, CURLOPT_URL, "https://www.verisign.com/");
> > > curl_easy_perform(easy);
> > > curl_global_cleanup();
> > > easy = curl_easy_init();
> > > curl_easy_setopt(easy, CURLOPT_VERBOSE, 1);
> > > curl_easy_setopt(easy, CURLOPT_URL, "https://www.verisign.com/");
> > > curl_easy_perform(easy);
> > > }
> > >
> > > (build with gcc -o test test.c -lcurl)
> > > (note curl_easy_init does curl_global_init behind the curtains,
> > > even the second time. You can convince yourself by adding
> > > curl_global_init(CURL_GLOBAL_ALL);)
> >
> > And the winner is... curl !
> > The bug was introduced in this commit:
> > http://cool.haxx.se/cvs.cgi/curl/lib/gtls.c.diff?r1=1.26&r2=1.27
> > Note how gtls_inited is not set back to FALSE in cleanup.
>
> Wow. I hope you used "git bisect", in order to spare you unnecessary
> work...This was actually easy to spot without. I was pretty sure something fishy was going on with the curl_global_cleanup code, so I followed it up to Curl_gtls_cleanup and there it was just under my eyes. I only had to use the annotate thingy in viewcvs (and leave out version 1.35 of the file, that does whitespace changes only).
Mike