aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-06-14 18:15:57 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-06-14 18:15:57 +0000
commit05581922ac0ad62541057bf2d7b5d28189d59cbc (patch)
tree9f4e997162673e9d29087107b82b6c19a1ac73c4
parentbeb2400cca418bc16c8b76dae8f08f7d4f9e400d (diff)
downloadfetchmail-05581922ac0ad62541057bf2d7b5d28189d59cbc.tar.gz
fetchmail-05581922ac0ad62541057bf2d7b5d28189d59cbc.tar.bz2
fetchmail-05581922ac0ad62541057bf2d7b5d28189d59cbc.zip
Don't rely on the size being in POP3's fetch response any more.
svn path=/trunk/; revision=1098
-rw-r--r--Makefile.in2
-rw-r--r--NEWS7
-rw-r--r--driver.c32
-rw-r--r--etrn.c1
-rw-r--r--fetchmail-FAQ.html28
-rw-r--r--fetchmail.h1
-rw-r--r--imap.c1
-rw-r--r--pop2.c1
-rw-r--r--pop3.c16
9 files changed, 26 insertions, 63 deletions
diff --git a/Makefile.in b/Makefile.in
index f5ffc919..2021c874 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3,7 +3,7 @@
# If you're running QNX, we can't assume a working autoconf.
# So just uncomment all the lines marked QNX.
-VERS=4.0.0
+VERS=3.9.8
# Ultrix 2.2 make doesn't expand the value of VPATH.
srcdir = @srcdir@
diff --git a/NEWS b/NEWS
index 39f2e973..6c28dac4 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@
Release Notes:
------------------------------------------------------------------------------
-fetchmail-4.0 ():
+fetchmail-3.9.8 ():
* Fetchmail is now normally built with optimization.
* POP2 support is no longer compiled by default, but you can configure
it in with `configure --enable-POP2'.
@@ -28,9 +28,10 @@ fetchmail-4.0 ():
* Values of --limit, --fetchlimit, and --batchlimit in .fetchmailrc can now
be overridden from the command line by specifying an explicit option of 0.
* Architecture-independent RPM building.
-* Work with the MercuryP/NLM v1.31 POP3 daemon (thanks to Pavel Kankovsky).
+* Fix code to work correctly with POP3 servers that don't return a reliable
+ size in the response to FETCH.
-There are 258 people on the fetchmail-friends list.
+There are 261 people on the fetchmail-friends list.
pl 3.9.7 (Mon Jun 9 18:40:04 EDT 1997):
* Complain and exit if user tries to start fetchmail with options while a
diff --git a/driver.c b/driver.c
index c6d96fe6..d5bb5650 100644
--- a/driver.c
+++ b/driver.c
@@ -1398,13 +1398,11 @@ const struct method *proto; /* protocol method table */
/*
* We may need to get sizes in order to check message
- * limits. If we ever decide that always having accurate
- * whole-message (as opposed to header) lengths in the
- * progress messages is important, all we have to do is
- * remove the `&& ctl->limit' here.
+ * limits. Or it may be forced because the fetch methods
+ * don't return reliable sizes.
*/
msgsizes = (int *)NULL;
- if (proto->getsizes && ctl->limit > 0)
+ if (proto->getsizes && (proto->force_getsizes || ctl->limit > 0))
{
msgsizes = (int *)alloca(sizeof(int) * count);
@@ -1479,30 +1477,20 @@ const struct method *proto; /* protocol method table */
if (outlevel > O_SILENT)
{
- bool havesizes;
- int mlen;
+ bool wholesize = !protocol->fetch_body;
error_build("reading message %d", num);
- if (!protocol->fetch_body)
+ /* -1 means we didn't see a size in the response */
+ if (len == -1 && msgsizes)
{
- havesizes = TRUE;
- mlen = len;
- }
- else if (msgsizes)
- {
- havesizes = TRUE;
- mlen = msgsizes[num - 1];
- }
- else /* no way to know body size yet */
- {
- havesizes = FALSE;
- mlen = len;
+ len = msgsizes[num - 1];
+ wholesize = TRUE;
}
- if (mlen > 0)
+ if (len > 0)
error_build(" (%d %sbytes)",
- mlen, havesizes ? "" : "header ");
+ len, wholesize ? "" : "header ");
if (outlevel == O_VERBOSE)
error_complete(0, 0, "");
else
diff --git a/etrn.c b/etrn.c
index cba25269..817b4187 100644
--- a/etrn.c
+++ b/etrn.c
@@ -95,6 +95,7 @@ const static struct method etrn =
25, /* standard SMTP port */
FALSE, /* this is not a tagged protocol */
FALSE, /* this does not use a message delimiter */
+ FALSE, /* no getsizes method */
etrn_ok, /* parse command response */
NULL, /* no need to get authentication */
etrn_getrange, /* initialize message sending */
diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html
index d236ce39..467302a6 100644
--- a/fetchmail-FAQ.html
+++ b/fetchmail-FAQ.html
@@ -9,9 +9,8 @@
<BODY>
<H1>Frequently Asked Questions About Fetchmail</H1>
-The current version of fetchmail is 4.0. New in the FAQ: <a
-href="#O5">O5</a>, on what to do if your progress messages look
-garbled, and <a href="#T5">T5</a> on the Microsoft Exchange Server.<p>
+The current version of fetchmail is 3.9.8. New in the FAQ: <a
+href="#T5">T5</a>Using fetchmail with the Microsoft Exchange Server.<p>
Before reporting any bug, please read <a href="#G3">G3</a> for advice
on how to include diagnostic information that will get your bug fixed
@@ -1015,28 +1014,7 @@ without hacking potentially fragile startup scripts. To get around
it, just touch(1) the logfile before you run fetchmail (this will have
no effect on the contents of the logfile if it already exists).<P>
-<hr>
-<h2><a name="#O5">O5. The message lengths in my POP3 progress messages look like garbage.</a></h2>
-
-Aha. You are running a server that was written to the letter of the
-never-to-be-sufficiently-damned RFC 1725, which (among other heinous
-omissions) neglected to require that the <TT>OK</TT> response to a
-<TT>FETCH</TT> include the message length in octets. Requirement or
-not, there are very few servers that actually fail to issue this
-length. <P>
-
-There is a way to compensate for this lack using the <TT>LIST</TT> ,
-command, but it would incur a possibly significant speed penalty on
-<emph>all</emph> POP3 retrievals. Instead I have opted for a hack
-that has the unavoidable side effect of garbaging the length messages.
-This will not affect actual retrieval, and the messages will not
-even be visible when you run in daemon mode.<P>
-
-To fix this problem, install a better POP3 server like qpopper. Or
-better yet, install an <a href="http://www.washington.edu/imap">IMAP</a>
-server and chuck POP3 entirely.<p>
-
-$Id: fetchmail-FAQ.html,v 1.31 1997/06/14 17:28:11 esr Exp $<p>
+$Id: fetchmail-FAQ.html,v 1.32 1997/06/14 18:15:56 esr Exp $<p>
<HR>
<ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com">&lt;esr@snark.thyrsus.com&gt;</A></ADDRESS>
diff --git a/fetchmail.h b/fetchmail.h
index be3fb47b..ed3dc365 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -145,6 +145,7 @@ struct method
int port; /* service port */
bool tagged; /* if true, generate & expect command tags */
bool delimited; /* if true, accept "." message delimiter */
+ bool force_getsizes; /* if true, fetch's size return unreliable */
int (*parse_response)(); /* response_parsing function */
int (*getauth)(); /* authorization fetcher */
int (*getrange)(); /* get message range to fetch */
diff --git a/imap.c b/imap.c
index a4e2f092..7be22aba 100644
--- a/imap.c
+++ b/imap.c
@@ -622,6 +622,7 @@ const static struct method imap =
143, /* standard IMAP2bis/IMAP4 port */
TRUE, /* this is a tagged protocol */
FALSE, /* no message delimiter */
+ FALSE, /* fetch response size is reliable */
imap_ok, /* parse command response */
imap_getauth, /* get authorization */
imap_getrange, /* query range of messages */
diff --git a/pop2.c b/pop2.c
index f56647c2..8615c59a 100644
--- a/pop2.c
+++ b/pop2.c
@@ -119,6 +119,7 @@ const static struct method pop2 =
109, /* standard POP2 port */
FALSE, /* this is not a tagged protocol */
FALSE, /* does not use message delimiter */
+ FALSE, /* no getsizes method */
pop2_ok, /* parse command response */
pop2_getauth, /* get authorization */
pop2_getrange, /* query range of messages */
diff --git a/pop3.c b/pop3.c
index 6579b495..ebc6f962 100644
--- a/pop3.c
+++ b/pop3.c
@@ -247,20 +247,11 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp)
/*
* Look for "nnn octets" -- there may or may not be preceding cruft.
- *
- * Note, it is not guaranteed this will be set; the never-to-be-
- * sufficiently-damned RFC1725 doesn't require it. At least one
- * actual POP3 daemon (MercuryP/NLM v1.31) actually fails to issue
- * a length.
- *
- * To kluge around this, wedge a huge value into the message
- * length if we don't get one back. The only bad effect this will
- * have is to make the progress messages look funny. We'll
- * document this as a bug instead of forcing every poll to do a
- * LIST for sizes.
+ * It's OK to punt and return 0 as a failure indication here, as
+ * long as the force_getsizes flag has forced sizes to be preloaded.
*/
if ((cp = strstr(buf, " octets")) == (char *)NULL)
- *lenp = 0xffffffff;
+ *lenp = -1;
else
{
while (--cp >= buf && isdigit(*cp))
@@ -282,6 +273,7 @@ const static struct method pop3 =
110, /* standard POP3 port */
FALSE, /* this is not a tagged protocol */
TRUE, /* this uses a message delimiter */
+ TRUE, /* RFC 1725 doesn't require a size field in fetch */
pop3_ok, /* parse command response */
pop3_getauth, /* get authorization */
pop3_getrange, /* query range of messages */