Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Jeff King
On Wed, Dec 14, 2016 at 04:29:52PM -0600, Blake Burkhart wrote: > You may want to set CURLOPT_DEFAULT_PROTOCOL if we don't already. Apparently > the default value of NULL causes it to make a guess based on the host if no > protocol is present. But you are discussing a situation where "http://; is

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Wed, Dec 14, 2016 at 03:33:49PM -0500, Jeff King wrote: > > > One other "simple" fix is at the moment we parse http-alternates, to > > parse the URL ourself and check the policy. Like: > > [...] > > I may have convinced myself this is a reasonable approach. > > So

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Jeff King
On Wed, Dec 14, 2016 at 03:33:49PM -0500, Jeff King wrote: > One other "simple" fix is at the moment we parse http-alternates, to > parse the URL ourself and check the policy. Like: > [...] > I may have convinced myself this is a reasonable approach. So here it is in patch form, with a test. I

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Wed, Dec 14, 2016 at 12:37:52PM -0800, Brandon Williams wrote: > > > Naively looking at the code (and your longer suggestion), is there a > > reason why we couldn't simply have http-walker set CURLOPT_PROTOCOLS > > with get_curl_allowed_protocols(0) in the

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Jeff King
On Wed, Dec 14, 2016 at 12:37:52PM -0800, Brandon Williams wrote: > Naively looking at the code (and your longer suggestion), is there a > reason why we couldn't simply have http-walker set CURLOPT_PROTOCOLS > with get_curl_allowed_protocols(0) in the fetch_alternates() function? > That way we

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Brandon Williams wrote: > On 12/14, Jeff King wrote: > > On Tue, Dec 13, 2016 at 05:40:37PM -0800, Brandon Williams wrote: > > > > > Add the from_user parameter to the 'is_transport_allowed' function. > > > This allows callers to query if a transport protocol is allowed, given > > >

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Jeff King
On Wed, Dec 14, 2016 at 12:13:23PM -0800, Brandon Williams wrote: > > I find it unlikely that anybody would ever care, but at least we'd do > > the safe thing. I dunno. Maybe I am just being lazy. > > Well, that's unfortunate! It does sound like a more full-proof solution > to these dumb http

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Tue, Dec 13, 2016 at 05:40:37PM -0800, Brandon Williams wrote: > > > Add the from_user parameter to the 'is_transport_allowed' function. > > This allows callers to query if a transport protocol is allowed, given > > that the caller knows that the protocol is coming

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Jeff King
On Tue, Dec 13, 2016 at 05:40:37PM -0800, Brandon Williams wrote: > Add the from_user parameter to the 'is_transport_allowed' function. > This allows callers to query if a transport protocol is allowed, given > that the caller knows that the protocol is coming from the user (1) or > not from the

[PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-13 Thread Brandon Williams
Add the from_user parameter to the 'is_transport_allowed' function. This allows callers to query if a transport protocol is allowed, given that the caller knows that the protocol is coming from the user (1) or not from the user (0) such as redirects in libcurl. If unknown a -1 should be provided