From: Jeff King Date: Wed, 14 Dec 2016 20:41:02 GMT Subject: Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed Message-ID: <20161214204102.hwjb3i4aaxf3oigq@sigill.intra.peff.net> In-Reply-To: <20161214203752.GD20063@google.com> 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 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. -Peff