mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
email: Another post optimisation of endofresp() tidy up
This commit is contained in:
parent
e6c1e773d9
commit
508cdf4da4
@ -339,6 +339,7 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
|
|||||||
if(len >= id_len + 3) {
|
if(len >= id_len + 3) {
|
||||||
if(!memcmp(id, line, id_len) && line[id_len] == ' ') {
|
if(!memcmp(id, line, id_len) && line[id_len] == ' ') {
|
||||||
*resp = line[id_len + 1]; /* O, N or B */
|
*resp = line[id_len + 1]; /* O, N or B */
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,6 +348,7 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
|
|||||||
if((len == 3 && !memcmp("+", line, 1)) ||
|
if((len == 3 && !memcmp("+", line, 1)) ||
|
||||||
(len >= 2 && !memcmp("+ ", line, 2))) {
|
(len >= 2 && !memcmp("+ ", line, 2))) {
|
||||||
*resp = '+';
|
*resp = '+';
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,12 +418,12 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we processing FETCH command responses? */
|
/* Are we processing FETCH command responses? */
|
||||||
if(imapc->state == IMAP_FETCH) {
|
else if(imapc->state == IMAP_FETCH) {
|
||||||
/* Do we have a valid response? */
|
/* Do we have a valid response? */
|
||||||
if(len >= 2 && !memcmp("* ", line, 2)) {
|
if(len >= 2 && !memcmp("* ", line, 2)) {
|
||||||
*resp = '*';
|
*resp = '*';
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
lib/pop3.c
22
lib/pop3.c
@ -216,10 +216,10 @@ static void pop3_to_pop3s(struct connectdata *conn)
|
|||||||
#define pop3_to_pop3s(x) Curl_nop_stmt
|
#define pop3_to_pop3s(x) Curl_nop_stmt
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Function that checks for an ending pop3 status code at the start of the
|
/* Function that checks for an ending POP3 status code at the start of the
|
||||||
given string, but also detects the APOP timestamp from the server greeting
|
given string, but also detects the APOP timestamp from the server greeting
|
||||||
as well as the supported authentication types and allowed SASL mechanisms
|
and various capabilities from the CAPA response including the supported
|
||||||
from the CAPA response. */
|
authentication types and allowed SASL mechanisms. */
|
||||||
static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
|
static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
|
||||||
int *resp)
|
int *resp)
|
||||||
{
|
{
|
||||||
@ -259,7 +259,6 @@ static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
|
|||||||
}
|
}
|
||||||
/* Are we processing CAPA command responses? */
|
/* Are we processing CAPA command responses? */
|
||||||
else if(pop3c->state == POP3_CAPA) {
|
else if(pop3c->state == POP3_CAPA) {
|
||||||
|
|
||||||
/* Do we have the terminating line? */
|
/* Do we have the terminating line? */
|
||||||
if(len >= 1 && !memcmp(line, ".", 1)) {
|
if(len >= 1 && !memcmp(line, ".", 1)) {
|
||||||
*resp = '+';
|
*resp = '+';
|
||||||
@ -330,14 +329,15 @@ static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((len < 1 || memcmp("+", line, 1)) &&
|
/* Do we have a command or continuation response? */
|
||||||
(len < 3 || memcmp("+OK", line, 3)))
|
if((len >= 3 && !memcmp("+OK", line, 3)) ||
|
||||||
|
(len >= 1 && !memcmp("+", line, 1))) {
|
||||||
|
*resp = '+';
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE; /* Nothing for us */
|
return FALSE; /* Nothing for us */
|
||||||
|
|
||||||
/* Otherwise it's a positive response */
|
|
||||||
*resp = '+';
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the ONLY way to change POP3 state! */
|
/* This is the ONLY way to change POP3 state! */
|
||||||
|
Loading…
Reference in New Issue
Block a user