Hi Aditya
On 28/05/2025 18:17, Aditya Garg wrote:
Currently, imap-send allows the user to choose between libcurl and
openssl in case Git is compiled with both libraries only using the
command line, and no option to set a default using the config is
available. Add support for the same.
I'm wondering why anyone would want to switch the backend at run-time?
There has been talk in the past about removing the openssl code [1] and
just relying on the curl backend. I think that is a worthwhile goal as
it simplifies the code and means we would avoid having to worry about
whether we're using openssl correctly [2]. That would be harder to do if
we add this config setting. If we don't already do so, perhaps we could
start using libcurl even when openssl is also available though that does
not need to be part of this patch series.
Best Wishes
Phillip
[1] https://lore.kernel.org/git/Y+LNitGAude1vogv@xxxxxxxxxxxxxxxxxxxxxxx/
[2]
https://lore.kernel.org/git/pull.1886.git.1742819282360.gitgitgadget@xxxxxxxxx/
Signed-off-by: Aditya Garg <gargaditya08@xxxxxxxx>
---
Documentation/config/imap.adoc | 7 +++++++
Documentation/git-imap-send.adoc | 4 ++--
imap-send.c | 2 ++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Documentation/config/imap.adoc b/Documentation/config/imap.adoc
index 829d9e0bac..608c0be7ab 100644
--- a/Documentation/config/imap.adoc
+++ b/Documentation/config/imap.adoc
@@ -25,6 +25,13 @@ imap.port::
Defaults to 143 for imap:// hosts and 993 for imaps:// hosts.
Ignored when imap.tunnel is set.
+imap.usecurl::
+ A boolean to choose whether to use libcurl or not to communicate
+ with the IMAP server.
+ Ignored if Git was built without `USE_CURL_FOR_IMAP_SEND` option
+ or with `NO_OPENSSL` option set.
+ `--[no]-curl` argument will override this option.
+
imap.sslverify::
A boolean to enable/disable verification of the server certificate
used by the SSL/TLS connection. Default is `true`. Ignored when
diff --git a/Documentation/git-imap-send.adoc b/Documentation/git-imap-send.adoc
index a35f278baf..cbbe534ec2 100644
--- a/Documentation/git-imap-send.adoc
+++ b/Documentation/git-imap-send.adoc
@@ -46,12 +46,12 @@ OPTIONS
--curl::
Use libcurl to communicate with the IMAP server, unless tunneling
- into it. Ignored if Git was built without the USE_CURL_FOR_IMAP_SEND
+ into it. Ignored if Git was built without the `USE_CURL_FOR_IMAP_SEND`
option set.
--no-curl::
Talk to the IMAP server using git's own IMAP routines instead of
- using libcurl. Ignored if Git was built with the NO_OPENSSL option
+ using libcurl. Ignored if Git was built with the `NO_OPENSSL` option
set.
diff --git a/imap-send.c b/imap-send.c
index 337f1049ca..b08ec0e1d5 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1559,6 +1559,8 @@ static int git_imap_config(const char *var, const char *val,
return git_config_string(&cfg->auth_method, var, val);
} else if (!strcmp("imap.port", var)) {
cfg->port = git_config_int(var, val, ctx->kvi);
+ } else if (!strcmp("imap.usecurl", var)) {
+ use_curl = git_config_bool(var, val);
} else if (!strcmp("imap.host", var)) {
if (!val) {
return config_error_nonbool(var);