}
#endif /* !CURL_DISABLE_FTP */
+#ifndef CURL_DISABLE_SMTP
+struct curl_trc_feat Curl_trc_feat_smtp = {
+ "SMTP",
+ CURL_LOG_LVL_NONE,
+};
+
+void Curl_trc_smtp(struct Curl_easy *data, const char *fmt, ...)
+{
+ DEBUGASSERT(!strchr(fmt, '\n'));
+ if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_smtp)) {
+ va_list ap;
+ va_start(ap, fmt);
+ trc_infof(data, &Curl_trc_feat_smtp, fmt, ap);
+ va_end(ap);
+ }
+}
+#endif /* !CURL_DISABLE_SMTP */
+
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
struct curl_trc_feat Curl_trc_feat_ws = {
"WS",
#ifndef CURL_DISABLE_DOH
{ &Curl_doh_trc, TRC_CT_NETWORK },
#endif
+#ifndef CURL_DISABLE_SMTP
+ { &Curl_trc_feat_smtp, TRC_CT_PROTOCOL },
+#endif
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
{ &Curl_trc_feat_ws, TRC_CT_PROTOCOL },
#endif
do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_ftp)) \
Curl_trc_ftp(data, __VA_ARGS__); } while(0)
#endif /* !CURL_DISABLE_FTP */
+#ifndef CURL_DISABLE_SMTP
+#define CURL_TRC_SMTP(data, ...) \
+ do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_smtp)) \
+ Curl_trc_smtp(data, __VA_ARGS__); } while(0)
+#endif /* !CURL_DISABLE_SMTP */
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
#define CURL_TRC_WS(data, ...) \
do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_ws)) \
#ifndef CURL_DISABLE_FTP
#define CURL_TRC_FTP Curl_trc_ftp
#endif
+#ifndef CURL_DISABLE_SMTP
+#define CURL_TRC_SMTP Curl_trc_smtp
+#endif
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
#define CURL_TRC_WS Curl_trc_ws
#endif
void Curl_trc_ftp(struct Curl_easy *data,
const char *fmt, ...) CURL_PRINTF(2, 3);
#endif
+#ifndef CURL_DISABLE_SMTP
+extern struct curl_trc_feat Curl_trc_feat_smtp;
+void Curl_trc_smtp(struct Curl_easy *data,
+ const char *fmt, ...) CURL_PRINTF(2, 3);
+#endif
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
extern struct curl_trc_feat Curl_trc_feat_ws;
void Curl_trc_ws(struct Curl_easy *data,
(void)data; (void)fmt;
}
#endif
+#ifndef CURL_DISABLE_SMTP
+static void Curl_trc_smtp(struct Curl_easy *data, const char *fmt, ...)
+{
+ (void)data; (void)fmt;
+}
+#endif
#endif /* !defined(CURL_DISABLE_VERBOSE_STRINGS) */
static void smtp_state(struct Curl_easy *data, smtpstate newstate)
{
struct smtp_conn *smtpc = &data->conn->proto.smtpc;
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
/* for debug purposes */
static const char * const names[] = {
"STOP",
};
if(smtpc->state != newstate)
- infof(data, "SMTP %p state change from %s to %s",
- (void *)smtpc, names[smtpc->state], names[newstate]);
+ CURL_TRC_SMTP(data, "state change from %s to %s",
+ names[smtpc->state], names[newstate]);
#endif
smtpc->state = newstate;
/* Clear the transfer mode for the next request */
smtp->transfer = PPTRANSFER_BODY;
-
+ CURL_TRC_SMTP(data, "smtp_done(status=%d, premature=%d) -> %d",
+ status, premature, result);
return result;
}
CURLcode result = CURLE_OK;
struct SMTP *smtp = data->req.p.smtp;
- DEBUGF(infof(data, "DO phase starts"));
+ CURL_TRC_SMTP(data, "smtp_perform(), start");
if(data->req.no_body) {
/* Requested no body means no transfer */
result = smtp_perform_command(data);
if(result)
- return result;
+ goto out;
/* Run the state-machine */
result = smtp_multi_statemach(data, dophase_done);
*connected = Curl_conn_is_connected(data->conn, FIRSTSOCKET);
- if(*dophase_done)
- DEBUGF(infof(data, "DO phase is complete"));
-
+out:
+ CURL_TRC_SMTP(data, "smtp_perform() -> %d, connected=%d, done=%d",
+ result, *connected, *dophase_done);
return result;
}
return result;
result = smtp_regular_transfer(data, done);
-
+ CURL_TRC_SMTP(data, "smtp_do() -> %d, done=%d", result, *done);
return result;
}
/* Cleanup our connection based variables */
Curl_safefree(smtpc->domain);
+ CURL_TRC_SMTP(data, "smtp_disconnect(), finished");
return CURLE_OK;
}
DEBUGF(infof(data, "DO phase is complete"));
}
+ CURL_TRC_SMTP(data, "smtp_doing() -> %d, done=%d", result, *dophase_done);
return result;
}
if(!result && *dophase_done)
result = smtp_dophase_done(data, connected);
+ CURL_TRC_SMTP(data, "smtp_regular_transfer() -> %d, done=%d",
+ result, *dophase_done);
return result;
}
/* Initialise the SMTP layer */
result = smtp_init(data);
- if(result)
- return result;
-
- return CURLE_OK;
+ CURL_TRC_SMTP(data, "smtp_setup_connection() -> %d", result);
+ return result;
}
/***********************************************************************