From 60a36fc394fbf4e17f0a8c5ca8b1a97b3a54da8b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 5 Jun 1998 17:23:30 +0000 Subject: Reinstate the fetchall kluge. svn path=/trunk/; revision=1914 --- pop3.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'pop3.c') diff --git a/pop3.c b/pop3.c index f27b3804..ae0d51a0 100644 --- a/pop3.c +++ b/pop3.c @@ -234,8 +234,8 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) */ sleep(3); /* to be _really_ safe, probably need sleep(5)! */ - /* we're peek-capable because the TOP command exists */ - peek_capable = TRUE; + /* we're peek-capable if use of TOP is enabled */ + peek_capable = !(ctl->fetchall || ctl->keep); /* we're approved */ return(PS_SUCCESS); @@ -534,6 +534,12 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp) * In that case, marking the seen flag is the only way to prevent the * message from being re-fetched on subsequent runs. * + * Also use RETR if fetchall is on. This gives us a workaround + * for servers like usa.net's that bungle TOP. It's pretty + * harmless because fetchall guarantees that any message dropped + * by an interrupted RETR will be picked up on the next poll of the + * site. + * * We take advantage here of the fact that, according to all the * POP RFCs, "if the number of lines requested by the POP3 client * is greater than than the number of lines in the body, then the @@ -543,7 +549,7 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp) * accept; it's much lower than the natural value 2147483646 (the maximum * twos-complement signed 32-bit integer minus 1) */ - if (ctl->keep) + if (ctl->keep || ctl->fetchall) gen_send(sock, "RETR %d", number); else gen_send(sock, "TOP %d 99999999", number); -- cgit v1.2.3