From: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
To: <git@vger.kernel.org>
Subject: [PATCH 3/4] imap_send: setup_curl: use server_conf parameter instead of the global variable
Date: Mon, 7 Aug 2017 16:04:01 +0200 [thread overview]
Message-ID: <4a1f931c-9813-36a5-9c37-63b8abc4fecd@morey-chaisemartin.com> (raw)
In-Reply-To: <c74c8c386f2c2d8b6cebd4addf925d0121986067.1502114584.git.nicolas@morey-chaisemartin.com>
Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
---
imap-send.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 682a06551..90b8683ed 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1415,37 +1415,37 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
if (!curl)
die("curl_easy_init failed");
- server_fill_credential(&server);
- curl_easy_setopt(curl, CURLOPT_USERNAME, server.user);
- curl_easy_setopt(curl, CURLOPT_PASSWORD, server.pass);
+ server_fill_credential(srvc);
+ curl_easy_setopt(curl, CURLOPT_USERNAME, srvc->user);
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, srvc->pass);
- strbuf_addstr(&path, server.use_ssl ? "imaps://" : "imap://");
- strbuf_addstr(&path, server.host);
+ strbuf_addstr(&path, srvc->use_ssl ? "imaps://" : "imap://");
+ strbuf_addstr(&path, srvc->host);
if (!path.len || path.buf[path.len - 1] != '/')
strbuf_addch(&path, '/');
- strbuf_addstr(&path, server.folder);
+ strbuf_addstr(&path, srvc->folder);
curl_easy_setopt(curl, CURLOPT_URL, path.buf);
strbuf_release(&path);
- curl_easy_setopt(curl, CURLOPT_PORT, server.port);
+ curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
- if (server.auth_method) {
+ if (srvc->auth_method) {
#if LIBCURL_VERSION_NUM < 0x072200
warning("No LOGIN_OPTIONS support in this cURL version");
#else
struct strbuf auth = STRBUF_INIT;
strbuf_addstr(&auth, "AUTH=");
- strbuf_addstr(&auth, server.auth_method);
+ strbuf_addstr(&auth, srvc->auth_method);
curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, auth.buf);
strbuf_release(&auth);
#endif
}
- if (!server.use_ssl)
+ if (!srvc->use_ssl)
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, server.ssl_verify);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, server.ssl_verify);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, srvc->ssl_verify);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, srvc->ssl_verify);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
--
2.14.0.rc1.16.g87fcec1e8
next prev parent reply other threads:[~2017-08-07 14:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c74c8c386f2c2d8b6cebd4addf925d0121986067.1502114584.git.nicolas@morey-chaisemartin.com>
2017-08-07 14:03 ` [PATCH 2/4] imap_send: setup_curl: prompt user for username/password if not set in config file Nicolas Morey-Chaisemartin
2017-08-07 14:04 ` Nicolas Morey-Chaisemartin [this message]
2017-08-07 16:34 ` [PATCH 3/4] imap_send: setup_curl: use server_conf parameter instead of the global variable Martin Ågren
2017-08-07 17:06 ` Nicolas Morey-Chaisemartin
2017-08-07 19:50 ` Jeff King
2017-08-07 14:04 ` [PATCH 4/4] imap-send: use curl by default Nicolas Morey-Chaisemartin
2017-08-07 16:37 ` Martin Ågren
2017-08-07 17:10 ` Nicolas Morey-Chaisemartin
2017-08-07 17:37 ` Martin Ågren
2017-08-07 20:01 ` Jeff King
2017-09-12 6:46 ` Junio C Hamano
2017-09-12 7:02 ` Junio C Hamano
2017-09-12 8:24 ` Nicolas Morey-Chaisemartin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a1f931c-9813-36a5-9c37-63b8abc4fecd@morey-chaisemartin.com \
--to=nicolas@morey-chaisemartin.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).