smtp: use easy handle/connectin meta for proto structs

Move `struct smtp_conn` and `struct STMP` into the meta data at easy
handle/connection. Remove it from the unions at connectdata and request.

Closes #17257
This commit is contained in:
Stefan Eissing 2025-05-06 12:38:15 +02:00 committed by Daniel Stenberg
parent bc46ff2d2b
commit 7b92844639
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
5 changed files with 320 additions and 244 deletions

View File

@ -75,9 +75,9 @@ struct pingpong {
#define PINGPONG_SETUP(pp,s,e) \
do { \
pp->response_time = RESP_TIMEOUT; \
pp->statemachine = s; \
pp->endofresp = e; \
(pp)->response_time = RESP_TIMEOUT; \
(pp)->statemachine = s; \
(pp)->endofresp = e; \
} while(0)
/*

View File

@ -104,7 +104,6 @@ struct SingleRequest {
union {
struct FILEPROTO *file;
struct ldapreqinfo *ldap;
struct SMTP *smtp;
struct SSHPROTO *ssh;
struct TELNET *telnet;
} p;

File diff suppressed because it is too large Load Diff

View File

@ -27,60 +27,6 @@
#include "pingpong.h"
#include "curl_sasl.h"
/****************************************************************************
* SMTP unique setup
***************************************************************************/
typedef enum {
SMTP_STOP, /* do nothing state, stops the state machine */
SMTP_SERVERGREET, /* waiting for the initial greeting immediately after
a connect */
SMTP_EHLO,
SMTP_HELO,
SMTP_STARTTLS,
SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
(multi mode only) */
SMTP_AUTH,
SMTP_COMMAND, /* VRFY, EXPN, NOOP, RSET and HELP */
SMTP_MAIL, /* MAIL FROM */
SMTP_RCPT, /* RCPT TO */
SMTP_DATA,
SMTP_POSTDATA,
SMTP_QUIT,
SMTP_LAST /* never used */
} smtpstate;
/* This SMTP struct is used in the Curl_easy. All SMTP data that is
connection-oriented must be in smtp_conn to properly deal with the fact that
perhaps the Curl_easy is changed between the times the connection is
used. */
struct SMTP {
curl_pp_transfer transfer;
char *custom; /* Custom Request */
struct curl_slist *rcpt; /* Recipient list */
int rcpt_last_error; /* The last error received for RCPT TO command */
size_t eob; /* Number of bytes of the EOB (End Of Body) that
have been received so far */
BIT(rcpt_had_ok); /* Whether any of RCPT TO commands (depends on
total number of recipients) succeeded so far */
BIT(trailing_crlf); /* Specifies if the trailing CRLF is present */
};
/* smtp_conn is used for struct connection-oriented data in the connectdata
struct */
struct smtp_conn {
struct pingpong pp;
struct SASL sasl; /* SASL-related storage */
smtpstate state; /* Always use smtp.c:state() to change state! */
char *domain; /* Client address/name to send in the EHLO */
BIT(ssldone); /* Is connect() over SSL done? */
BIT(tls_supported); /* StartTLS capability supported by server */
BIT(size_supported); /* If server supports SIZE extension according to
RFC 1870 */
BIT(utf8_supported); /* If server supports SMTPUTF8 extension according
to RFC 6531 */
BIT(auth_supported); /* AUTH capability supported by server */
};
extern const struct Curl_handler Curl_handler_smtp;
extern const struct Curl_handler Curl_handler_smtps;

View File

@ -866,9 +866,6 @@ struct connectdata {
#ifdef USE_SSH
struct ssh_conn sshc;
#endif
#ifndef CURL_DISABLE_SMTP
struct smtp_conn smtpc;
#endif
#ifdef USE_LIBRTMP
void *rtmp;
#endif