Subject: | fetch_hash() fails on large folders (command line too long) |
Date: | Sun, 26 Mar 2006 16:13:37 -0500 |
To: | Comment-Mail-IMAPClient [...] rt.cpan.org |
From: | Robert Terzi <rct [...] r-t.org> |
Version: 2.2.9
[FYI I tried to send this initially to DJKERNEN@cpan.org as a discussion
as mentioned in the docs. I got a bounce back from map@kernengroup.com
I suppose technically this isn't a bug but rather more of a feature
request.]
fetch_hash() can fail on large folders due to limits in
the IMAP server command length (UW-IMAP takes 8,000 bytes). In
particular this affects (older) folders with sparse UID numbers, so
even when using Range() the command length exceeds 8,000 bytes.
For fetch_hash() I don't see a reasonable work around for client
code -- other than reimplementing fetch_hash().
After thinking about it a little bit, this is what I came up with:
Would it be reasonable to have a version of Range()/MessageSet that
when given an argument for Max. command line size could return an
array of messageSets where the string version is smaller than the
max command line length?
Code that uses Range such as fetch(), fetch_hash(), ... would have
to iterate over of the array of objects (or strings) returned.
I don't know how many other IMAP servers are strict
about command length, I found one message from Mark Crispin where
he propoes that the official limit should be 1,000 characters which
sees unreasonbly strict.
I may try to implement something along these lines but I'm not
sure I understand enough of messageset to do that withony breaking
anything yet.
IMAPClient is very nicely designed to make it easy to write quick
IMAP scripts. I realize you can't possibly handle everything for
every IMAP server. However, I think tackling (some) of the command
line length issues in IMAPClient, would make it more robust.
Thanks,
--Rob