aboutsummaryrefslogtreecommitdiff
path: root/lib/pop3.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-12 23:00:34 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-12 23:00:34 +0000
commit508cdf4da4d767b76ff8198f11fd8ae6128144ad (patch)
tree35f52051df6eef9987e9ada512d204075cbb5950 /lib/pop3.c
parente6c1e773d9e506ead2a9fd5fc0f31dceca5e2784 (diff)
email: Another post optimisation of endofresp() tidy up
Diffstat (limited to 'lib/pop3.c')
-rw-r--r--lib/pop3.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/pop3.c b/lib/pop3.c
index 3fbe14e61..65450674c 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -216,10 +216,10 @@ static void pop3_to_pop3s(struct connectdata *conn)
#define pop3_to_pop3s(x) Curl_nop_stmt
#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
- as well as the supported authentication types and allowed SASL mechanisms
- from the CAPA response. */
+ and various capabilities from the CAPA response including the supported
+ authentication types and allowed SASL mechanisms. */
static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
int *resp)
{
@@ -259,7 +259,6 @@ static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
}
/* Are we processing CAPA command responses? */
else if(pop3c->state == POP3_CAPA) {
-
/* Do we have the terminating line? */
if(len >= 1 && !memcmp(line, ".", 1)) {
*resp = '+';
@@ -330,14 +329,15 @@ static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len,
return FALSE;
}
- if((len < 1 || memcmp("+", line, 1)) &&
- (len < 3 || memcmp("+OK", line, 3)))
- return FALSE; /* Nothing for us */
+ /* Do we have a command or continuation response? */
+ if((len >= 3 && !memcmp("+OK", line, 3)) ||
+ (len >= 1 && !memcmp("+", line, 1))) {
+ *resp = '+';
- /* Otherwise it's a positive response */
- *resp = '+';
+ return TRUE;
+ }
- return TRUE;
+ return FALSE; /* Nothing for us */
}
/* This is the ONLY way to change POP3 state! */