Skip to content

Commit 230c09c

Browse files
mackylegitster
authored andcommitted
imap-send.c: set CURLOPT_USE_SSL to CURLUSESSL_TRY
According to the cURL documentation for the CURLOPT_USE_SSL option, it is only used with plain text protocols that get upgraded to SSL using the STARTTLS command. The server.use_ssl variable is only set when we are using a protocol that is already SSL/TLS (i.e. imaps), so setting CURLOPT_USE_SSL when the server.use_ssl variable is set has no effect whatsoever. Instead, set CURLOPT_USE_SSL to CURLUSESSL_TRY when the server.use_ssl variable is NOT set so that cURL will attempt to upgrade the plain text connection to SSL/TLS using STARTTLS in that case. This much more closely matches the behavior of the non-cURL code path. Signed-off-by: Kyle J. McKay <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d47e55d commit 230c09c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

imap-send.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,8 +1421,8 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
14211421
strbuf_release(&auth);
14221422
}
14231423

1424-
if (server.use_ssl)
1425-
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
1424+
if (!server.use_ssl)
1425+
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
14261426

14271427
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, server.ssl_verify);
14281428
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, server.ssl_verify);

0 commit comments

Comments
 (0)