Subject: | Error in IMAP::Client 0.13 |
Date: | Thu, 24 Sep 2009 17:04:06 -0700 |
To: | <bug-IMAP-Client [...] rt.cpan.org> |
From: | Chris Nowak <chris.nowak [...] corp.aol.com> |
In scripting up a spider to help me troubleshoot some Microsoft Exchange
IMAP implementation problems, I ran into a problem in IMAP::Client 0.13.
If a multiline response ends in OK, coming from an Exchange server, you get
³INTERNAL ERROR: No msgid set, but still trying to build fetchsets² as an
error.
I traced the problem to
sub ok_response(@) {
return (($_[$#_] =~ /^$VALID_TAG+?\s*OK\s+/) ? 1 : 0);
}
The problem is that the "\s+" on the tail end of that regex is matching OK
in in appropriate places.
Specifically, this line of text in the middle of a large encoded attachment
triggers it:
8GXegeDtQ06QM9hd6HNZs8hh8xvsSiigAooooAKxPE0E1z4c8QW1vG81xcaJqsEEMalpJZpbCeOK
The trick is that the EOL sent from Windows is \r\n, but Perl on linux is
expecting only \n.
So the imap reader pulls the whole line, strips off the \n, leaving the
\r... Which the regex interprets as whitespace, matching the regex, and
returning a false positive from "ok_response".
For a quick fix, I replaced the trailing \s with [ \t], and things shaped up
nicely.
It's not an elegant fix.. But got the job done enough for me. It maybe
better to smarten up imap_receive_tagless, but I don't have really have the
big picture for a good clean proper solution.
Other note: ConnectMethod SSL, but I don't imagine that is relevant since
getline is defined much lower.
Chris
--
Chris Nowak
Chris.Nowak@corp.aol.com - (949) 737-2727
System Operations - AOL - Irvine, CA
MCSA:Messaging, A+, Server+, Network+, Security+, Project+
"Quidquid latine dictum sit, altum sonatur."