This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Lita.Cho
Recipients Lita.Cho, barry, ezio.melotti, jesstess, r.david.murray, rafales
Date 2014-07-16.17:43:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CACsGvspcUdaQdpC4YQ5iTohFQcJb_3vdbmH79SKMXtoVK_ou=w@mail.gmail.com>
In-reply-to <1405519645.76.0.742545975205.issue21815@psf.upfronthosting.co.za>
Content
>
> R. David Murray added the comment:
>
> Just to make sure I understand: the issue is that gmail may produce flags
> with [] in them, and imaplib currently fails to process such flags when it
> receives them from gmail?
>
> This is correct. Gmail allows you to create flags with [], and the
Response_code regex doesn't process them properly.

> In principle I think we would not want to allow imaplib to be used to
> create such flags unless the user specifies some sort of "I want to violate
> the RFC" flag (which they might want to do, for example, to run tests
> against gmail :)  But currently it looks like it can?  (I haven't looked at
> this in enough detail to be sure.)  If that's true we probably have to
> continue to allow it for backward compatibility reasons, but we should
> document the RFC violation and possible consequences (an IMAP server
> rejecting such flags).
>
> Yes, currently we can. I've posted the code in order to do this. This is
basically the result.

>>> first_id = msg_ids.split()[0]
>>> mail.store(first_id, "+FLAGS", "[test]")
('OK', [b'1 (FLAGS (\\Seen Answered [test] NotJunk $NotJunk [Brackets]
[testing2]))'])

However, I would think it would be the server's job to uphold this rule,
not the library. The server should return with a BAD response, but right
now, Gmail allows you to do this.

Should we throw a warning in the "store" method? Otherwise, I can update
the documenation in the "store" method stating that having '[]' is allowed
but violates the RFC protocol.

> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue21815>
> _______________________________________
>
History
Date User Action Args
2014-07-16 17:43:37Lita.Chosetrecipients: + Lita.Cho, barry, ezio.melotti, r.david.murray, jesstess, rafales
2014-07-16 17:43:37Lita.Cholinkissue21815 messages
2014-07-16 17:43:37Lita.Chocreate