From 90b1e50fdef9eba8c12408ce5bf9455d64eb288a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 10 Mar 1998 09:03:00 +0000 Subject: Dominique Unruh's patch to solve the headerless-body problem. svn path=/trunk/; revision=1695 --- NEWS | 2 ++ driver.c | 29 ++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index affd36e7..006cbc7f 100644 --- a/NEWS +++ b/NEWS @@ -10,12 +10,14 @@ * Handle multi-homed hosts correctly. * Add an "ident" per-user option for debugging that produces an "X-Fetchmail-ID" header in fetched messages for debugging. +* Total byte count in status message? Release Notes: ------------------------------------------------------------------------------ fetchmail-4.4.0 (): * Fix bug that prevented graceful exit from POP3 validation on wrong password. +* Dominique Unruh's patch that copes gracefully with bodiless messages. There are 275 people on fetchmail-friends and 153 on fetchmail-announce. diff --git a/driver.c b/driver.c index 22896547..dae0493b 100644 --- a/driver.c +++ b/driver.c @@ -5,6 +5,9 @@ * For license terms, see the file COPYING in this directory. */ +/* Modified 1998 by Dominique Unruh (doesn't block any + more, when message delimiter follows up directly to the headers) */ + #include "config.h" #include #include @@ -2006,6 +2009,7 @@ const struct method *proto; /* protocol method table */ && (ctl->fetchall || force_retrieval || !(protocol->is_old && (protocol->is_old)(sock,ctl,num))); flag suppress_delete = FALSE; flag suppress_forward = FALSE; + flag suppress_readbody = FALSE; flag retained = FALSE; /* @@ -2085,7 +2089,7 @@ const struct method *proto; /* protocol method table */ else if (ok == PS_REFUSED) suppress_forward = TRUE; else if (ok == PS_TRUNCATED) - suppress_forward = TRUE; + suppress_readbody = TRUE; else if (ok) goto cleanUp; set_timeout(ctl->server.timeout); @@ -2098,7 +2102,7 @@ const struct method *proto; /* protocol method table */ * or other PS_REFUSED error response during * read_headers. */ - if (protocol->fetch_body) + if (protocol->fetch_body && !suppress_readbody) { if (outlevel == O_VERBOSE) fputc('\n', stderr); @@ -2120,11 +2124,22 @@ const struct method *proto; /* protocol method table */ /* process the body now */ if (len > 0) { - ok = readbody(sock, - ctl, - !suppress_forward, - len); - if (ok == PS_TRANSIENT) + if (suppress_readbody) + { + /* When readheaders returns PS_TRUNCATED, + the body (which has no content + has already been read by readheaders, + so we say readbody returned PS_SUCCESS */ + ok = PS_SUCCESS; + } + else + { + ok = readbody(sock, + ctl, + !suppress_forward, + len); + } + if (ok == PS_TRANSIENT) suppress_delete = suppress_forward = TRUE; else if (ok) goto cleanUp; -- cgit v1.2.3