[Imaplib2-devel] raise self.error(self.welcome) error: None

Piers Lauder piers at janeelix.com
Thu Jun 16 02:16:42 BST 2011

On Tue, 14 Jun 2011 13:54:40 +0200, Sebastian Spaeth wrote:
  > On Tue, 14 Jun 2011 11:12:37 +0000 (UTC), Marcelo Luiz de Laia wrote:
  > > > It would be great if we could get an
  > > > IMAP debug log
  > > 
  > > Here it is:
  > > 
  > > http://pastebin.com/ZHCwTgiS
  > Piers, here is the full IMAP protocol of the failed welcome retrieval. I
  > am sorry, I don't understand what is going on here :-)
  > Any hints?
  > Sebastian

The problem here is a malformed command continuation request from the server.

imaplib2 expects continutation requests in the form
  "+[<space><optional data>]"
but the server is sending "+OK..." - ie: no space.

Normally the first response from a server is an "* OK ..." untagged response.

On re-reading RFC2060, I can't see any example where there isn't a space
after the '+', but I also can't see where is is mandated, so as a first
fix I'd suggest changing the regular expression to match a continuation
request to be:

    continuation_cre = re.compile(r'\+ ?(?P<data>.*)')

There are other places where a space is expected, such as in untagged
responses which are expecting "* <data>", so if this server is going
instead to send "*<data>" then we may need to fix other matchers.

My gut feeling is that this is a bad idea, as data is sent via
continuation responses, and if the space is optional, how is one to
know whether it is part of the data or not?

What do you think?


More information about the OfflineIMAP-project mailing list