Re: [PATCH/RFC] http_init: only initialize SSL for https
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Mar 14, 2013, 15:36 UTC
- Message-ID
- <CABPQNSZNdGea9Nn91emWhfRGAZjZXm755UKArNr3EUy9CrSKHg@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.1.00.1303141621340.3794@s15462909.onlinehome-server.info>
On Thu, Mar 14, 2013 at 4:23 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 63 quoted lines
> Hi kusma, > > On Thu, 14 Mar 2013, Erik Faye-Lund wrote: > >> Since ancient times, we have been calling curl_global_init with the >> CURL_GLOBAL_ALL-flag, which initializes SSL (and the Win32 socket >> stack on Windows). >> >> Initializing SSL takes quite some time on Windows, so let's avoid >> doing it when it's not needed. >> >> timing of echo "" | ./git-remote-http.exe origin http://localhost >> >> before >> >> best of 10 runs: >> real 0m1.634s >> user 0m0.015s >> sys 0m0.000s >> >> worst of 10 runs: >> real 0m2.701s >> user 0m0.000s >> sys 0m0.000s >> >> after >> >> best of 10 runs: >> real 0m0.018s >> user 0m0.000s >> sys 0m0.000s >> >> worst of 10 runs: >> real 0m0.024s >> user 0m0.000s >> sys 0m0.015s > > Good analysis! > >> diff --git a/http.c b/http.c >> index 3b312a8..528a736 100644 >> --- a/http.c >> +++ b/http.c >> @@ -343,7 +343,8 @@ void http_init(struct remote *remote, const char *url, int proactive_auth) >> >> git_config(http_options, NULL); >> >> - curl_global_init(CURL_GLOBAL_ALL); >> + curl_global_init(CURL_GLOBAL_WIN32 | (prefixcmp(url, "https:") ? 0 : >> + CURL_GLOBAL_SSL)); >> >> http_proactive_auth = proactive_auth; > > I wonder whether we want to have something like this instead: > > flags = CURL_GLOBAL_ALL; > if (prefixcmp(url, "https:")) > flags &= ^CURL_GLOBAL_SSL; > curl_global_init(flags); > > I do see that CURL_GLOBAL_ALL is #define'd as CURL_GLOBAL_WIN32 | > CURL_GLOBAL_SSL in curl.h, but that might change in the future, no? >
Good suggestion. But perhaps we'd want to use CURL_GLOBAL_DEFAULT instead? I'm thinking that this define is probably what they'd include any essential flags, but not non-essential flags. CURL_GLOBAL_ALL might be extended to include initialization bits for other transports, for instance... but this feels a bit hand-wavy. Simply masking out the CURL_GLOBAL_SSL-flag would probably be the smallest logical change.
I don't have any strong feeling on this, really. I'd like to hear what other people think, though.
-- -- *** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to msysgit@googlegroups.com To unsubscribe from this group, send email to msysgit+unsubscribe@googlegroups.com For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en --- You received this message because you are subscribed to the Google Groups "msysGit" group. To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.