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

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:24

Johannes Schindelin [off-list ref] writes:
Apparently, ftps is also handled by cURL and most likely requires SSL.

How about optimizing for the common case and instead of prefixcmp(url,
"https:")) ask for !prefixcmp(url, "http:")?
I think that is a very sensible way to go.

As to ALL vs DEFAULT, given that its manual page is riddled with a
scary warning:

    This function must be called at least once within a program (a
    program is all the code that shares a memory space) before the
    program calls any other function in libcurl. The environment it sets
    up is constant for the life of the program and is the same for every
    program, so multiple calls have the same effect as one call.  ... In
    normal operation, you must specify CURL_GLOBAL_ALL. Don't use any
    other value unless you are familiar with it and mean to control
    internal operations of libcurl.

I think we should stick to ALL.  So

	flags = CURL_GLOBAL_ALL;
	if (!prefixcmp(url, "http:"))
		flags &= ~CURL_GLOBAL_SSL;

would be the way to go.

But this is assuming that nobody feeds our client a http:// URL to
the server that redirects us to the https:// version (or we do not
follow such a redirect).  I offhand do not know if that is a valid
assumption, 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.

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

From: Erik Faye-Lund <hidden>
Date: 2016-06-15 22:56:24

On Thu, Mar 14, 2013 at 11:45 PM, Junio C Hamano [off-list ref] wrote:
Johannes Schindelin [off-list ref] writes:
quoted
Apparently, ftps is also handled by cURL and most likely requires SSL.

How about optimizing for the common case and instead of prefixcmp(url,
"https:")) ask for !prefixcmp(url, "http:")?
I think that is a very sensible way to go.

As to ALL vs DEFAULT, given that its manual page is riddled with a
scary warning:

    This function must be called at least once within a program (a
    program is all the code that shares a memory space) before the
    program calls any other function in libcurl. The environment it sets
    up is constant for the life of the program and is the same for every
    program, so multiple calls have the same effect as one call.  ... In
    normal operation, you must specify CURL_GLOBAL_ALL. Don't use any
    other value unless you are familiar with it and mean to control
    internal operations of libcurl.

I think we should stick to ALL.  So

        flags = CURL_GLOBAL_ALL;
        if (!prefixcmp(url, "http:"))
                flags &= ~CURL_GLOBAL_SSL;

would be the way to go.

But this is assuming that nobody feeds our client a http:// URL to
the server that redirects us to the https:// version (or we do not
follow such a redirect).  I offhand do not know if that is a valid
assumption, though.
Thanks, both. Very sensible points. I'll re-roll a new version
tomorrow, but it could indeed be that the redirect-case can make this
a no-go.

-- 
-- 
*** 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.

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

From: Daniel Stenberg <hidden>
Date: 2016-06-15 22:56:24

On Thu, 14 Mar 2013, Junio C Hamano wrote:
As to ALL vs DEFAULT, given that its manual page is riddled with a scary 
warning:

   This function must be called at least once within a program (a
   program is all the code that shares a memory space) before the
   program calls any other function in libcurl. The environment it sets
   up is constant for the life of the program and is the same for every
   program, so multiple calls have the same effect as one call.  ... In
   normal operation, you must specify CURL_GLOBAL_ALL. Don't use any
   other value unless you are familiar with it and mean to control
   internal operations of libcurl.
(speaking from a libcurl perspective)

The "warning" is just there to scare people into actually consider what they 
want and understand that removing bits will change behavior. I would say 
that's exactly what you've done and I don't think people here need to be 
scared anymore! :-)

As for how ALL vs DEFAULT will act or differ in the future, I suspect that we 
will end up having them being the same (even when we add bits) as we've 
encouraged "ALL" in the documentation like this for quite some time.

-- 

  / daniel.haxx.se

-- 
-- 
*** 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help