git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC] http_init: only initialize SSL for https

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 14, 2013, 15:23 UTC
Message-ID
<alpine.DEB.1.00.1303141621340.3794@s15462909.onlinehome-server.info>
In-Reply-To
<1363269079-6124-1-git-send-email-kusmabite@gmail.com>
Hi kusma,
On Thu, 14 Mar 2013, Erik Faye-Lund wrote:
Show 32 quoted lines
> 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!
Show 13 quoted lines
> 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?

Ciao, Dscho

-- 
-- 
*** 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.
Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 3 of 21 in “http_init: only initialize SSL for https”
  1. http_init: only initialize SSL for httpsErik Faye-Lund, Mar 14, 2013
  2. Erik Faye-LundMar 14, 2013
  3. Johannes SchindelinMar 14, 2013
  4. Erik Faye-LundMar 14, 2013
  5. Junio C HamanoMar 14, 2013
  6. Johannes SchindelinMar 14, 2013
  7. Junio C HamanoMar 14, 2013
  8. Erik Faye-LundMar 14, 2013
  9. Daniel StenbergMar 15, 2013
  10. Junio C HamanoMar 15, 2013
  11. Daniel StenbergMar 15, 2013
  12. Jeff KingMar 16, 2013
  13. Daniel StenbergMar 16, 2013
  14. Antoine PelisseMar 17, 2013
  15. Daniel StenbergMar 17, 2013
  16. Junio C HamanoMar 17, 2013
  17. Erik Faye-LundMar 18, 2013
  18. Erik Faye-LundMar 18, 2013
  19. Junio C HamanoMar 14, 2013
  20. Johannes SchindelinMar 14, 2013
  21. Junio C HamanoMar 14, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.