mirror of
https://github.com/curl/curl.git
synced 2025-03-31 16:00:35 +08:00
smtp: Moved the per-request variables to the per-request data structure
Moved the rcpt variable from the per-connection struct smtp_conn to the new per-request struct and fixed references accordingly.
This commit is contained in:
parent
ed7d438a12
commit
8a468ef222
24
lib/smtp.c
24
lib/smtp.c
@ -1007,16 +1007,17 @@ static CURLcode smtp_mail(struct connectdata *conn)
|
||||
static CURLcode smtp_rcpt_to(struct connectdata *conn)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct SMTP *smtp = data->state.proto.smtp;
|
||||
|
||||
/* Send the RCPT TO command */
|
||||
if(smtpc->rcpt) {
|
||||
if(smtpc->rcpt->data[0] == '<')
|
||||
if(smtp->rcpt) {
|
||||
if(smtp->rcpt->data[0] == '<')
|
||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
|
||||
smtpc->rcpt->data);
|
||||
smtp->rcpt->data);
|
||||
else
|
||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>",
|
||||
smtpc->rcpt->data);
|
||||
smtp->rcpt->data);
|
||||
if(!result)
|
||||
state(conn, SMTP_RCPT);
|
||||
}
|
||||
@ -1030,6 +1031,7 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode,
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct SMTP *smtp = data->state.proto.smtp;
|
||||
|
||||
(void)instate; /* no use for this yet */
|
||||
|
||||
@ -1039,8 +1041,7 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode,
|
||||
state(conn, SMTP_STOP);
|
||||
}
|
||||
else {
|
||||
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
||||
smtpc->rcpt = data->set.mail_rcpt;
|
||||
smtp->rcpt = data->set.mail_rcpt;
|
||||
|
||||
result = smtp_rcpt_to(conn);
|
||||
}
|
||||
@ -1054,6 +1055,7 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct SMTP *smtp = data->state.proto.smtp;
|
||||
|
||||
(void)instate; /* no use for this yet */
|
||||
|
||||
@ -1063,14 +1065,12 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
|
||||
state(conn, SMTP_STOP);
|
||||
}
|
||||
else {
|
||||
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
||||
|
||||
if(smtpc->rcpt) {
|
||||
smtpc->rcpt = smtpc->rcpt->next;
|
||||
if(smtp->rcpt) {
|
||||
smtp->rcpt = smtp->rcpt->next;
|
||||
result = smtp_rcpt_to(conn);
|
||||
|
||||
/* If we failed or still are sending RCPT data then return */
|
||||
if(result || smtpc->rcpt)
|
||||
if(result || smtp->rcpt)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ struct SMTP {
|
||||
char *user; /* User name string */
|
||||
char *passwd; /* Password string */
|
||||
curl_pp_transfer transfer;
|
||||
struct curl_slist *rcpt; /* Recipient list */
|
||||
};
|
||||
|
||||
/* smtp_conn is used for struct connection-oriented data in the connectdata
|
||||
@ -74,7 +75,6 @@ struct smtp_conn {
|
||||
unsigned int authmechs; /* Accepted authentication mechanisms */
|
||||
unsigned int authused; /* Auth mechanism used for the connection */
|
||||
smtpstate state; /* Always use smtp.c:state() to change state! */
|
||||
struct curl_slist *rcpt; /* Recipient list */
|
||||
bool ssldone; /* Is connect() over SSL done? */
|
||||
bool tls_supported; /* StartTLS capability supported by server */
|
||||
bool size_supported; /* If server supports SIZE extension according to
|
||||
|
Loading…
x
Reference in New Issue
Block a user