diff options
| author | Lars Ingebrigtsen | 2022-06-23 11:22:29 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-06-23 11:23:08 +0200 |
| commit | ea640581bad1c596f657ca405f6c97e1b4fc4b11 (patch) | |
| tree | 286ed716089c038536544de3de7c3a0f32f7128c | |
| parent | 716a0f4025658490262d9a5f6d501775f1d59fb7 (diff) | |
| download | emacs-ea640581bad1c596f657ca405f6c97e1b4fc4b11.tar.gz emacs-ea640581bad1c596f657ca405f6c97e1b4fc4b11.zip | |
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).
| -rw-r--r-- | lisp/gnus/nnimap.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index afd5418912f..c158367b736 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -239,12 +239,21 @@ during splitting, which may be slow." | |||
| 239 | (when (nnimap-change-group group server) | 239 | (when (nnimap-change-group group server) |
| 240 | (with-current-buffer (nnimap-buffer) | 240 | (with-current-buffer (nnimap-buffer) |
| 241 | (erase-buffer) | 241 | (erase-buffer) |
| 242 | (nnimap-wait-for-response | 242 | (let ((ranges (gnus-compress-sequence articles)) |
| 243 | (nnimap-send-command | 243 | sequence) |
| 244 | "UID FETCH %s %s" | 244 | ;; If we have a lot of ranges, split them up to avoid |
| 245 | (nnimap-article-ranges (gnus-compress-sequence articles)) | 245 | ;; generating too-long lines. (The limit is 8192 octects, |
| 246 | (nnimap-header-parameters)) | 246 | ;; and this should guarantee that it's (much) shorter than |
| 247 | t) | 247 | ;; that.) |
| 248 | (while ranges | ||
| 249 | (setq sequence | ||
| 250 | (nnimap-send-command | ||
| 251 | "UID FETCH %s %s" | ||
| 252 | (nnimap-article-ranges (seq-take ranges 200)) | ||
| 253 | (nnimap-header-parameters))) | ||
| 254 | (setq ranges (nthcdr 200 ranges))) | ||
| 255 | ;; Wait for the final one. | ||
| 256 | (nnimap-wait-for-response sequence t)) | ||
| 248 | (unless (process-live-p (get-buffer-process (current-buffer))) | 257 | (unless (process-live-p (get-buffer-process (current-buffer))) |
| 249 | (error "IMAP server %S closed connection" nnimap-address)) | 258 | (error "IMAP server %S closed connection" nnimap-address)) |
| 250 | (nnimap-transform-headers) | 259 | (nnimap-transform-headers) |