diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-06-14 18:15:57 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-06-14 18:15:57 +0000 |
commit | 05581922ac0ad62541057bf2d7b5d28189d59cbc (patch) | |
tree | 9f4e997162673e9d29087107b82b6c19a1ac73c4 /driver.c | |
parent | beb2400cca418bc16c8b76dae8f08f7d4f9e400d (diff) | |
download | fetchmail-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
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 32 |
1 files changed, 10 insertions, 22 deletions
@@ -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 |