mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
pop3: Introduced a custom POP3 structure for per-request data
Created a new POP3 structure and changed the type of the pop3 proto variable in connectdata from FTP* to POP*.
This commit is contained in:
parent
4cfc7f951c
commit
e2201dc849
18
lib/pop3.c
18
lib/pop3.c
@ -434,7 +434,7 @@ static CURLcode pop3_state_upgrade_tls(struct connectdata *conn)
|
||||
static CURLcode pop3_state_user(struct connectdata *conn)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct FTP *pop3 = conn->data->state.proto.pop3;
|
||||
struct POP3 *pop3 = conn->data->state.proto.pop3;
|
||||
|
||||
/* Check we have a username and password to authenticate with and end the
|
||||
connect phase if we don't */
|
||||
@ -1011,7 +1011,7 @@ static CURLcode pop3_state_user_resp(struct connectdata *conn, int pop3code,
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct FTP *pop3 = data->state.proto.pop3;
|
||||
struct POP3 *pop3 = data->state.proto.pop3;
|
||||
|
||||
(void)instate; /* no use for this yet */
|
||||
|
||||
@ -1064,7 +1064,7 @@ static CURLcode pop3_command(struct connectdata *conn)
|
||||
|
||||
if(pop3c->mailbox[0] != '\0') {
|
||||
/* Message specific LIST so skip the BODY transfer */
|
||||
struct FTP *pop3 = conn->data->state.proto.pop3;
|
||||
struct POP3 *pop3 = conn->data->state.proto.pop3;
|
||||
pop3->transfer = FTPTRANSFER_INFO;
|
||||
}
|
||||
}
|
||||
@ -1096,7 +1096,7 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn,
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct FTP *pop3 = data->state.proto.pop3;
|
||||
struct POP3 *pop3 = data->state.proto.pop3;
|
||||
struct pop3_conn *pop3c = &conn->proto.pop3c;
|
||||
struct pingpong *pp = &pop3c->pp;
|
||||
|
||||
@ -1289,10 +1289,10 @@ static CURLcode pop3_block_statemach(struct connectdata *conn)
|
||||
static CURLcode pop3_init(struct connectdata *conn)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct FTP *pop3 = data->state.proto.pop3;
|
||||
struct POP3 *pop3 = data->state.proto.pop3;
|
||||
|
||||
if(!pop3) {
|
||||
pop3 = data->state.proto.pop3 = calloc(sizeof(struct FTP), 1);
|
||||
pop3 = data->state.proto.pop3 = calloc(sizeof(struct POP3), 1);
|
||||
if(!pop3)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -1379,7 +1379,7 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status,
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct FTP *pop3 = data->state.proto.pop3;
|
||||
struct POP3 *pop3 = data->state.proto.pop3;
|
||||
struct pop3_conn *pop3c = &conn->proto.pop3c;
|
||||
|
||||
(void)premature;
|
||||
@ -1424,7 +1424,7 @@ static CURLcode pop3_perform(struct connectdata *conn, bool *connected,
|
||||
|
||||
if(conn->data->set.opt_no_body) {
|
||||
/* Requested no body means no transfer */
|
||||
struct FTP *pop3 = conn->data->state.proto.pop3;
|
||||
struct POP3 *pop3 = conn->data->state.proto.pop3;
|
||||
pop3->transfer = FTPTRANSFER_INFO;
|
||||
}
|
||||
|
||||
@ -1577,7 +1577,7 @@ static CURLcode pop3_parse_custom_request(struct connectdata *conn)
|
||||
/* Call this when the DO phase has completed */
|
||||
static CURLcode pop3_dophase_done(struct connectdata *conn, bool connected)
|
||||
{
|
||||
struct FTP *pop3 = conn->data->state.proto.pop3;
|
||||
struct POP3 *pop3 = conn->data->state.proto.pop3;
|
||||
|
||||
(void)connected;
|
||||
|
||||
|
13
lib/pop3.h
13
lib/pop3.h
@ -22,6 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include "pingpong.h"
|
||||
|
||||
/****************************************************************************
|
||||
* POP3 unique setup
|
||||
***************************************************************************/
|
||||
@ -50,6 +52,17 @@ typedef enum {
|
||||
POP3_LAST /* never used */
|
||||
} pop3state;
|
||||
|
||||
/* This POP3 struct is used in the SessionHandle. All POP3 data that is
|
||||
connection-oriented must be in pop3_conn to properly deal with the fact that
|
||||
perhaps the SessionHandle is changed between the times the connection is
|
||||
used. */
|
||||
struct POP3 {
|
||||
curl_off_t *bytecountp;
|
||||
char *user; /* User name string */
|
||||
char *passwd; /* Password string */
|
||||
curl_ftptransfer transfer;
|
||||
};
|
||||
|
||||
/* pop3_conn is used for struct connection-oriented data in the connectdata
|
||||
struct */
|
||||
struct pop3_conn {
|
||||
|
@ -1293,7 +1293,7 @@ struct UrlState {
|
||||
void *generic;
|
||||
struct SSHPROTO *ssh;
|
||||
struct IMAP *imap;
|
||||
struct FTP *pop3;
|
||||
struct POP3 *pop3;
|
||||
struct FTP *smtp;
|
||||
} proto;
|
||||
/* current user of this SessionHandle instance, or NULL */
|
||||
|
Loading…
Reference in New Issue
Block a user