Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed
From: Brandon Williams <hidden>
Date: 2016-12-14 20:52:38
On 12/14, Jeff King wrote:
On Wed, Dec 14, 2016 at 12:37:52PM -0800, Brandon Williams wrote:quoted
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 just override the CURLOPT_PROTOCOLS value when alternates are involved.No, because we may have many curl handles (especially for the http-walker, which wants to fetch several objects simultaneously), and they get recycled as needed for many requests. So setting a restriction there on slot->curl will only cover the one handle, and miss other ones which may be used later (and likewise, that one handle with the restriction may get recycled and used for a non-alternate fetch, and would be unnecessarily restrictive). That's why any curl-level settings have to happen when we call get_active_slot(), since that's when we know what we're actually using the handle for.
Fair enough, I figured there may be some reuse happening with the curl handles but didn't do enough digging to discover that myself. Thanks :) -- Brandon Williams