rust-imap: Unable to parse status response
Some of himalaya users reported me this error while trying to display their messages. The error occurs there:
let fetches = self
.sess()?
.fetch(&range, "(ENVELOPE FLAGS INTERNALDATE)")
.context(format!(r#"cannot fetch messages within range "{}""#, range))?;
It looks like the response from the IMAP server cannot be parsed properly. The problem is that:
- I cannot reproduce their error (it looks like it fails in a specific context)
- I cannot see which response fails because it is not included in the final error message: https://github.com/jonhoo/rust-imap/blob/6808dfef79e26945366794dc16e66cc0ad3d2a15/src/error.rs#L229
Any idea?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (16 by maintainers)
imap-proto 0.16.2 is on crates.io now.
Thanks for the tip, I will activate them and let you know if I have more information!
Seems to be a duplicate of https://github.com/djc/tokio-imap/issues/36, see also things like https://bugs.python.org/issue21815 and https://github.com/jstedfast/MailKit/issues/193. At this point probably make sense to just allow
[and]in flags, I’d open to taking a patch for this in imap-proto. Would be really nice to figure out where this OIB-Seen crap comes from…I’m curious what @djc (the maintainer of
imap-proto) has to say here.Hmm, that’s interesting — do they not get an
a2 OKin that first response? That makes it seem as though the server just sends the flags but doesn’t confirm the operation. If there is an OK hiding there, then I wonder if we fail to parse theFLAGSline somehow. Could you try adding that whole line into a unit test and see that it parses without error (maybe even just directly parse it withimap_proto)?Hmm, interesting. We should probably include the invalid content in the error. In the meantime I would offer your users a way to enable imap’s debug mode like here:
https://github.com/jonhoo/rust-imap/blob/d8d69a363b510c9ae506f12844661ae3cc4ecb45/examples/idle.rs#L53
Basically, just set
.debug = trueon yourSession. That should print the underlying traffic to stdout, which can be used to debug further!