[bug] imaplib case sensitive

Giampaolo Rodolà g.rodola at gmail.com
Wed Feb 22 09:56:54 CET 2012


Please file a bug on http://bugs.python.org/

--- Giampaolo
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/
http://code.google.com/p/pysendfile/

Il 21 febbraio 2012 10:31, Petite Abeille <petite.abeille at gmail.com> ha scritto:
> Hello,
>
> Looks like imaplib is case sensitive, even though the IMAP protocol isn't:
>
> (1) Except as noted otherwise, all alphabetic characters
>        are case-insensitive.  The use of upper or lower case
>        characters to define token strings is for editorial clarity
>        only.  Implementations MUST accept these strings in a
>        case-insensitive fashion.
>
> http://tools.ietf.org/html/rfc3501#section-9
>
> For example:
>
> [Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) ]
> [imaplib 2.58]
>
> import imaplib
>
> M = imaplib.IMAP4( 'localhost', 1143 )
> M.login( 'user', 'password' )
> M.select()
> typ, data = M.search(None, 'ALL')
> for num in data[0].split():
>    typ, data = M.fetch(num, '(ENVELOPE)')
>    print 'Message %s\n%s\n' % (num, data[0][1])
> M.close()
> M.logout()
>
> Traceback (most recent call last):
>  File "Test.py", line 3, in <module>
>    M = imaplib.IMAP4( 'localhost', 1143 )
>  File "python2.6/imaplib.py", line 184, in __init__
>    self.welcome = self._get_response()
>  File "python2.6/imaplib.py", line 935, in _get_response
>    raise self.abort("unexpected response: '%s'" % resp)
> imaplib.abort: unexpected response: '* ok imap4rev1'
>
> Note the 'ok' tag in lower case.
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list