aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-23 19:31:59 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-23 19:31:59 +0000
commited7d438a124a2504f07e19379cc90c45b530a8ea (patch)
treef7e48561cee15b570c0541f68d73979bcdeb1fbf
parent8960d81b0d0d883b3a755b02046d1622f6a2de8c (diff)
pop3: Introduced a custom SMTP structure for per-request data
Created a new SMTP structure and changed the type of the smtp proto variable in connectdata from FTP* to SMTP*.
-rw-r--r--lib/smtp.c12
-rw-r--r--lib/smtp.h11
-rw-r--r--lib/urldata.h2
3 files changed, 18 insertions, 7 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 727896e35..6e802b253 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -1091,7 +1091,7 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode,
smtpstate instate)
{
struct SessionHandle *data = conn->data;
- struct FTP *smtp = data->state.proto.smtp;
+ struct SMTP *smtp = data->state.proto.smtp;
(void)instate; /* no use for this yet */
@@ -1280,10 +1280,10 @@ static CURLcode smtp_block_statemach(struct connectdata *conn)
static CURLcode smtp_init(struct connectdata *conn)
{
struct SessionHandle *data = conn->data;
- struct FTP *smtp = data->state.proto.smtp;
+ struct SMTP *smtp = data->state.proto.smtp;
if(!smtp) {
- smtp = data->state.proto.smtp = calloc(sizeof(struct FTP), 1);
+ smtp = data->state.proto.smtp = calloc(sizeof(struct SMTP), 1);
if(!smtp)
return CURLE_OUT_OF_MEMORY;
}
@@ -1385,7 +1385,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
- struct FTP *smtp = data->state.proto.smtp;
+ struct SMTP *smtp = data->state.proto.smtp;
ssize_t bytes_written;
(void)premature;
@@ -1462,7 +1462,7 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
if(conn->data->set.opt_no_body) {
/* Requested no body means no transfer */
- struct FTP *smtp = conn->data->state.proto.smtp;
+ struct SMTP *smtp = conn->data->state.proto.smtp;
smtp->transfer = FTPTRANSFER_INFO;
}
@@ -1574,7 +1574,7 @@ static CURLcode smtp_disconnect(struct connectdata *conn,
/* Call this when the DO phase has completed */
static CURLcode smtp_dophase_done(struct connectdata *conn, bool connected)
{
- struct FTP *smtp = conn->data->state.proto.smtp;
+ struct SMTP *smtp = conn->data->state.proto.smtp;
(void)connected;
diff --git a/lib/smtp.h b/lib/smtp.h
index 514e6eb8a..f78e2c5b4 100644
--- a/lib/smtp.h
+++ b/lib/smtp.h
@@ -53,6 +53,17 @@ typedef enum {
SMTP_LAST /* never used */
} smtpstate;
+/* This SMTP struct is used in the SessionHandle. All SMTP data that is
+ connection-oriented must be in smtp_conn to properly deal with the fact that
+ perhaps the SessionHandle is changed between the times the connection is
+ used. */
+struct SMTP {
+ curl_off_t *bytecountp;
+ char *user; /* User name string */
+ char *passwd; /* Password string */
+ curl_pp_transfer transfer;
+};
+
/* smtp_conn is used for struct connection-oriented data in the connectdata
struct */
struct smtp_conn {
diff --git a/lib/urldata.h b/lib/urldata.h
index 5c4458f71..1cf7c38b0 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1294,7 +1294,7 @@ struct UrlState {
struct SSHPROTO *ssh;
struct IMAP *imap;
struct POP3 *pop3;
- struct FTP *smtp;
+ struct SMTP *smtp;
} proto;
/* current user of this SessionHandle instance, or NULL */
struct connectdata *current_conn;