Re: [PATCH v2 1/1] remote-curl: unbreak http.extraHeader with custom allocators
- From
Jeff King <peff@peff.net>
- Date
- Nov 6, 2019, 11:29 UTC
- Message-ID
- <20191106112901.GA25966@sigill.intra.peff.net>
- In-Reply-To
- <3168ba2c9eadcf0cd7e4f2533c9306b5d2c627d0.1573034695.git.gitgitgadget@gmail.com>
On Wed, Nov 06, 2019 at 10:04:55AM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 8 quoted lines
> A naïve attempt at fixing this would move the call to > `curl_global_init()` _before_ the config is parsed (i.e. before that > call to `slist_append()`). > > However, that does work, as we _also_ parse the config setting > `http.sslbackend` and if found, call `curl_global_sslset()` which *must* > be called before `curl_global_init()`, for details see: > https://curl.haxx.se/libcurl/c/curl_global_sslset.html
Yikes, good catch. It didn't even occur to me that there might be curl things we had to do _before_ calling curl_global_init().
> So let's instead make the config parsing entirely independent from > cURL's data structures. Incidentally, this deletes two more lines than > it introduces, which is nice.
Yes, I actually find the resulting code easier to read. I had feared having to add an extra step to initialize the slist, but it's all handled quite neatly in http_copy_default_headers().
> http.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-)
The patch itself looks good to me.
-Peff