]> Pileus Git - ~andy/fetchmail/commitdiff
Fix patch for Sunil Shetye's POP3 tweaks.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 13 Jan 2004 03:21:41 +0000 (03:21 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 13 Jan 2004 03:21:41 +0000 (03:21 -0000)
svn path=/trunk/; revision=3871

NEWS
pop3.c
todo.html

diff --git a/NEWS b/NEWS
index c7a101015918ee2d1435a0b0a5a2ee5243747ad2..5aebe8de4d442502161f85f65579bfa7e1d20709 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@
 
 * Sunil Shetye's fix to force fetchsizelimit to 1 for APOP and RPOP.
 * PopDel.py removed from contrib at author's request.
+* Matthias Andree's fix for Sunil Shetye's fetvh-split patch
+* include James Stone's moldremover.py script.
 
 fetchmail-6.2.5 (Wed Oct 15 18:39:22 EDT 2003), 23079 lines:
 
diff --git a/pop3.c b/pop3.c
index 2deb9699ca679c9d22d55db2f1f1e081d841ad4b..8e356f18a1ebcc24e02f765029756ddd09f9d2a4 100644 (file)
--- a/pop3.c
+++ b/pop3.c
@@ -911,25 +911,24 @@ static int pop3_getrange(int sock,
 static int pop3_getpartialsizes(int sock, int first, int last, int *sizes)
 /* capture the size of message #first */
 {
-    int        ok;
+    int        ok, i;
     char buf [POPBUFSIZE+1];
     unsigned int num, size;
 
-    /* for POP3, we can get the size of one mail only! */
-    if (first != last)
-    {
-       report(stderr, "cannot get a range of message sizes (%d-%d).\n", first, last);
-       return(PS_PROTOCOL);
-    }
-    gen_send(sock, "LIST %d", first);
-    if ((ok = pop3_ok(sock, buf)) != 0)
-       return(ok);
-    if (sscanf(buf, "%u %u", &num, &size) == 2) {
-       if (num == first)
-           sizes[0] = size;
-       else
-           /* warn about possible attempt to induce buffer overrun */
-           report(stderr, "Warning: ignoring bogus data for message sizes returned by server.\n");
+    for (i = first; i <= last; i++) {
+       gen_send(sock, "LIST %d", i);
+       if ((ok = pop3_ok(sock, buf)) != 0)
+           return(ok);
+       if (sscanf(buf, "%u %u", &num, &size) == 2) {
+           if (num == i)
+               sizes[i - first] = size;
+           else
+               /* warn about possible attempt to induce buffer overrun
+                *
+                * we expect server reply message number and requested
+                * message number to match */
+               report(stderr, "Warning: ignoring bogus data for message sizes returned by server.\n");
+       }
     }
     return(ok);
 }
index 0ce5014adf101a1fa58429a60c40ba7973c9130d..6060ecdcf37ebdf0cf86e5662a34444757124872 100644 (file)
--- a/todo.html
+++ b/todo.html
@@ -19,7 +19,7 @@ content="Known bugs and to-do items in fetchmail" />
 <tr>
 <td width="30%">Back to <a href="/~esr">Eric's Home Page</a></td>
 <td width="30%" align="center">Up to <a href="/~esr/sitemap.html">Site Map</a></td>
-<td width="30%" align="right">$Date: 2003/10/10 10:55:46 $</td>
+<td width="30%" align="right">$Date: 2004/01/13 03:21:41 $</td>
 </tr>
 </table>
 
@@ -83,6 +83,29 @@ failed" (leaving the message on the server, not putting it into
 found.  (This is so you don't lose mail if you configure the wrong
 envelope header.)</p>
 
+<p>Matthias Andree writes:</p>
+
+<blockquote> 
+<p>NOTE that the current code need optimization, if I have
+unseen articles 3 and 47, fetchmail will happily request LIST for
+articles 3...47 rather than just 3 and 47. In cases where the message
+numbers are far apart, this involves considerable overhead - which
+could be alleviated by pipelining the list commands, which needs
+either asynchronous reading while sending the commands, or knowing the
+send buffer, to avoid deadlocks. Unfortunately, I don't have the time
+to delve deeper into the code and look around.</p>
+                            
+<p>Note that such a pipelining function would be of universal use, so it
+should not be in pop3.c or something. I'd think the best approach is to
+call a "sender" function with the command and a callback, and the sender
+will call the receiver when the send buffer is full and call the
+callback function for each reply received.</p> 
+
+<p>See the ESMTP PIPELINING RFC for details on the deadlock avoidance
+requirements.</p>
+</blockquote>
+
+
 <p>The <a
 href="http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=fetchmail&amp;archive=no">
 Debian bug-tracking page for fetchmail</a> lists other bug
@@ -93,7 +116,7 @@ reports.</p>
 <tr>
 <td width="30%">Back to <a href="/~esr">Eric's Home Page</a></td>
 <td width="30%" align="center">Up to <a href="/~esr/sitemap.html">Site Map</a></td>
-<td width="30%" align="right">$Date: 2003/10/10 10:55:46 $</td>
+<td width="30%" align="right">$Date: 2004/01/13 03:21:41 $</td>
 </tr>
 </table>