emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ea640581ba: Ensure that nnimap doesn't send too long lines to the


From: Lars Ingebrigtsen
Subject: master ea640581ba: Ensure that nnimap doesn't send too long lines to the server
Date: Thu, 23 Jun 2022 05:23:14 -0400 (EDT)

branch: master
commit ea640581bad1c596f657ca405f6c97e1b4fc4b11
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Ensure that nnimap doesn't send too long lines to the server
    
    * lisp/gnus/nnimap.el (nnimap-retrieve-headers): Don't send
    too-long lines to the server (bug#56138).
---
 lisp/gnus/nnimap.el | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index afd5418912..c158367b73 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -239,12 +239,21 @@ during splitting, which may be slow."
     (when (nnimap-change-group group server)
       (with-current-buffer (nnimap-buffer)
        (erase-buffer)
-       (nnimap-wait-for-response
-        (nnimap-send-command
-         "UID FETCH %s %s"
-         (nnimap-article-ranges (gnus-compress-sequence articles))
-         (nnimap-header-parameters))
-        t)
+        (let ((ranges (gnus-compress-sequence articles))
+              sequence)
+          ;; If we have a lot of ranges, split them up to avoid
+          ;; generating too-long lines.  (The limit is 8192 octects,
+          ;; and this should guarantee that it's (much) shorter than
+          ;; that.)
+          (while ranges
+            (setq sequence
+                 (nnimap-send-command
+                  "UID FETCH %s %s"
+                  (nnimap-article-ranges (seq-take ranges 200))
+                  (nnimap-header-parameters)))
+            (setq ranges (nthcdr 200 ranges)))
+          ;; Wait for the final one.
+         (nnimap-wait-for-response sequence t))
        (unless (process-live-p (get-buffer-process (current-buffer)))
          (error "IMAP server %S closed connection" nnimap-address))
        (nnimap-transform-headers)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]