]> Pileus Git - ~andy/fetchmail/commitdiff
Yet another step towards zero-length message handling.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 5 Jun 1997 20:41:35 +0000 (20:41 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 5 Jun 1997 20:41:35 +0000 (20:41 -0000)
svn path=/trunk/; revision=1067

driver.c

index cf58c145b924fde420a47242194a702d7c4fc1ab..75e2094e5748d86e0ecae4c55e2a310aa74dbc90 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -1555,35 +1555,42 @@ const struct method *proto;     /* protocol method table */
                         * or other PS_REFUSED error response during
                         * read_headers.
                         */
-                       if (protocol->fetch_body && !suppress_forward)
+                       if (protocol->fetch_body
                        {
                            if ((ok = (protocol->trail)(sock, ctl, num)))
                                goto cleanUp;
                            set_timeout(ctl->server.timeout);
-                           if ((ok = (protocol->fetch_body)(sock, ctl, num, &len)))
-                               goto cleanUp;
-                           set_timeout(ctl->server.timeout);
+                           len = 0;
+                           if (!suppress_forward)
+                           {
+                               if ((ok=(protocol->fetch_body)(sock,ctl,num,&len)))
+                                   goto cleanUp;
+                               set_timeout(ctl->server.timeout);
+                           }
                        }
 
                        /* process the body now */
-                       ok = readbody(sock,
-                                     ctl,
-                                     !suppress_forward,
-                                     len,
-                                     protocol->delimited);
-                       if (ok == PS_TRANSIENT)
-                           suppress_delete = TRUE;
-                       else if (ok)
-                           goto cleanUp;
-                       set_timeout(ctl->server.timeout);
-
-                       /* tell the server we got it OK and resynchronize */
-                       if (protocol->trail)
+                       if (len > 0)
                        {
-                           ok = (protocol->trail)(sock, ctl, num);
-                           if (ok != 0)
+                           ok = readbody(sock,
+                                         ctl,
+                                         !suppress_forward,
+                                         len,
+                                         protocol->delimited);
+                           if (ok == PS_TRANSIENT)
+                               suppress_delete = TRUE;
+                           else if (ok)
                                goto cleanUp;
                            set_timeout(ctl->server.timeout);
+
+                           /* tell server we got it OK and resynchronize */
+                           if (protocol->trail)
+                           {
+                               ok = (protocol->trail)(sock, ctl, num);
+                               if (ok != 0)
+                                   goto cleanUp;
+                               set_timeout(ctl->server.timeout);
+                           }
                        }
 
                        fetches++;