From 7fb3bdf11a38a6f647f2e8a68f24e6d3906c28b8 Mon Sep 17 00:00:00 2001 From: Arnt Gulbrandsen Date: Thu, 12 Mar 2015 15:35:16 +0100 Subject: Increase IMAP line length limit. The response that tends to run up against the limit is SEARCH. The previous version restricted searches to have around 1,000 results, this one supports searches with around 25,000 results. (The previous version, like the RFC that advised that limit, were written in an age of 10MB mailbox quotas. Then came gmail.) --- Lib/imaplib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 49ee39d..0445204 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -47,9 +47,10 @@ AllowedVersions = ('IMAP4REV1', 'IMAP4') # Most recent first # reading arbitrary length lines. RFC 3501 and 2060 (IMAP 4rev1) # don't specify a line length. RFC 2683 however suggests limiting client # command lines to 1000 octets and server command lines to 8000 octets. -# We have selected 10000 for some extra margin and since that is supposedly -# also what UW and Panda IMAP does. -_MAXLINE = 10000 +# This version of imaplib uses 262144 since occasionally some valid SEARCH +# responses are much, much bigger than 8k. RFC2683 was written before +# gmail. +_MAXLINE = 262144 # Commands -- 1.9.1